Skip to content

Commit 28f03ac

Browse files
committedOct 27, 2020
Auto merge of #78421 - JohnTitor:rollup-bq2d7fo, r=JohnTitor
Rollup of 16 pull requests Successful merges: - #76635 (Add [T]::as_chunks(_mut)) - #77703 (add system-llvm-libunwind config option) - #78219 (Prefer to use `print_def_path`) - #78298 (Add test for bad NLL higher-ranked subtype) - #78332 (Update description for error E0308) - #78342 (Use check-pass in single-use-lifetime ui tests) - #78347 (Add lexicographical comparison doc) - #78348 (Make some functions private that don't have to be public) - #78349 (Use its own `TypeckResults` to avoid ICE) - #78375 (Use ? in core/std macros) - #78377 (Fix typo in debug statement) - #78388 (Add some regression tests) - #78394 (fix(docs): typo in BufWriter documentation) - #78396 (Add compiler support for LLVM's x86_64 ERMSB feature) - #78405 (Fix typo in lint description) - #78412 (Improve formatting of hash collections docs) Failed merges: r? `@ghost`
2 parents a4d30a7 + 4236d27 commit 28f03ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+558
-262
lines changed
 

‎compiler/rustc_codegen_ssa/src/target_features.rs

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
6363
("bmi1", None),
6464
("bmi2", None),
6565
("cmpxchg16b", Some(sym::cmpxchg16b_target_feature)),
66+
("ermsb", Some(sym::ermsb_target_feature)),
6667
("f16c", Some(sym::f16c_target_feature)),
6768
("fma", None),
6869
("fxsr", None),
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
Expected type did not match the received type.
22

3-
Erroneous code example:
3+
Erroneous code examples:
44

55
```compile_fail,E0308
6-
let x: i32 = "I am not a number!";
7-
// ~~~ ~~~~~~~~~~~~~~~~~~~~
8-
// | |
9-
// | initializing expression;
10-
// | compiler infers type `&str`
11-
// |
12-
// type `i32` assigned to variable `x`
6+
fn plus_one(x: i32) -> i32 {
7+
x + 1
8+
}
9+
10+
plus_one("Not a number");
11+
// ^^^^^^^^^^^^^^ expected `i32`, found `&str`
12+
13+
if "Not a bool" {
14+
// ^^^^^^^^^^^^ expected `bool`, found `&str`
15+
}
16+
17+
let x: f32 = "Not a float";
18+
// --- ^^^^^^^^^^^^^ expected `f32`, found `&str`
19+
// |
20+
// expected due to this
1321
```
1422

15-
This error occurs when the compiler is unable to infer the concrete type of a
16-
variable. It can occur in several cases, the most common being a mismatch
17-
between two types: the type the author explicitly assigned, and the type the
18-
compiler inferred.
23+
This error occurs when an expression was used in a place where the compiler
24+
expected an expression of a different type. It can occur in several cases, the
25+
most common being when calling a function and passing an argument which has a
26+
different type than the matching type in the function declaration.

0 commit comments

Comments
 (0)
Please sign in to comment.