rust - 由于类型不匹配,sqlx 安装失败
问题描述
我在 Ubuntu 18.04 上安装sqlx :
cargo install --git https://github.com/launchbadge/sqlx sqlx-cli
我得到错误
error[E0308]: mismatched types
--> sqlx-cli/src/opt.rs:8:20
|
8 | #[clap(short = "D", long)]
| ^^^ expected `char`, found `&str`
$ rustc --explain E0308
Expected type did not match the received type.
Erroneous code example:
```
let x: i32 = "I am not a number!";
// ~~~ ~~~~~~~~~~~~~~~~~~~~
// | |
// | initializing expression;
// | compiler infers type `&str`
// |
// type `i32` assigned to variable `x`
```
This error occurs when the compiler is unable to infer the concrete type of a
variable. It can occur in several cases, the most common being a mismatch
between two types: the type the author explicitly assigned, and the type the
compiler inferred.
$ rustc --version
rustc 1.47.0 (18bf6b4f0 2020-10-07)
$ cargo --version
cargo 1.47.0 (f3c7e066a 2020-08-28)
如何解决错误并完成安装?
解决方案
跑步
cargo install -f --git https://github.com/launchbadge/sqlx sqlx-cli
代替
cargo install --git https://github.com/launchbadge/sqlx sqlx-cli
解决问题
推荐阅读
- git - 用于微服务和部署的单一 GIT 存储库
- python - 我正在尝试保存我所做的聚类结果并显示此错误消息“int”对象不可下标
- angular - Azure AD B2C:不支持请求中提供的范围“user.read”
- video - 在处理 3 中运行 .mov 文件时遇到问题
- .net - 什么是 F# 中的歧视联合以及我们在 OOP 中有什么类型的替代方案
- asynchronous - 爬虫设计 - 调用异步作业与调用服务
- javascript - 调用设置为变量的函数错误:“未捕获的类型错误:无法读取未定义的属性‘长度’”
- url - 在twig中结合文档的标题和文档的url
- android - 在 combineLatest 警告上删除 RxJava 未经检查的强制转换而不抑制它们
- schema.org - PageMap 不包含在 Google 自定义搜索引擎的搜索结果中