forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#78421 - JohnTitor:rollup-bq2d7fo, r=JohnTitor
Rollup of 16 pull requests Successful merges: - rust-lang#76635 (Add [T]::as_chunks(_mut)) - rust-lang#77703 (add system-llvm-libunwind config option) - rust-lang#78219 (Prefer to use `print_def_path`) - rust-lang#78298 (Add test for bad NLL higher-ranked subtype) - rust-lang#78332 (Update description for error E0308) - rust-lang#78342 (Use check-pass in single-use-lifetime ui tests) - rust-lang#78347 (Add lexicographical comparison doc) - rust-lang#78348 (Make some functions private that don't have to be public) - rust-lang#78349 (Use its own `TypeckResults` to avoid ICE) - rust-lang#78375 (Use ? in core/std macros) - rust-lang#78377 (Fix typo in debug statement) - rust-lang#78388 (Add some regression tests) - rust-lang#78394 (fix(docs): typo in BufWriter documentation) - rust-lang#78396 (Add compiler support for LLVM's x86_64 ERMSB feature) - rust-lang#78405 (Fix typo in lint description) - rust-lang#78412 (Improve formatting of hash collections docs) Failed merges: r? `@ghost`
- Loading branch information
Showing
51 changed files
with
558 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
Expected type did not match the received type. | ||
|
||
Erroneous code example: | ||
Erroneous code examples: | ||
|
||
```compile_fail,E0308 | ||
let x: i32 = "I am not a number!"; | ||
// ~~~ ~~~~~~~~~~~~~~~~~~~~ | ||
// | | | ||
// | initializing expression; | ||
// | compiler infers type `&str` | ||
// | | ||
// type `i32` assigned to variable `x` | ||
fn plus_one(x: i32) -> i32 { | ||
x + 1 | ||
} | ||
plus_one("Not a number"); | ||
// ^^^^^^^^^^^^^^ expected `i32`, found `&str` | ||
if "Not a bool" { | ||
// ^^^^^^^^^^^^ expected `bool`, found `&str` | ||
} | ||
let x: f32 = "Not a float"; | ||
// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` | ||
// | | ||
// expected due to this | ||
``` | ||
|
||
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. | ||
This error occurs when an expression was used in a place where the compiler | ||
expected an expression of a different type. It can occur in several cases, the | ||
most common being when calling a function and passing an argument which has a | ||
different type than the matching type in the function declaration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -467,6 +467,7 @@ symbols! { | |
encode, | ||
env, | ||
eq, | ||
ermsb_target_feature, | ||
err, | ||
exact_div, | ||
except, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.