diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 5d9b3a8fba4d7..6a7cf4dd32878 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -102,12 +102,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // N.B., this code relies on `self.diverges` to be accurate. In // particular, assignments to `!` will be permitted if the // diverges flag is currently "always". - pub fn demand_coerce_diag(&self, - expr: &hir::Expr, - checked_ty: Ty<'tcx>, - expected: Ty<'tcx>, - allow_two_phase: AllowTwoPhase) - -> (Ty<'tcx>, Option>) { + pub fn demand_coerce_diag( + &self, + expr: &hir::Expr, + checked_ty: Ty<'tcx>, + expected: Ty<'tcx>, + allow_two_phase: AllowTwoPhase, + ) -> (Ty<'tcx>, Option>) { let expected = self.resolve_vars_with_obligations(expected); let e = match self.try_coerce(expr, checked_ty, expected, allow_two_phase) { @@ -126,6 +127,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return (expected, None) } + self.annotate_expected_due_to_let_ty(&mut err, expr); self.suggest_compatible_variants(&mut err, expr, expected, expr_ty); self.suggest_ref_or_into(&mut err, expr, expected, expr_ty); self.suggest_boxing_when_appropriate(&mut err, expr, expected, expr_ty); @@ -134,6 +136,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (expected, Some(err)) } + fn annotate_expected_due_to_let_ty(&self, err: &mut DiagnosticBuilder<'_>, expr: &hir::Expr) { + let parent = self.tcx.hir().get_parent_node(expr.hir_id); + if let Some(hir::Node::Local(hir::Local { + ty: Some(ty), + init: Some(init), + .. + })) = self.tcx.hir().find(parent) { + if init.hir_id == expr.hir_id { + // Point at `let` assignment type. + err.span_label(ty.span, "expected due to this"); + } + } + } + /// Returns whether the expected type is `bool` and the expression is `x = y`. pub fn is_assign_to_bool(&self, expr: &hir::Expr, expected: Ty<'tcx>) -> bool { if let hir::ExprKind::Assign(..) = expr.kind { diff --git a/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout b/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout index a8753d14de22f..f4ee2970950d4 100644 --- a/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout +++ b/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout @@ -9,7 +9,9 @@ error[E0308]: mismatched types --> $DIR/failed-doctest-missing-codes.rs:9:13 | LL | let x: () = 5i32; - | ^^^^ expected (), found i32 + | -- ^^^^ expected (), found i32 + | | + | expected due to this | = note: expected type `()` found type `i32` diff --git a/src/test/ui/array-not-vector.stderr b/src/test/ui/array-not-vector.stderr index b5a5389db093a..cd87a9f67c2d6 100644 --- a/src/test/ui/array-not-vector.stderr +++ b/src/test/ui/array-not-vector.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/array-not-vector.rs:2:19 | LL | let _x: i32 = [1, 2, 3]; - | ^^^^^^^^^ expected i32, found array of 3 elements + | --- ^^^^^^^^^ expected i32, found array of 3 elements + | | + | expected due to this | = note: expected type `i32` found type `[{integer}; 3]` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/array-not-vector.rs:9:20 | LL | let _y: &i32 = x; - | ^ expected i32, found slice + | ---- ^ expected i32, found slice + | | + | expected due to this | = note: expected type `&i32` found type `&[i32]` diff --git a/src/test/ui/associated-types/associated-types-eq-3.stderr b/src/test/ui/associated-types/associated-types-eq-3.stderr index 0f2bc84aa1c59..882556f0199de 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.stderr +++ b/src/test/ui/associated-types/associated-types-eq-3.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/associated-types-eq-3.rs:23:18 | LL | let _: Bar = x.boo(); - | ^^^^^^^ expected struct `Bar`, found associated type + | --- ^^^^^^^ expected struct `Bar`, found associated type + | | + | expected due to this | = note: expected type `Bar` found type `::A` diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr index 246c745cd3385..c2026c5291147 100644 --- a/src/test/ui/associated-types/associated-types-path-2.stderr +++ b/src/test/ui/associated-types/associated-types-path-2.stderr @@ -43,7 +43,9 @@ error[E0308]: mismatched types --> $DIR/associated-types-path-2.rs:41:18 | LL | let _: i32 = f2(2i32); - | ^^^^^^^^ expected i32, found u32 + | --- ^^^^^^^^ expected i32, found u32 + | | + | expected due to this | help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit | diff --git a/src/test/ui/c-variadic/variadic-ffi-1.stderr b/src/test/ui/c-variadic/variadic-ffi-1.stderr index 73f72a177bcaa..d3b24b4a2694a 100644 --- a/src/test/ui/c-variadic/variadic-ffi-1.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-1.stderr @@ -26,7 +26,9 @@ error[E0308]: mismatched types --> $DIR/variadic-ffi-1.rs:19:56 | LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; - | ^^^ expected non-variadic fn, found variadic function + | ------------------------------------- ^^^ expected non-variadic fn, found variadic function + | | + | expected due to this | = note: expected type `unsafe extern "C" fn(isize, u8)` found type `unsafe extern "C" fn(isize, u8, ...) {foo}` @@ -35,7 +37,9 @@ error[E0308]: mismatched types --> $DIR/variadic-ffi-1.rs:20:54 | LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; - | ^^^ expected variadic fn, found non-variadic function + | ----------------------------------- ^^^ expected variadic fn, found non-variadic function + | | + | expected due to this | = note: expected type `extern "C" fn(isize, u8, ...)` found type `extern "C" fn(isize, u8) {bar}` diff --git a/src/test/ui/closures/closure-no-fn-1.stderr b/src/test/ui/closures/closure-no-fn-1.stderr index 6d07c6b035ee4..8405846513d09 100644 --- a/src/test/ui/closures/closure-no-fn-1.stderr +++ b/src/test/ui/closures/closure-no-fn-1.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/closure-no-fn-1.rs:6:29 | LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a }; - | ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure + | ------------ ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure + | | + | expected due to this | = note: expected type `fn(u8) -> u8` found type `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50 a:_]` diff --git a/src/test/ui/closures/closure-no-fn-2.stderr b/src/test/ui/closures/closure-no-fn-2.stderr index 5adcdf6058b71..5126a8db0551e 100644 --- a/src/test/ui/closures/closure-no-fn-2.stderr +++ b/src/test/ui/closures/closure-no-fn-2.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/closure-no-fn-2.rs:6:27 | LL | let bar: fn() -> u8 = || { b }; - | ^^^^^^^^ expected fn pointer, found closure + | ---------- ^^^^^^^^ expected fn pointer, found closure + | | + | expected due to this | = note: expected type `fn() -> u8` found type `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35 b:_]` diff --git a/src/test/ui/coercion/coerce-to-bang.stderr b/src/test/ui/coercion/coerce-to-bang.stderr index a46e97da8159b..0aa4bc3fe25ed 100644 --- a/src/test/ui/coercion/coerce-to-bang.stderr +++ b/src/test/ui/coercion/coerce-to-bang.stderr @@ -47,7 +47,9 @@ error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:50:21 | LL | let x: [!; 2] = [return, 22]; - | ^^^^^^^^^^^^ expected !, found integer + | ------ ^^^^^^^^^^^^ expected !, found integer + | | + | expected due to this | = note: expected type `[!; 2]` found type `[{integer}; 2]` diff --git a/src/test/ui/coercion/coercion-slice.stderr b/src/test/ui/coercion/coercion-slice.stderr index ccd776e987938..f274f3dc9ef60 100644 --- a/src/test/ui/coercion/coercion-slice.stderr +++ b/src/test/ui/coercion/coercion-slice.stderr @@ -2,10 +2,11 @@ error[E0308]: mismatched types --> $DIR/coercion-slice.rs:4:21 | LL | let _: &[i32] = [0]; - | ^^^ - | | - | expected &[i32], found array of 1 element - | help: consider borrowing here: `&[0]` + | ------ ^^^ + | | | + | | expected &[i32], found array of 1 element + | | help: consider borrowing here: `&[0]` + | expected due to this | = note: expected type `&[i32]` found type `[{integer}; 1]` diff --git a/src/test/ui/const-generics/fn-const-param-infer.stderr b/src/test/ui/const-generics/fn-const-param-infer.stderr index e36bb824151f7..d39c367f182b2 100644 --- a/src/test/ui/const-generics/fn-const-param-infer.stderr +++ b/src/test/ui/const-generics/fn-const-param-infer.stderr @@ -10,7 +10,9 @@ error[E0308]: mismatched types --> $DIR/fn-const-param-infer.rs:16:31 | LL | let _: Checked = Checked::; - | ^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two` + | ---------------- ^^^^^^^^^^^^^^^^^^ expected `not_one`, found `not_two` + | | + | expected due to this | = note: expected type `Checked` found type `Checked` @@ -34,7 +36,9 @@ error[E0308]: mismatched types --> $DIR/fn-const-param-infer.rs:25:40 | LL | let _: Checked<{generic::}> = Checked::<{generic::}>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `generic::`, found `generic::` + | ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `generic::`, found `generic::` + | | + | expected due to this | = note: expected type `Checked>` found type `Checked>` diff --git a/src/test/ui/const-generics/raw-ptr-const-param.stderr b/src/test/ui/const-generics/raw-ptr-const-param.stderr index 75b4c0a0a3de3..6763295a4274c 100644 --- a/src/test/ui/const-generics/raw-ptr-const-param.stderr +++ b/src/test/ui/const-generics/raw-ptr-const-param.stderr @@ -10,7 +10,9 @@ error[E0308]: mismatched types --> $DIR/raw-ptr-const-param.rs:7:38 | LL | let _: Const<{15 as *const _}> = Const::<{10 as *const _}>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{pointer}`, found `{pointer}` + | ----------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{pointer}`, found `{pointer}` + | | + | expected due to this | = note: expected type `Const<{pointer}>` found type `Const<{pointer}>` diff --git a/src/test/ui/const-generics/slice-const-param-mismatch.stderr b/src/test/ui/const-generics/slice-const-param-mismatch.stderr index 380a70d664e05..35a5eec3225ee 100644 --- a/src/test/ui/const-generics/slice-const-param-mismatch.stderr +++ b/src/test/ui/const-generics/slice-const-param-mismatch.stderr @@ -10,7 +10,9 @@ error[E0308]: mismatched types --> $DIR/slice-const-param-mismatch.rs:9:35 | LL | let _: ConstString<"Hello"> = ConstString::<"World">; - | ^^^^^^^^^^^^^^^^^^^^^^ expected `"Hello"`, found `"World"` + | -------------------- ^^^^^^^^^^^^^^^^^^^^^^ expected `"Hello"`, found `"World"` + | | + | expected due to this | = note: expected type `ConstString<"Hello">` found type `ConstString<"World">` @@ -19,7 +21,9 @@ error[E0308]: mismatched types --> $DIR/slice-const-param-mismatch.rs:11:33 | LL | let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; - | ^^^^^^^^^^^^^^^^^^^^^ expected `"ℇ㇈↦"`, found `"ℇ㇈↥"` + | ------------------- ^^^^^^^^^^^^^^^^^^^^^ expected `"ℇ㇈↦"`, found `"ℇ㇈↥"` + | | + | expected due to this | = note: expected type `ConstString<"ℇ㇈↦">` found type `ConstString<"ℇ㇈↥">` @@ -28,7 +32,9 @@ error[E0308]: mismatched types --> $DIR/slice-const-param-mismatch.rs:13:33 | LL | let _: ConstBytes = ConstBytes::; - | ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"` + | ------------------ ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"` + | | + | expected due to this | = note: expected type `ConstBytes` found type `ConstBytes` diff --git a/src/test/ui/const-generics/types-mismatch-const-args.stderr b/src/test/ui/const-generics/types-mismatch-const-args.stderr index 805a3067d3b6b..276c73a7393ea 100644 --- a/src/test/ui/const-generics/types-mismatch-const-args.stderr +++ b/src/test/ui/const-generics/types-mismatch-const-args.stderr @@ -10,7 +10,9 @@ error[E0308]: mismatched types --> $DIR/types-mismatch-const-args.rs:13:41 | LL | let _: A<'a, u32, {2u32}, {3u32}> = A::<'a, u32, {4u32}, {3u32}> { data: PhantomData }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2u32`, found `4u32` + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2u32`, found `4u32` + | | + | expected due to this | = note: expected type `A<'_, _, 2u32, _>` found type `A<'_, _, 4u32, _>` @@ -19,7 +21,9 @@ error[E0308]: mismatched types --> $DIR/types-mismatch-const-args.rs:15:41 | LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u16, found u32 + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u16, found u32 + | | + | expected due to this | = note: expected type `A<'a, u16, _, _>` found type `A<'b, u32, _, _>` diff --git a/src/test/ui/conversion-methods.stderr b/src/test/ui/conversion-methods.stderr index 5c666afb89a33..bf0741766a8ba 100644 --- a/src/test/ui/conversion-methods.stderr +++ b/src/test/ui/conversion-methods.stderr @@ -2,10 +2,11 @@ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:5:41 | LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; - | ^^^^^^^^^^^^^^^^^^^^^ - | | - | expected struct `std::string::String`, found reference - | help: try using a conversion method: `"'Tis a fond Ambush—".to_string()` + | ------ ^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected struct `std::string::String`, found reference + | | help: try using a conversion method: `"'Tis a fond Ambush—".to_string()` + | expected due to this | = note: expected type `std::string::String` found type `&'static str` @@ -14,10 +15,11 @@ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:6:40 | LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | expected struct `std::path::PathBuf`, found reference - | help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()` + | ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected struct `std::path::PathBuf`, found reference + | | help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()` + | expected due to this | = note: expected type `std::path::PathBuf` found type `&std::path::Path` @@ -26,10 +28,11 @@ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:9:40 | LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here - | ^ - | | - | expected struct `std::string::String`, found integer - | help: try using a conversion method: `2.to_string()` + | ------ ^ + | | | + | | expected struct `std::string::String`, found integer + | | help: try using a conversion method: `2.to_string()` + | expected due to this | = note: expected type `std::string::String` found type `{integer}` @@ -38,10 +41,11 @@ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:12:47 | LL | let _prove_piercing_earnest: Vec = &[1, 2, 3]; - | ^^^^^^^^^^ - | | - | expected struct `std::vec::Vec`, found reference - | help: try using a conversion method: `(&[1, 2, 3]).to_vec()` + | ---------- ^^^^^^^^^^ + | | | + | | expected struct `std::vec::Vec`, found reference + | | help: try using a conversion method: `(&[1, 2, 3]).to_vec()` + | expected due to this | = note: expected type `std::vec::Vec` found type `&[{integer}; 3]` diff --git a/src/test/ui/cross/cross-borrow-trait.stderr b/src/test/ui/cross/cross-borrow-trait.stderr index ada1c0204eb01..445daffc9d8d1 100644 --- a/src/test/ui/cross/cross-borrow-trait.stderr +++ b/src/test/ui/cross/cross-borrow-trait.stderr @@ -2,10 +2,11 @@ error[E0308]: mismatched types --> $DIR/cross-borrow-trait.rs:10:26 | LL | let _y: &dyn Trait = x; - | ^ - | | - | expected &dyn Trait, found struct `std::boxed::Box` - | help: consider borrowing here: `&x` + | ---------- ^ + | | | + | | expected &dyn Trait, found struct `std::boxed::Box` + | | help: consider borrowing here: `&x` + | expected due to this | = note: expected type `&dyn Trait` found type `std::boxed::Box` diff --git a/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr index 301704ec0c7ef..97a1333bdc288 100644 --- a/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr +++ b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr @@ -2,10 +2,11 @@ error[E0308]: mismatched types --> $DIR/issue-53280-expected-float-found-integer-literal.rs:2:24 | LL | let sixteen: f32 = 16; - | ^^ - | | - | expected f32, found integer - | help: use a float literal: `16.0` + | --- ^^ + | | | + | | expected f32, found integer + | | help: use a float literal: `16.0` + | expected due to this | = note: expected type `f32` found type `{integer}` @@ -14,10 +15,11 @@ error[E0308]: mismatched types --> $DIR/issue-53280-expected-float-found-integer-literal.rs:5:38 | LL | let a_million_and_seventy: f64 = 1_000_070; - | ^^^^^^^^^ - | | - | expected f64, found integer - | help: use a float literal: `1_000_070.0` + | --- ^^^^^^^^^ + | | | + | | expected f64, found integer + | | help: use a float literal: `1_000_070.0` + | expected due to this | = note: expected type `f64` found type `{integer}` @@ -26,10 +28,11 @@ error[E0308]: mismatched types --> $DIR/issue-53280-expected-float-found-integer-literal.rs:8:30 | LL | let negative_nine: f32 = -9; - | ^^ - | | - | expected f32, found integer - | help: use a float literal: `-9.0` + | --- ^^ + | | | + | | expected f32, found integer + | | help: use a float literal: `-9.0` + | expected due to this | = note: expected type `f32` found type `{integer}` @@ -38,7 +41,9 @@ error[E0308]: mismatched types --> $DIR/issue-53280-expected-float-found-integer-literal.rs:15:30 | LL | let sixteen_again: f64 = 0x10; - | ^^^^ expected f64, found integer + | --- ^^^^ expected f64, found integer + | | + | expected due to this | = note: expected type `f64` found type `{integer}` @@ -47,7 +52,9 @@ error[E0308]: mismatched types --> $DIR/issue-53280-expected-float-found-integer-literal.rs:17:30 | LL | let and_once_more: f32 = 0o20; - | ^^^^ expected f32, found integer + | --- ^^^^ expected f32, found integer + | | + | expected due to this | = note: expected type `f32` found type `{integer}` diff --git a/src/test/ui/did_you_mean/recursion_limit_deref.stderr b/src/test/ui/did_you_mean/recursion_limit_deref.stderr index c76efb1d00920..dcb37e00b4124 100644 --- a/src/test/ui/did_you_mean/recursion_limit_deref.stderr +++ b/src/test/ui/did_you_mean/recursion_limit_deref.stderr @@ -10,7 +10,9 @@ error[E0308]: mismatched types --> $DIR/recursion_limit_deref.rs:50:22 | LL | let x: &Bottom = &t; - | ^^ expected struct `Bottom`, found struct `Top` + | ------- ^^ expected struct `Bottom`, found struct `Top` + | | + | expected due to this | = note: expected type `&Bottom` found type `&Top` diff --git a/src/test/ui/dst/dst-bad-coerce1.stderr b/src/test/ui/dst/dst-bad-coerce1.stderr index a48f37b20be97..d4af035409e54 100644 --- a/src/test/ui/dst/dst-bad-coerce1.stderr +++ b/src/test/ui/dst/dst-bad-coerce1.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce1.rs:16:29 | LL | let f3: &Fat<[usize]> = f2; - | ^^ expected slice, found array of 3 elements + | ------------- ^^ expected slice, found array of 3 elements + | | + | expected due to this | = note: expected type `&Fat<[usize]>` found type `&Fat<[isize; 3]>` @@ -19,7 +21,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce1.rs:28:27 | LL | let f3: &([usize],) = f2; - | ^^ expected slice, found array of 3 elements + | ----------- ^^ expected slice, found array of 3 elements + | | + | expected due to this | = note: expected type `&([usize],)` found type `&([isize; 3],)` diff --git a/src/test/ui/dst/dst-bad-coerce2.stderr b/src/test/ui/dst/dst-bad-coerce2.stderr index d1da9b6ca0749..1c0bbdd08d74e 100644 --- a/src/test/ui/dst/dst-bad-coerce2.stderr +++ b/src/test/ui/dst/dst-bad-coerce2.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:15:33 | LL | let f3: &mut Fat<[isize]> = f2; - | ^^ types differ in mutability + | ----------------- ^^ types differ in mutability + | | + | expected due to this | = note: expected type `&mut Fat<[isize]>` found type `&Fat<[isize; 3]>` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:20:33 | LL | let f3: &mut Fat = f2; - | ^^ types differ in mutability + | ----------------- ^^ types differ in mutability + | | + | expected due to this | = note: expected type `&mut Fat` found type `&Fat` @@ -20,7 +24,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:25:31 | LL | let f3: &mut ([isize],) = f2; - | ^^ types differ in mutability + | --------------- ^^ types differ in mutability + | | + | expected due to this | = note: expected type `&mut ([isize],)` found type `&([isize; 3],)` @@ -29,7 +35,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:30:31 | LL | let f3: &mut (dyn Bar,) = f2; - | ^^ types differ in mutability + | --------------- ^^ types differ in mutability + | | + | expected due to this | = note: expected type `&mut (dyn Bar,)` found type `&(Foo,)` diff --git a/src/test/ui/dst/dst-bad-coerce4.stderr b/src/test/ui/dst/dst-bad-coerce4.stderr index fbf59ae5c6600..9c752176943ee 100644 --- a/src/test/ui/dst/dst-bad-coerce4.stderr +++ b/src/test/ui/dst/dst-bad-coerce4.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce4.rs:12:32 | LL | let f2: &Fat<[isize; 3]> = f1; - | ^^ expected array of 3 elements, found slice + | ---------------- ^^ expected array of 3 elements, found slice + | | + | expected due to this | = note: expected type `&Fat<[isize; 3]>` found type `&Fat<[isize]>` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce4.rs:20:30 | LL | let f2: &([isize; 3],) = f1; - | ^^ expected array of 3 elements, found slice + | -------------- ^^ expected array of 3 elements, found slice + | | + | expected due to this | = note: expected type `&([isize; 3],)` found type `&([isize],)` diff --git a/src/test/ui/dst/dst-bad-coercions.stderr b/src/test/ui/dst/dst-bad-coercions.stderr index e4bc6ee0010a2..b8a7d5fb3ec0b 100644 --- a/src/test/ui/dst/dst-bad-coercions.stderr +++ b/src/test/ui/dst/dst-bad-coercions.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:14:17 | LL | let y: &S = x; - | ^ expected &S, found *-ptr + | -- ^ expected &S, found *-ptr + | | + | expected due to this | = note: expected type `&S` found type `*const S` @@ -11,10 +13,11 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:15:21 | LL | let y: &dyn T = x; - | ^ - | | - | expected &dyn T, found *-ptr - | help: consider borrowing here: `&x` + | ------ ^ + | | | + | | expected &dyn T, found *-ptr + | | help: consider borrowing here: `&x` + | expected due to this | = note: expected type `&dyn T` found type `*const S` @@ -23,7 +26,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:19:17 | LL | let y: &S = x; - | ^ expected &S, found *-ptr + | -- ^ expected &S, found *-ptr + | | + | expected due to this | = note: expected type `&S` found type `*mut S` @@ -32,10 +37,11 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:20:21 | LL | let y: &dyn T = x; - | ^ - | | - | expected &dyn T, found *-ptr - | help: consider borrowing here: `&x` + | ------ ^ + | | | + | | expected &dyn T, found *-ptr + | | help: consider borrowing here: `&x` + | expected due to this | = note: expected type `&dyn T` found type `*mut S` @@ -44,7 +50,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:23:25 | LL | let x: &mut dyn T = &S; - | ^^ types differ in mutability + | ---------- ^^ types differ in mutability + | | + | expected due to this | = note: expected type `&mut dyn T` found type `&S` @@ -53,7 +61,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:24:25 | LL | let x: *mut dyn T = &S; - | ^^ types differ in mutability + | ---------- ^^ types differ in mutability + | | + | expected due to this | = note: expected type `*mut dyn T` found type `&S` @@ -62,7 +72,9 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:25:21 | LL | let x: *mut S = &S; - | ^^ types differ in mutability + | ------ ^^ types differ in mutability + | | + | expected due to this | = note: expected type `*mut S` found type `&S` diff --git a/src/test/ui/float-literal-inference-restrictions.stderr b/src/test/ui/float-literal-inference-restrictions.stderr index 08513507ecf96..80fe031dbd8fc 100644 --- a/src/test/ui/float-literal-inference-restrictions.stderr +++ b/src/test/ui/float-literal-inference-restrictions.stderr @@ -2,10 +2,11 @@ error[E0308]: mismatched types --> $DIR/float-literal-inference-restrictions.rs:2:18 | LL | let x: f32 = 1; - | ^ - | | - | expected f32, found integer - | help: use a float literal: `1.0` + | --- ^ + | | | + | | expected f32, found integer + | | help: use a float literal: `1.0` + | expected due to this | = note: expected type `f32` found type `{integer}` @@ -14,7 +15,9 @@ error[E0308]: mismatched types --> $DIR/float-literal-inference-restrictions.rs:3:18 | LL | let y: f32 = 1f64; - | ^^^^ expected f32, found f64 + | --- ^^^^ expected f32, found f64 + | | + | expected due to this | help: change the type of the numeric literal from `f64` to `f32` | diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr index f891b9c6439be..84cf8b02b8918 100644 --- a/src/test/ui/fn/fn-trait-formatting.stderr +++ b/src/test/ui/fn/fn-trait-formatting.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:6:17 | LL | let _: () = (box |_: isize| {}) as Box; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` + | | + | expected due to this | = note: expected type `()` found type `std::boxed::Box` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:10:17 | LL | let _: () = (box |_: isize, isize| {}) as Box; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` + | | + | expected due to this | = note: expected type `()` found type `std::boxed::Box` @@ -20,7 +24,9 @@ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:14:17 | LL | let _: () = (box || -> isize { unimplemented!() }) as Box isize>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` + | | + | expected due to this | = note: expected type `()` found type `std::boxed::Box isize>` diff --git a/src/test/ui/generic/generic-type-params-name-repr.stderr b/src/test/ui/generic/generic-type-params-name-repr.stderr index 2aa9cafb8bf0e..ab19743bcdb8c 100644 --- a/src/test/ui/generic/generic-type-params-name-repr.stderr +++ b/src/test/ui/generic/generic-type-params-name-repr.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:13:25 | LL | let _: Foo = (); - | ^^ expected struct `Foo`, found () + | ---------- ^^ expected struct `Foo`, found () + | | + | expected due to this | = note: expected type `Foo` found type `()` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:20:31 | LL | let _: Foo = (); - | ^^ expected struct `Foo`, found () + | ---------------- ^^ expected struct `Foo`, found () + | | + | expected due to this | = note: expected type `Foo` found type `()` @@ -20,7 +24,9 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:27:37 | LL | let _: HashMap = (); - | ^^ expected struct `HashMap`, found () + | ---------------------- ^^ expected struct `HashMap`, found () + | | + | expected due to this | = note: expected type `HashMap` found type `()` @@ -29,7 +35,9 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:32:51 | LL | let _: HashMap> = (); - | ^^ expected struct `HashMap`, found () + | ------------------------------------ ^^ expected struct `HashMap`, found () + | | + | expected due to this | = note: expected type `HashMap` found type `()` @@ -38,7 +46,9 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:39:31 | LL | let _: Foo = (); - | ^^ expected struct `Foo`, found () + | ---------------- ^^ expected struct `Foo`, found () + | | + | expected due to this | = note: expected type `Foo` found type `()` @@ -47,7 +57,9 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:46:27 | LL | let _: Foo = (); - | ^^ expected struct `Foo`, found () + | ------------ ^^ expected struct `Foo`, found () + | | + | expected due to this | = note: expected type `Foo` found type `()` diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr index d893cd606f1e4..be07694a4476c 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/hrtb-exists-forall-fn.rs:17:34 | LL | let _: for<'b> fn(&'b u32) = foo(); - | ^^^^^ expected concrete lifetime, found bound lifetime parameter 'b + | ------------------- ^^^^^ expected concrete lifetime, found bound lifetime parameter 'b + | | + | expected due to this | = note: expected type `for<'b> fn(&'b u32)` found type `fn(&u32)` diff --git a/src/test/ui/impl-trait/equality2.stderr b/src/test/ui/impl-trait/equality2.stderr index e30e2626e9f34..e05568c7b349a 100644 --- a/src/test/ui/impl-trait/equality2.stderr +++ b/src/test/ui/impl-trait/equality2.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/equality2.rs:25:18 | LL | let _: u32 = hide(0_u32); - | ^^^^^^^^^^^ expected u32, found opaque type + | --- ^^^^^^^^^^^ expected u32, found opaque type + | | + | expected due to this | = note: expected type `u32` found type `impl Foo` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/equality2.rs:31:18 | LL | let _: i32 = Leak::leak(hide(0_i32)); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found associated type + | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found associated type + | | + | expected due to this | = note: expected type `i32` found type `::T` diff --git a/src/test/ui/include-macros/mismatched-types.stderr b/src/test/ui/include-macros/mismatched-types.stderr index 33204f1cfce9b..3b4660a9348ae 100644 --- a/src/test/ui/include-macros/mismatched-types.stderr +++ b/src/test/ui/include-macros/mismatched-types.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/mismatched-types.rs:2:20 | LL | let b: &[u8] = include_str!("file.txt"); - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found str + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found str + | | + | expected due to this | = note: expected type `&[u8]` found type `&'static str` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/mismatched-types.rs:3:19 | LL | let s: &str = include_bytes!("file.txt"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found array of 0 elements + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found array of 0 elements + | | + | expected due to this | = note: expected type `&str` found type `&'static [u8; 0]` diff --git a/src/test/ui/issues/issue-1362.stderr b/src/test/ui/issues/issue-1362.stderr index 7ffbbbce7a83b..b4c6ccbbc6c19 100644 --- a/src/test/ui/issues/issue-1362.stderr +++ b/src/test/ui/issues/issue-1362.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/issue-1362.rs:4:16 | LL | let x: u32 = 20i32; - | ^^^^^ expected u32, found i32 + | --- ^^^^^ expected u32, found i32 + | | + | expected due to this | help: change the type of the numeric literal from `i32` to `u32` | diff --git a/src/test/ui/issues/issue-22684.stderr b/src/test/ui/issues/issue-22684.stderr index 738123ec4d41b..4179ddc4ae561 100644 --- a/src/test/ui/issues/issue-22684.stderr +++ b/src/test/ui/issues/issue-22684.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/issue-22684.rs:17:17 | LL | let _: () = foo::Foo.bar(); - | ^^^^^^^^^^^^^^ expected (), found bool + | -- ^^^^^^^^^^^^^^ expected (), found bool + | | + | expected due to this | = note: expected type `()` found type `bool` diff --git a/src/test/ui/issues/issue-24322.stderr b/src/test/ui/issues/issue-24322.stderr index def373cf2c0a8..490297b2e5454 100644 --- a/src/test/ui/issues/issue-24322.stderr +++ b/src/test/ui/issues/issue-24322.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/issue-24322.rs:8:29 | LL | let x: &fn(&B) -> u32 = &B::func; - | ^^^^^^^^ expected fn pointer, found fn item + | -------------- ^^^^^^^^ expected fn pointer, found fn item + | | + | expected due to this | = note: expected type `&for<'r> fn(&'r B) -> u32` found type `&for<'r> fn(&'r B) -> u32 {B::func}` diff --git a/src/test/ui/issues/issue-27042.stderr b/src/test/ui/issues/issue-27042.stderr index 7678984a518ba..0a506d6853345 100644 --- a/src/test/ui/issues/issue-27042.stderr +++ b/src/test/ui/issues/issue-27042.stderr @@ -23,6 +23,8 @@ LL | loop { break }; error[E0308]: mismatched types --> $DIR/issue-27042.rs:8:9 | +LL | let _: i32 = + | --- expected due to this LL | / 'b: LL | | LL | | while true { break }; // but here we cite the whole loop @@ -44,6 +46,8 @@ LL | | for _ in None { break }; // but here we cite the whole loop error[E0308]: mismatched types --> $DIR/issue-27042.rs:15:9 | +LL | let _: i32 = + | --- expected due to this LL | / 'd: LL | | while let Some(_) = None { break }; | |__________________________________________^ expected i32, found () diff --git a/src/test/ui/issues/issue-3477.stderr b/src/test/ui/issues/issue-3477.stderr index 1b7f597d50e2a..7ac1db4b822a3 100644 --- a/src/test/ui/issues/issue-3477.stderr +++ b/src/test/ui/issues/issue-3477.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/issue-3477.rs:2:20 | LL | let _p: char = 100; - | ^^^ expected char, found u8 + | ---- ^^^ expected char, found u8 + | | + | expected due to this error: aborting due to previous error diff --git a/src/test/ui/issues/issue-37665.stderr b/src/test/ui/issues/issue-37665.stderr index c27494699515b..73b2c8ec623ed 100644 --- a/src/test/ui/issues/issue-37665.stderr +++ b/src/test/ui/issues/issue-37665.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/issue-37665.rs:10:17 | LL | let x: () = 0; - | ^ expected (), found integer + | -- ^ expected (), found integer + | | + | expected due to this | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/issues/issue-38940.stderr b/src/test/ui/issues/issue-38940.stderr index 4851c01a347b6..19969043d15e1 100644 --- a/src/test/ui/issues/issue-38940.stderr +++ b/src/test/ui/issues/issue-38940.stderr @@ -10,7 +10,9 @@ error[E0308]: mismatched types --> $DIR/issue-38940.rs:43:22 | LL | let x: &Bottom = &t; - | ^^ expected struct `Bottom`, found struct `Top` + | ------- ^^ expected struct `Bottom`, found struct `Top` + | | + | expected due to this | = note: expected type `&Bottom` found type `&Top` diff --git a/src/test/ui/issues/issue-5100.stderr b/src/test/ui/issues/issue-5100.stderr index b50d24671a850..bc3954506fecd 100644 --- a/src/test/ui/issues/issue-5100.stderr +++ b/src/test/ui/issues/issue-5100.stderr @@ -57,7 +57,9 @@ error[E0308]: mismatched types --> $DIR/issue-5100.rs:55:19 | LL | let x: char = true; - | ^^^^ expected char, found bool + | ---- ^^^^ expected char, found bool + | | + | expected due to this error: aborting due to 7 previous errors diff --git a/src/test/ui/issues/issue-53692.stderr b/src/test/ui/issues/issue-53692.stderr index 2928d4461c5ec..d02ffdef7e329 100644 --- a/src/test/ui/issues/issue-53692.stderr +++ b/src/test/ui/issues/issue-53692.stderr @@ -2,10 +2,11 @@ error[E0308]: mismatched types --> $DIR/issue-53692.rs:4:37 | LL | let items_clone: Vec = ref_items.clone(); - | ^^^^^^^^^^^^^^^^^ - | | - | expected struct `std::vec::Vec`, found &[i32] - | help: try using a conversion method: `ref_items.to_vec()` + | -------- ^^^^^^^^^^^^^^^^^ + | | | + | | expected struct `std::vec::Vec`, found &[i32] + | | help: try using a conversion method: `ref_items.to_vec()` + | expected due to this | = note: expected type `std::vec::Vec` found type `&[i32]` @@ -14,10 +15,11 @@ error[E0308]: mismatched types --> $DIR/issue-53692.rs:11:30 | LL | let string: String = s.clone(); - | ^^^^^^^^^ - | | - | expected struct `std::string::String`, found &str - | help: try using a conversion method: `s.to_string()` + | ------ ^^^^^^^^^ + | | | + | | expected struct `std::string::String`, found &str + | | help: try using a conversion method: `s.to_string()` + | expected due to this | = note: expected type `std::string::String` found type `&str` diff --git a/src/test/ui/issues/issue-56943.stderr b/src/test/ui/issues/issue-56943.stderr index 27202051524c9..bb12f43dac188 100644 --- a/src/test/ui/issues/issue-56943.stderr +++ b/src/test/ui/issues/issue-56943.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/issue-56943.rs:6:29 | LL | let _: issue_56943::S = issue_56943::S2; - | ^^^^^^^^^^^^^^^ expected struct `issue_56943::S`, found struct `issue_56943::S2` + | -------------- ^^^^^^^^^^^^^^^ expected struct `issue_56943::S`, found struct `issue_56943::S2` + | | + | expected due to this | = note: expected type `issue_56943::S` found type `issue_56943::S2` diff --git a/src/test/ui/json-bom-plus-crlf-multifile.stderr b/src/test/ui/json-bom-plus-crlf-multifile.stderr index 39f6b69bbecaa..17c0bbc72ffde 100644 --- a/src/test/ui/json-bom-plus-crlf-multifile.stderr +++ b/src/test/ui/json-bom-plus-crlf-multifile.stderr @@ -15,7 +15,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":612,"byte_end":618,"line_start":17,"line_end":17,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:17:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a @@ -35,7 +35,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":672,"byte_end":678,"line_start":19,"line_end":19,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:19:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a @@ -55,7 +55,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":735,"byte_end":741,"line_start":22,"line_end":22,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:23:1: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a @@ -75,7 +75,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `std::string::String`, found ()","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `std::string::String`, found ()","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":792,"byte_end":798,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` found type `()`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:25:22: error[E0308]: mismatched types "} {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors diff --git a/src/test/ui/json-bom-plus-crlf.stderr b/src/test/ui/json-bom-plus-crlf.stderr index d62140e4de765..051bc87b2267a 100644 --- a/src/test/ui/json-bom-plus-crlf.stderr +++ b/src/test/ui/json-bom-plus-crlf.stderr @@ -15,7 +15,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":612,"byte_end":618,"line_start":17,"line_end":17,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:17:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a @@ -35,7 +35,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":672,"byte_end":678,"line_start":19,"line_end":19,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:19:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a @@ -55,7 +55,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":735,"byte_end":741,"line_start":22,"line_end":22,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:23:1: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a @@ -75,7 +75,7 @@ let x: i32 = \"I am not a number!\"; // | // type `i32` assigned to variable `x` ``` -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `std::string::String`, found ()","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `std::string::String`, found ()","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":792,"byte_end":798,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String` found type `()`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:25:22: error[E0308]: mismatched types "} {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors diff --git a/src/test/ui/meta-expected-error-correct-rev.a.stderr b/src/test/ui/meta-expected-error-correct-rev.a.stderr index 968b87288c015..e9b9a03394928 100644 --- a/src/test/ui/meta-expected-error-correct-rev.a.stderr +++ b/src/test/ui/meta-expected-error-correct-rev.a.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/meta-expected-error-correct-rev.rs:7:18 | LL | let x: u32 = 22_usize; - | ^^^^^^^^ expected u32, found usize + | --- ^^^^^^^^ expected u32, found usize + | | + | expected due to this | help: change the type of the numeric literal from `usize` to `u32` | diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr index 8dfbde92f646b..20b435548ec39 100644 --- a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr +++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr @@ -10,7 +10,9 @@ error[E0308]: mismatched types --> $DIR/method-ambig-one-trait-unknown-int-type.rs:33:20 | LL | let y: usize = x.foo(); - | ^^^^^^^ expected usize, found isize + | ----- ^^^^^^^ expected usize, found isize + | | + | expected due to this | help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit | diff --git a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr index 283ef8fcba7a4..c143c457fc2a4 100644 --- a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr +++ b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:85:24 | LL | let _seetype: () = z; - | ^ expected (), found u32 + | -- ^ expected (), found u32 + | | + | expected due to this | = note: expected type `()` found type `u32` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:102:24 | LL | let _seetype: () = z; - | ^ expected (), found u64 + | -- ^ expected (), found u64 + | | + | expected due to this | = note: expected type `()` found type `u64` @@ -45,7 +49,9 @@ error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:137:24 | LL | let _seetype: () = z; - | ^ expected (), found u8 + | -- ^ expected (), found u8 + | | + | expected due to this | = note: expected type `()` found type `u8` @@ -54,7 +60,9 @@ error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:155:24 | LL | let _seetype: () = z; - | ^ expected (), found u32 + | -- ^ expected (), found u32 + | | + | expected due to this | = note: expected type `()` found type `u32` @@ -63,7 +71,9 @@ error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:172:24 | LL | let _seetype: () = z; - | ^ expected (), found u32 + | -- ^ expected (), found u32 + | | + | expected due to this | = note: expected type `()` found type `u32` diff --git a/src/test/ui/mir-unpretty.stderr b/src/test/ui/mir-unpretty.stderr index 6e5dac226692a..e84cbcb553589 100644 --- a/src/test/ui/mir-unpretty.stderr +++ b/src/test/ui/mir-unpretty.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/mir-unpretty.rs:4:17 | LL | let x: () = 0; - | ^ expected (), found integer + | -- ^ expected (), found integer + | | + | expected due to this | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/mismatched_types/main.stderr b/src/test/ui/mismatched_types/main.stderr index 1d53cfdd2527c..0f4a273548da1 100644 --- a/src/test/ui/mismatched_types/main.stderr +++ b/src/test/ui/mismatched_types/main.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/main.rs:2:18 | LL | let x: u32 = ( - | __________________^ + | ____________---___^ + | | | + | | expected due to this LL | | ); | |_____^ expected u32, found () | diff --git a/src/test/ui/never_type/never-assign-wrong-type.stderr b/src/test/ui/never_type/never-assign-wrong-type.stderr index da2e77d023d19..e95670efed6d5 100644 --- a/src/test/ui/never_type/never-assign-wrong-type.stderr +++ b/src/test/ui/never_type/never-assign-wrong-type.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/never-assign-wrong-type.rs:7:16 | LL | let x: ! = "hello"; - | ^^^^^^^ expected !, found reference + | - ^^^^^^^ expected !, found reference + | | + | expected due to this | = note: expected type `!` found type `&'static str` diff --git a/src/test/ui/noexporttypeexe.stderr b/src/test/ui/noexporttypeexe.stderr index 329787fe74444..15a03c0e58255 100644 --- a/src/test/ui/noexporttypeexe.stderr +++ b/src/test/ui/noexporttypeexe.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/noexporttypeexe.rs:10:18 | LL | let x: isize = noexporttypelib::foo(); - | ^^^^^^^^^^^^^^^^^^^^^^ expected isize, found enum `std::option::Option` + | ----- ^^^^^^^^^^^^^^^^^^^^^^ expected isize, found enum `std::option::Option` + | | + | expected due to this | = note: expected type `isize` found type `std::option::Option` diff --git a/src/test/ui/numeric/const-scope.stderr b/src/test/ui/numeric/const-scope.stderr index c88495059224b..e4dde0b03b415 100644 --- a/src/test/ui/numeric/const-scope.stderr +++ b/src/test/ui/numeric/const-scope.stderr @@ -14,19 +14,25 @@ error[E0308]: mismatched types --> $DIR/const-scope.rs:5:18 | LL | let c: i32 = 1i8; - | ^^^ expected i32, found i8 + | --- ^^^ expected i32, found i8 + | | + | expected due to this error[E0308]: mismatched types --> $DIR/const-scope.rs:6:17 | LL | let d: i8 = c; - | ^ expected i8, found i32 + | -- ^ expected i8, found i32 + | | + | expected due to this error[E0308]: mismatched types --> $DIR/const-scope.rs:10:18 | LL | let c: i32 = 1i8; - | ^^^ expected i32, found i8 + | --- ^^^ expected i32, found i8 + | | + | expected due to this | help: change the type of the numeric literal from `i8` to `i32` | @@ -37,7 +43,9 @@ error[E0308]: mismatched types --> $DIR/const-scope.rs:11:17 | LL | let d: i8 = c; - | ^ expected i8, found i32 + | -- ^ expected i8, found i32 + | | + | expected due to this | help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit | diff --git a/src/test/ui/numeric/numeric-cast-2.stderr b/src/test/ui/numeric/numeric-cast-2.stderr index 9f08985bdb3c6..f1d5cb87b9556 100644 --- a/src/test/ui/numeric/numeric-cast-2.stderr +++ b/src/test/ui/numeric/numeric-cast-2.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-2.rs:5:18 | LL | let x: u16 = foo(); - | ^^^^^ expected u16, found i32 + | --- ^^^^^ expected u16, found i32 + | | + | expected due to this | help: you can convert an `i32` to `u16` and panic if the converted value wouldn't fit | @@ -13,7 +15,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-2.rs:7:18 | LL | let y: i64 = x + x; - | ^^^^^ expected i64, found u16 + | --- ^^^^^ expected i64, found u16 + | | + | expected due to this | help: you can convert an `u16` to `i64` and panic if the converted value wouldn't fit | @@ -24,7 +28,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-2.rs:9:18 | LL | let z: i32 = x + x; - | ^^^^^ expected i32, found u16 + | --- ^^^^^ expected i32, found u16 + | | + | expected due to this | help: you can convert an `u16` to `i32` and panic if the converted value wouldn't fit | diff --git a/src/test/ui/or-patterns/issue-64879-trailing-before-guard.stderr b/src/test/ui/or-patterns/issue-64879-trailing-before-guard.stderr index db6670fc5b1e0..5ddbd98a95f95 100644 --- a/src/test/ui/or-patterns/issue-64879-trailing-before-guard.stderr +++ b/src/test/ui/or-patterns/issue-64879-trailing-before-guard.stderr @@ -10,7 +10,9 @@ error[E0308]: mismatched types --> $DIR/issue-64879-trailing-before-guard.rs:12:42 | LL | let recovery_witness: bool = 0; - | ^ expected bool, found integer + | ---- ^ expected bool, found integer + | | + | expected due to this | = note: expected type `bool` found type `{integer}` diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr b/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr index 6d08b47c058ed..4bf6f8ecabbbf 100644 --- a/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr +++ b/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr @@ -118,10 +118,11 @@ error[E0308]: mismatched types --> $DIR/or-patterns-syntactic-fail.rs:52:36 | LL | let recovery_witness: String = 0; - | ^ - | | - | expected struct `std::string::String`, found integer - | help: try using a conversion method: `0.to_string()` + | ------ ^ + | | | + | | expected struct `std::string::String`, found integer + | | help: try using a conversion method: `0.to_string()` + | expected due to this | = note: expected type `std::string::String` found type `{integer}` diff --git a/src/test/ui/parser/lex-bad-char-literals-6.stderr b/src/test/ui/parser/lex-bad-char-literals-6.stderr index 662cf2657e7b5..a9899faf59a02 100644 --- a/src/test/ui/parser/lex-bad-char-literals-6.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-6.stderr @@ -43,7 +43,9 @@ error[E0308]: mismatched types --> $DIR/lex-bad-char-literals-6.rs:15:20 | LL | let a: usize = ""; - | ^^ expected usize, found reference + | ----- ^^ expected usize, found reference + | | + | expected due to this | = note: expected type `usize` found type `&'static str` diff --git a/src/test/ui/parser/numeric-lifetime.stderr b/src/test/ui/parser/numeric-lifetime.stderr index 4018b24aac175..a9e953b048832 100644 --- a/src/test/ui/parser/numeric-lifetime.stderr +++ b/src/test/ui/parser/numeric-lifetime.stderr @@ -14,7 +14,9 @@ error[E0308]: mismatched types --> $DIR/numeric-lifetime.rs:6:20 | LL | let x: usize = ""; - | ^^ expected usize, found reference + | ----- ^^ expected usize, found reference + | | + | expected due to this | = note: expected type `usize` found type `&'static str` diff --git a/src/test/ui/parser/recover-from-homoglyph.stderr b/src/test/ui/parser/recover-from-homoglyph.stderr index ec7d041647a9f..60ed71385f42b 100644 --- a/src/test/ui/parser/recover-from-homoglyph.stderr +++ b/src/test/ui/parser/recover-from-homoglyph.stderr @@ -13,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/recover-from-homoglyph.rs:3:20 | LL | let x: usize = (); - | ^^ expected usize, found () + | ----- ^^ expected usize, found () + | | + | expected due to this | = note: expected type `usize` found type `()` diff --git a/src/test/ui/parser/recover-missing-semi.stderr b/src/test/ui/parser/recover-missing-semi.stderr index c40918ee2bd5f..6fc11eab5bcdb 100644 --- a/src/test/ui/parser/recover-missing-semi.stderr +++ b/src/test/ui/parser/recover-missing-semi.stderr @@ -20,7 +20,9 @@ error[E0308]: mismatched types --> $DIR/recover-missing-semi.rs:2:20 | LL | let _: usize = () - | ^^ expected usize, found () + | ----- ^^ expected usize, found () + | | + | expected due to this | = note: expected type `usize` found type `()` @@ -29,7 +31,9 @@ error[E0308]: mismatched types --> $DIR/recover-missing-semi.rs:9:20 | LL | let _: usize = () - | ^^ expected usize, found () + | ----- ^^ expected usize, found () + | | + | expected due to this | = note: expected type `usize` found type `()` diff --git a/src/test/ui/parser/recover-tuple.stderr b/src/test/ui/parser/recover-tuple.stderr index 4252fc1fd1e1b..0c93ab55373a8 100644 --- a/src/test/ui/parser/recover-tuple.stderr +++ b/src/test/ui/parser/recover-tuple.stderr @@ -8,7 +8,9 @@ error[E0308]: mismatched types --> $DIR/recover-tuple.rs:6:20 | LL | let y: usize = ""; - | ^^ expected usize, found reference + | ----- ^^ expected usize, found reference + | | + | expected due to this | = note: expected type `usize` found type `&'static str` diff --git a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr index 818f61b4d2229..986f30575dc66 100644 --- a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr +++ b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr @@ -13,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/unclosed-delimiter-in-dep.rs:4:20 | LL | let _: usize = unclosed_delim_mod::new(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected usize, found enum `std::result::Result` + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected usize, found enum `std::result::Result` + | | + | expected due to this | = note: expected type `usize` found type `std::result::Result` diff --git a/src/test/ui/proc-macro/attribute-spans-preserved.stderr b/src/test/ui/proc-macro/attribute-spans-preserved.stderr index 6c571dbdb4769..94ede4c60d335 100644 --- a/src/test/ui/proc-macro/attribute-spans-preserved.stderr +++ b/src/test/ui/proc-macro/attribute-spans-preserved.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/attribute-spans-preserved.rs:7:23 | LL | #[ foo ( let y: u32 = "z"; ) ] - | ^^^ expected u32, found reference + | --- ^^^ expected u32, found reference + | | + | expected due to this | = note: expected type `u32` found type `&'static str` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/attribute-spans-preserved.rs:8:23 | LL | #[ bar { let x: u32 = "y"; } ] - | ^^^ expected u32, found reference + | --- ^^^ expected u32, found reference + | | + | expected due to this | = note: expected type `u32` found type `&'static str` diff --git a/src/test/ui/proc-macro/attribute-with-error.stderr b/src/test/ui/proc-macro/attribute-with-error.stderr index 937d47ff08979..5dbf708000afa 100644 --- a/src/test/ui/proc-macro/attribute-with-error.stderr +++ b/src/test/ui/proc-macro/attribute-with-error.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:10:18 | LL | let a: i32 = "foo"; - | ^^^^^ expected i32, found reference + | --- ^^^^^ expected i32, found reference + | | + | expected due to this | = note: expected type `i32` found type `&'static str` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:12:18 | LL | let b: i32 = "f'oo"; - | ^^^^^^ expected i32, found reference + | --- ^^^^^^ expected i32, found reference + | | + | expected due to this | = note: expected type `i32` found type `&'static str` @@ -20,7 +24,9 @@ error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:25:22 | LL | let a: i32 = "foo"; - | ^^^^^ expected i32, found reference + | --- ^^^^^ expected i32, found reference + | | + | expected due to this | = note: expected type `i32` found type `&'static str` @@ -29,7 +35,9 @@ error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:35:22 | LL | let a: i32 = "foo"; - | ^^^^^ expected i32, found reference + | --- ^^^^^ expected i32, found reference + | | + | expected due to this | = note: expected type `i32` found type `&'static str` diff --git a/src/test/ui/proc-macro/nested-item-spans.stderr b/src/test/ui/proc-macro/nested-item-spans.stderr index bef80311f38e5..f1a062fc06447 100644 --- a/src/test/ui/proc-macro/nested-item-spans.stderr +++ b/src/test/ui/proc-macro/nested-item-spans.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/nested-item-spans.rs:9:22 | LL | let x: u32 = "x"; - | ^^^ expected u32, found reference + | --- ^^^ expected u32, found reference + | | + | expected due to this | = note: expected type `u32` found type `&'static str` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/nested-item-spans.rs:18:22 | LL | let x: u32 = "x"; - | ^^^ expected u32, found reference + | --- ^^^ expected u32, found reference + | | + | expected due to this | = note: expected type `u32` found type `&'static str` diff --git a/src/test/ui/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr index 545c2fa5f40e4..e4751573916d6 100644 --- a/src/test/ui/proc-macro/span-preservation.stderr +++ b/src/test/ui/proc-macro/span-preservation.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/span-preservation.rs:11:20 | LL | let x: usize = "hello"; - | ^^^^^^^ expected usize, found reference + | ----- ^^^^^^^ expected usize, found reference + | | + | expected due to this | = note: expected type `usize` found type `&'static str` diff --git a/src/test/ui/ptr-coercion.stderr b/src/test/ui/ptr-coercion.stderr index 019241d6874aa..ea812f5c4b626 100644 --- a/src/test/ui/ptr-coercion.stderr +++ b/src/test/ui/ptr-coercion.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/ptr-coercion.rs:7:25 | LL | let x: *mut isize = x; - | ^ types differ in mutability + | ---------- ^ types differ in mutability + | | + | expected due to this | = note: expected type `*mut isize` found type `*const isize` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/ptr-coercion.rs:13:25 | LL | let x: *mut isize = &42; - | ^^^ types differ in mutability + | ---------- ^^^ types differ in mutability + | | + | expected due to this | = note: expected type `*mut isize` found type `&isize` @@ -20,7 +24,9 @@ error[E0308]: mismatched types --> $DIR/ptr-coercion.rs:19:25 | LL | let x: *mut isize = x; - | ^ types differ in mutability + | ---------- ^ types differ in mutability + | | + | expected due to this | = note: expected type `*mut isize` found type `*const isize` diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr index 36c66451cfaf6..272c2dceb642f 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr @@ -20,7 +20,9 @@ error[E0308]: mismatched types --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43 | LL | let _: fn(&mut &isize, &mut &isize) = a; - | ^ expected concrete lifetime, found bound lifetime parameter + | ---------------------------- ^ expected concrete lifetime, found bound lifetime parameter + | | + | expected due to this | = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}` diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr index a366bd2e5c2d7..d1cfcab73f3ed 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr @@ -31,7 +31,9 @@ error[E0308]: mismatched types --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^ expected concrete lifetime, found bound lifetime parameter + | ----------------------------------------- ^ expected concrete lifetime, found bound lifetime parameter + | | + | expected due to this | = note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` found type `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}` diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr index e260fccf8488c..cf980de99290b 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr @@ -20,7 +20,9 @@ error[E0308]: mismatched types --> $DIR/regions-lifetime-bounds-on-fns.rs:20:43 | LL | let _: fn(&mut &isize, &mut &isize) = a; - | ^ expected concrete lifetime, found bound lifetime parameter + | ---------------------------- ^ expected concrete lifetime, found bound lifetime parameter + | | + | expected due to this | = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}` diff --git a/src/test/ui/reify-intrinsic.stderr b/src/test/ui/reify-intrinsic.stderr index 4a1bd77cf7ee9..b629a27f7a48a 100644 --- a/src/test/ui/reify-intrinsic.stderr +++ b/src/test/ui/reify-intrinsic.stderr @@ -2,10 +2,11 @@ error[E0308]: cannot coerce intrinsics to function pointers --> $DIR/reify-intrinsic.rs:6:64 | LL | let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::transmute; - | ^^^^^^^^^^^^^^^^^^^ - | | - | cannot coerce intrinsics to function pointers - | help: use parentheses to call this function: `std::mem::transmute(...)` + | ------------------------------------------------- ^^^^^^^^^^^^^^^^^^^ + | | | + | | cannot coerce intrinsics to function pointers + | | help: use parentheses to call this function: `std::mem::transmute(...)` + | expected due to this | = note: expected type `unsafe extern "rust-intrinsic" fn(isize) -> usize` found type `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index 8a450ab85e926..b243e09d93594 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -280,10 +280,11 @@ LL | Fn(u8), | ------ fn(u8) -> m::n::Z {m::n::Z::Fn} defined here ... LL | let _: Z = Z::Fn; - | ^^^^^ - | | - | expected enum `m::n::Z`, found fn item - | help: use parentheses to instantiate this tuple variant: `Z::Fn(_)` + | - ^^^^^ + | | | + | | expected enum `m::n::Z`, found fn item + | | help: use parentheses to instantiate this tuple variant: `Z::Fn(_)` + | expected due to this | = note: expected type `m::n::Z` found type `fn(u8) -> m::n::Z {m::n::Z::Fn}` @@ -311,10 +312,11 @@ LL | Fn(u8), | ------ fn(u8) -> m::E {m::E::Fn} defined here ... LL | let _: E = m::E::Fn; - | ^^^^^^^^ - | | - | expected enum `m::E`, found fn item - | help: use parentheses to instantiate this tuple variant: `m::E::Fn(_)` + | - ^^^^^^^^ + | | | + | | expected enum `m::E`, found fn item + | | help: use parentheses to instantiate this tuple variant: `m::E::Fn(_)` + | expected due to this | = note: expected type `m::E` found type `fn(u8) -> m::E {m::E::Fn}` @@ -342,10 +344,11 @@ LL | Fn(u8), | ------ fn(u8) -> m::E {m::E::Fn} defined here ... LL | let _: E = E::Fn; - | ^^^^^ - | | - | expected enum `m::E`, found fn item - | help: use parentheses to instantiate this tuple variant: `E::Fn(_)` + | - ^^^^^ + | | | + | | expected enum `m::E`, found fn item + | | help: use parentheses to instantiate this tuple variant: `E::Fn(_)` + | expected due to this | = note: expected type `m::E` found type `fn(u8) -> m::E {m::E::Fn}` diff --git a/src/test/ui/shift-various-bad-types.stderr b/src/test/ui/shift-various-bad-types.stderr index c7a9588322651..170229bdd8c2e 100644 --- a/src/test/ui/shift-various-bad-types.stderr +++ b/src/test/ui/shift-various-bad-types.stderr @@ -26,7 +26,9 @@ error[E0308]: mismatched types --> $DIR/shift-various-bad-types.rs:25:18 | LL | let _: i32 = 22_i64 >> 1_i32; - | ^^^^^^^^^^^^^^^ expected i32, found i64 + | --- ^^^^^^^^^^^^^^^ expected i32, found i64 + | | + | expected due to this | help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit | diff --git a/src/test/ui/slice-mut.stderr b/src/test/ui/slice-mut.stderr index e99d83d0fed38..072f0178c14f1 100644 --- a/src/test/ui/slice-mut.stderr +++ b/src/test/ui/slice-mut.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/slice-mut.rs:7:22 | LL | let y: &mut[_] = &x[2..4]; - | ^^^^^^^^ types differ in mutability + | ------- ^^^^^^^^ types differ in mutability + | | + | expected due to this | = note: expected type `&mut [_]` found type `&[isize]` diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index 0d15a2a753ed0..2b19787b2c50c 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:7:20 | LL | let x: usize = String::new(); - | ^^^^^^^^^^^^^ expected usize, found struct `std::string::String` + | ----- ^^^^^^^^^^^^^ expected usize, found struct `std::string::String` + | | + | expected due to this | = note: expected type `usize` found type `std::string::String` @@ -11,10 +13,11 @@ error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:9:19 | LL | let x: &str = String::new(); - | ^^^^^^^^^^^^^ - | | - | expected &str, found struct `std::string::String` - | help: consider borrowing here: `&String::new()` + | ---- ^^^^^^^^^^^^^ + | | | + | | expected &str, found struct `std::string::String` + | | help: consider borrowing here: `&String::new()` + | expected due to this | = note: expected type `&str` found type `std::string::String` diff --git a/src/test/ui/span/move-closure.stderr b/src/test/ui/span/move-closure.stderr index e2226b197aeb8..e86469a99c4ac 100644 --- a/src/test/ui/span/move-closure.stderr +++ b/src/test/ui/span/move-closure.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/move-closure.rs:5:17 | LL | let x: () = move || (); - | ^^^^^^^^^^ expected (), found closure + | -- ^^^^^^^^^^ expected (), found closure + | | + | expected due to this | = note: expected type `()` found type `[closure@$DIR/move-closure.rs:5:17: 5:27]` diff --git a/src/test/ui/str/str-array-assignment.stderr b/src/test/ui/str/str-array-assignment.stderr index ecd5fb4412967..16390c56d4e36 100644 --- a/src/test/ui/str/str-array-assignment.stderr +++ b/src/test/ui/str/str-array-assignment.stderr @@ -38,10 +38,11 @@ error[E0308]: mismatched types --> $DIR/str-array-assignment.rs:9:17 | LL | let w: &str = s[..2]; - | ^^^^^^ - | | - | expected &str, found str - | help: consider borrowing here: `&s[..2]` + | ---- ^^^^^^ + | | | + | | expected &str, found str + | | help: consider borrowing here: `&s[..2]` + | expected due to this | = note: expected type `&str` found type `str` diff --git a/src/test/ui/str/str-lit-type-mismatch.stderr b/src/test/ui/str/str-lit-type-mismatch.stderr index ef40faa8e26eb..e502dc12a3822 100644 --- a/src/test/ui/str/str-lit-type-mismatch.stderr +++ b/src/test/ui/str/str-lit-type-mismatch.stderr @@ -2,10 +2,11 @@ error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:2:20 | LL | let x: &[u8] = "foo"; - | ^^^^^ - | | - | expected slice, found str - | help: consider adding a leading `b`: `b"foo"` + | ----- ^^^^^ + | | | + | | expected slice, found str + | | help: consider adding a leading `b`: `b"foo"` + | expected due to this | = note: expected type `&[u8]` found type `&'static str` @@ -14,10 +15,11 @@ error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:3:23 | LL | let y: &[u8; 4] = "baaa"; - | ^^^^^^ - | | - | expected array of 4 elements, found str - | help: consider adding a leading `b`: `b"baaa"` + | -------- ^^^^^^ + | | | + | | expected array of 4 elements, found str + | | help: consider adding a leading `b`: `b"baaa"` + | expected due to this | = note: expected type `&[u8; 4]` found type `&'static str` @@ -26,10 +28,11 @@ error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:4:19 | LL | let z: &str = b"foo"; - | ^^^^^^ - | | - | expected str, found array of 3 elements - | help: consider removing the leading `b`: `"foo"` + | ---- ^^^^^^ + | | | + | | expected str, found array of 3 elements + | | help: consider removing the leading `b`: `"foo"` + | expected due to this | = note: expected type `&str` found type `&'static [u8; 3]` diff --git a/src/test/ui/struct-literal-variant-in-if.stderr b/src/test/ui/struct-literal-variant-in-if.stderr index bfc8b24e8ac49..cc2bf7d558143 100644 --- a/src/test/ui/struct-literal-variant-in-if.stderr +++ b/src/test/ui/struct-literal-variant-in-if.stderr @@ -66,7 +66,9 @@ error[E0308]: mismatched types --> $DIR/struct-literal-variant-in-if.rs:21:20 | LL | let y: usize = (); - | ^^ expected usize, found () + | ----- ^^ expected usize, found () + | | + | expected due to this | = note: expected type `usize` found type `()` diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/substs-ppaux.normal.stderr index cb55203c88e31..33d56a3a09dfe 100644 --- a/src/test/ui/substs-ppaux.normal.stderr +++ b/src/test/ui/substs-ppaux.normal.stderr @@ -5,10 +5,11 @@ LL | fn bar<'a, T>() where T: 'a {} | --------------------------- fn() {>::bar::<'static, char>} defined here ... LL | let x: () = >::bar::<'static, char>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | expected (), found fn item - | help: use parentheses to call this function: `>::bar::<'static, char>()` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected (), found fn item + | | help: use parentheses to call this function: `>::bar::<'static, char>()` + | expected due to this | = note: expected type `()` found type `fn() {>::bar::<'static, char>}` @@ -20,10 +21,11 @@ LL | fn bar<'a, T>() where T: 'a {} | --------------------------- fn() {>::bar::<'static, char>} defined here ... LL | let x: () = >::bar::<'static, char>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | expected (), found fn item - | help: use parentheses to call this function: `>::bar::<'static, char>()` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected (), found fn item + | | help: use parentheses to call this function: `>::bar::<'static, char>()` + | expected due to this | = note: expected type `()` found type `fn() {>::bar::<'static, char>}` @@ -35,10 +37,11 @@ LL | fn baz() {} | -------- fn() {>::baz} defined here ... LL | let x: () = >::baz; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | expected (), found fn item - | help: use parentheses to call this function: `>::baz()` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected (), found fn item + | | help: use parentheses to call this function: `>::baz()` + | expected due to this | = note: expected type `()` found type `fn() {>::baz}` @@ -50,10 +53,11 @@ LL | fn foo<'z>() where &'z (): Sized { | -------------------------------- fn() {foo::<'static>} defined here ... LL | let x: () = foo::<'static>; - | ^^^^^^^^^^^^^^ - | | - | expected (), found fn item - | help: use parentheses to call this function: `foo::<'static>()` + | -- ^^^^^^^^^^^^^^ + | | | + | | expected (), found fn item + | | help: use parentheses to call this function: `foo::<'static>()` + | expected due to this | = note: expected type `()` found type `fn() {foo::<'static>}` diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/substs-ppaux.verbose.stderr index cafcba97b92c8..8c958406d8e43 100644 --- a/src/test/ui/substs-ppaux.verbose.stderr +++ b/src/test/ui/substs-ppaux.verbose.stderr @@ -5,10 +5,11 @@ LL | fn bar<'a, T>() where T: 'a {} | --------------------------- fn() {>::bar::} defined here ... LL | let x: () = >::bar::<'static, char>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | expected (), found fn item - | help: use parentheses to call this function: `>::bar::<'static, char>()` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected (), found fn item + | | help: use parentheses to call this function: `>::bar::<'static, char>()` + | expected due to this | = note: expected type `()` found type `fn() {>::bar::}` @@ -20,10 +21,11 @@ LL | fn bar<'a, T>() where T: 'a {} | --------------------------- fn() {>::bar::} defined here ... LL | let x: () = >::bar::<'static, char>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | expected (), found fn item - | help: use parentheses to call this function: `>::bar::<'static, char>()` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected (), found fn item + | | help: use parentheses to call this function: `>::bar::<'static, char>()` + | expected due to this | = note: expected type `()` found type `fn() {>::bar::}` @@ -35,10 +37,11 @@ LL | fn baz() {} | -------- fn() {>::baz} defined here ... LL | let x: () = >::baz; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | expected (), found fn item - | help: use parentheses to call this function: `>::baz()` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected (), found fn item + | | help: use parentheses to call this function: `>::baz()` + | expected due to this | = note: expected type `()` found type `fn() {>::baz}` @@ -50,10 +53,11 @@ LL | fn foo<'z>() where &'z (): Sized { | -------------------------------- fn() {foo::} defined here ... LL | let x: () = foo::<'static>; - | ^^^^^^^^^^^^^^ - | | - | expected (), found fn item - | help: use parentheses to call this function: `foo::<'static>()` + | -- ^^^^^^^^^^^^^^ + | | | + | | expected (), found fn item + | | help: use parentheses to call this function: `foo::<'static>()` + | expected due to this | = note: expected type `()` found type `fn() {foo::}` diff --git a/src/test/ui/suggestions/as-ref.stderr b/src/test/ui/suggestions/as-ref.stderr index 8143acc957b4c..3ea21af3f9f57 100644 --- a/src/test/ui/suggestions/as-ref.stderr +++ b/src/test/ui/suggestions/as-ref.stderr @@ -46,10 +46,11 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:16:27 | LL | let y: Option<&usize> = x; - | ^ - | | - | expected enum `std::option::Option`, found reference - | help: you can convert from `&Option` to `Option<&T>` using `.as_ref()`: `x.as_ref()` + | -------------- ^ + | | | + | | expected enum `std::option::Option`, found reference + | | help: you can convert from `&Option` to `Option<&T>` using `.as_ref()`: `x.as_ref()` + | expected due to this | = note: expected type `std::option::Option<&usize>` found type `&std::option::Option` @@ -58,7 +59,9 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:19:35 | LL | let y: Result<&usize, &usize> = x; - | ^ expected enum `std::result::Result`, found reference + | ---------------------- ^ expected enum `std::result::Result`, found reference + | | + | expected due to this | = note: expected type `std::result::Result<&usize, &usize>` found type `&std::result::Result` @@ -71,7 +74,9 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:23:34 | LL | let y: Result<&usize, usize> = x; - | ^ expected enum `std::result::Result`, found reference + | --------------------- ^ expected enum `std::result::Result`, found reference + | | + | expected due to this | = note: expected type `std::result::Result<&usize, usize>` found type `&std::result::Result` diff --git a/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr b/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr index 56810a4915869..1343a018165ac 100644 --- a/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr +++ b/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr @@ -19,10 +19,11 @@ LL | fn foo(a: usize, b: usize) -> usize { a } | ----------------------------------- fn(usize, usize) -> usize {foo} defined here ... LL | let _: usize = foo; - | ^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `foo(a, b)` + | ----- ^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `foo(a, b)` + | expected due to this | = note: expected type `usize` found type `fn(usize, usize) -> usize {foo}` @@ -34,10 +35,11 @@ LL | struct S(usize, usize); | ----------------------- fn(usize, usize) -> S {S} defined here ... LL | let _: S = S; - | ^ - | | - | expected struct `S`, found fn item - | help: use parentheses to instantiate this tuple struct: `S(_, _)` + | - ^ + | | | + | | expected struct `S`, found fn item + | | help: use parentheses to instantiate this tuple struct: `S(_, _)` + | expected due to this | = note: expected type `S` found type `fn(usize, usize) -> S {S}` @@ -49,10 +51,11 @@ LL | fn bar() -> usize { 42 } | ----------------- fn() -> usize {bar} defined here ... LL | let _: usize = bar; - | ^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `bar()` + | ----- ^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `bar()` + | expected due to this | = note: expected type `usize` found type `fn() -> usize {bar}` @@ -64,10 +67,11 @@ LL | struct V(); | ----------- fn() -> V {V} defined here ... LL | let _: V = V; - | ^ - | | - | expected struct `V`, found fn item - | help: use parentheses to instantiate this tuple struct: `V()` + | - ^ + | | | + | | expected struct `V`, found fn item + | | help: use parentheses to instantiate this tuple struct: `V()` + | expected due to this | = note: expected type `V` found type `fn() -> V {V}` @@ -79,10 +83,11 @@ LL | fn baz(x: usize, y: usize) -> usize { x } | ----------------------------------- fn(usize, usize) -> usize {<_ as T>::baz} defined here ... LL | let _: usize = T::baz; - | ^^^^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `T::baz(x, y)` + | ----- ^^^^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `T::baz(x, y)` + | expected due to this | = note: expected type `usize` found type `fn(usize, usize) -> usize {<_ as T>::baz}` @@ -94,10 +99,11 @@ LL | fn bat(x: usize) -> usize { 42 } | ------------------------- fn(usize) -> usize {<_ as T>::bat} defined here ... LL | let _: usize = T::bat; - | ^^^^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `T::bat(x)` + | ----- ^^^^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `T::bat(x)` + | expected due to this | = note: expected type `usize` found type `fn(usize) -> usize {<_ as T>::bat}` @@ -109,10 +115,11 @@ LL | A(usize), | -------- fn(usize) -> E {E::A} defined here ... LL | let _: E = E::A; - | ^^^^ - | | - | expected enum `E`, found fn item - | help: use parentheses to instantiate this tuple variant: `E::A(_)` + | - ^^^^ + | | | + | | expected enum `E`, found fn item + | | help: use parentheses to instantiate this tuple variant: `E::A(_)` + | expected due to this | = note: expected type `E` found type `fn(usize) -> E {E::A}` @@ -124,10 +131,11 @@ LL | fn baz(x: usize, y: usize) -> usize { x } | ----------------------------------- fn(usize, usize) -> usize {::baz} defined here ... LL | let _: usize = X::baz; - | ^^^^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `X::baz(x, y)` + | ----- ^^^^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `X::baz(x, y)` + | expected due to this | = note: expected type `usize` found type `fn(usize, usize) -> usize {::baz}` @@ -139,10 +147,11 @@ LL | fn bat(x: usize) -> usize { 42 } | ------------------------- fn(usize) -> usize {::bat} defined here ... LL | let _: usize = X::bat; - | ^^^^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `X::bat(x)` + | ----- ^^^^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `X::bat(x)` + | expected due to this | = note: expected type `usize` found type `fn(usize) -> usize {::bat}` @@ -154,10 +163,11 @@ LL | fn bax(x: usize) -> usize { 42 } | ------------------------- fn(usize) -> usize {::bax} defined here ... LL | let _: usize = X::bax; - | ^^^^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `X::bax(x)` + | ----- ^^^^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `X::bax(x)` + | expected due to this | = note: expected type `usize` found type `fn(usize) -> usize {::bax}` @@ -169,10 +179,11 @@ LL | fn bach(x: usize) -> usize; | --------------------------- fn(usize) -> usize {::bach} defined here ... LL | let _: usize = X::bach; - | ^^^^^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `X::bach(x)` + | ----- ^^^^^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `X::bach(x)` + | expected due to this | = note: expected type `usize` found type `fn(usize) -> usize {::bach}` @@ -184,10 +195,11 @@ LL | fn ban(&self) -> usize { 42 } | ---------------------- for<'r> fn(&'r X) -> usize {::ban} defined here ... LL | let _: usize = X::ban; - | ^^^^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `X::ban(_)` + | ----- ^^^^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `X::ban(_)` + | expected due to this | = note: expected type `usize` found type `for<'r> fn(&'r X) -> usize {::ban}` @@ -199,10 +211,11 @@ LL | fn bal(&self) -> usize; | ----------------------- for<'r> fn(&'r X) -> usize {::bal} defined here ... LL | let _: usize = X::bal; - | ^^^^^^ - | | - | expected usize, found fn item - | help: use parentheses to call this function: `X::bal(_)` + | ----- ^^^^^^ + | | | + | | expected usize, found fn item + | | help: use parentheses to call this function: `X::bal(_)` + | expected due to this | = note: expected type `usize` found type `for<'r> fn(&'r X) -> usize {::bal}` @@ -225,10 +238,11 @@ error[E0308]: mismatched types LL | let closure = || 42; | -- closure defined here LL | let _: usize = closure; - | ^^^^^^^ - | | - | expected usize, found closure - | help: use parentheses to call this closure: `closure()` + | ----- ^^^^^^^ + | | | + | | expected usize, found closure + | | help: use parentheses to call this closure: `closure()` + | expected due to this | = note: expected type `usize` found type `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:24]` diff --git a/src/test/ui/suggestions/format-borrow.stderr b/src/test/ui/suggestions/format-borrow.stderr index 44bb11faa7f38..7ed6abb3c5c15 100644 --- a/src/test/ui/suggestions/format-borrow.stderr +++ b/src/test/ui/suggestions/format-borrow.stderr @@ -2,10 +2,11 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:2:21 | LL | let a: String = &String::from("a"); - | ^^^^^^^^^^^^^^^^^^ - | | - | expected struct `std::string::String`, found reference - | help: consider removing the borrow: `String::from("a")` + | ------ ^^^^^^^^^^^^^^^^^^ + | | | + | | expected struct `std::string::String`, found reference + | | help: consider removing the borrow: `String::from("a")` + | expected due to this | = note: expected type `std::string::String` found type `&std::string::String` @@ -14,10 +15,11 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:4:21 | LL | let b: String = &format!("b"); - | ^^^^^^^^^^^^^ - | | - | expected struct `std::string::String`, found reference - | help: consider removing the borrow: `format!("b")` + | ------ ^^^^^^^^^^^^^ + | | | + | | expected struct `std::string::String`, found reference + | | help: consider removing the borrow: `format!("b")` + | expected due to this | = note: expected type `std::string::String` found type `&std::string::String` diff --git a/src/test/ui/suggestions/issue-59819.stderr b/src/test/ui/suggestions/issue-59819.stderr index 66898115cbd6d..c19e8273b02c4 100644 --- a/src/test/ui/suggestions/issue-59819.stderr +++ b/src/test/ui/suggestions/issue-59819.stderr @@ -2,10 +2,11 @@ error[E0308]: mismatched types --> $DIR/issue-59819.rs:28:18 | LL | let y: i32 = x; - | ^ - | | - | expected i32, found struct `Foo` - | help: consider dereferencing the type: `*x` + | --- ^ + | | | + | | expected i32, found struct `Foo` + | | help: consider dereferencing the type: `*x` + | expected due to this | = note: expected type `i32` found type `Foo` @@ -14,10 +15,11 @@ error[E0308]: mismatched types --> $DIR/issue-59819.rs:30:18 | LL | let b: i32 = a; - | ^ - | | - | expected i32, found &{integer} - | help: consider dereferencing the borrow: `*a` + | --- ^ + | | | + | | expected i32, found &{integer} + | | help: consider dereferencing the borrow: `*a` + | expected due to this | = note: expected type `i32` found type `&{integer}` @@ -26,10 +28,11 @@ error[E0308]: mismatched types --> $DIR/issue-59819.rs:34:21 | LL | let g: String = f; - | ^ - | | - | expected struct `std::string::String`, found struct `Bar` - | help: try using a conversion method: `f.to_string()` + | ------ ^ + | | | + | | expected struct `std::string::String`, found struct `Bar` + | | help: try using a conversion method: `f.to_string()` + | expected due to this | = note: expected type `std::string::String` found type `Bar` diff --git a/src/test/ui/suggestions/mismatched-types-numeric-from.stderr b/src/test/ui/suggestions/mismatched-types-numeric-from.stderr index 223b6747322c1..788e460028dc5 100644 --- a/src/test/ui/suggestions/mismatched-types-numeric-from.stderr +++ b/src/test/ui/suggestions/mismatched-types-numeric-from.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/mismatched-types-numeric-from.rs:2:18 | LL | let _: u32 = i32::from(0_u8); - | ^^^^^^^^^^^^^^^ expected u32, found i32 + | --- ^^^^^^^^^^^^^^^ expected u32, found i32 + | | + | expected due to this error: aborting due to previous error diff --git a/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr index 9a47a1efb752a..42ddac65d2975 100644 --- a/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr +++ b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr @@ -22,7 +22,9 @@ error[E0308]: mismatched types --> $DIR/recover-from-semicolon-trailing-item.rs:10:20 | LL | let _: usize = S {}; - | ^^^^ expected usize, found struct `S` + | ----- ^^^^ expected usize, found struct `S` + | | + | expected due to this | = note: expected type `usize` found type `S` @@ -31,7 +33,9 @@ error[E0308]: mismatched types --> $DIR/recover-from-semicolon-trailing-item.rs:12:20 | LL | let _: usize = X {}; - | ^^^^ expected usize, found struct `main::X` + | ----- ^^^^ expected usize, found struct `main::X` + | | + | expected due to this | = note: expected type `usize` found type `main::X` diff --git a/src/test/ui/suggestions/suggest-box.stderr b/src/test/ui/suggestions/suggest-box.stderr index 50c106d63a02b..8d87375618dba 100644 --- a/src/test/ui/suggestions/suggest-box.stderr +++ b/src/test/ui/suggestions/suggest-box.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/suggest-box.rs:4:47 | LL | let _x: Box Result<(), ()>> = || { - | _______________________________________________^ + | _____________-------------------------------___^ + | | | + | | expected due to this LL | | Err(())?; LL | | Ok(()) LL | | }; diff --git a/src/test/ui/tag-that-dare-not-speak-its-name.stderr b/src/test/ui/tag-that-dare-not-speak-its-name.stderr index 23e3d66526215..eeecced36b57d 100644 --- a/src/test/ui/tag-that-dare-not-speak-its-name.stderr +++ b/src/test/ui/tag-that-dare-not-speak-its-name.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/tag-that-dare-not-speak-its-name.rs:11:20 | LL | let x : char = last(y); - | ^^^^^^^ expected char, found enum `std::option::Option` + | ---- ^^^^^^^ expected char, found enum `std::option::Option` + | | + | expected due to this | = note: expected type `char` found type `std::option::Option<_>` diff --git a/src/test/ui/terminal-width/non-whitespace-trimming-2.stderr b/src/test/ui/terminal-width/non-whitespace-trimming-2.stderr index bf1699f5cabbb..59c3dc1698634 100644 --- a/src/test/ui/terminal-width/non-whitespace-trimming-2.stderr +++ b/src/test/ui/terminal-width/non-whitespace-trimming-2.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types --> $DIR/non-whitespace-trimming-2.rs:4:311 | -LL | ...; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let _:... - | ^^ expected (), found integer +LL | ... 13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let... + | -- ^^ expected (), found integer + | | + | expected due to this | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/terminal-width/non-whitespace-trimming-unicode.stderr b/src/test/ui/terminal-width/non-whitespace-trimming-unicode.stderr index b56b1948d9e07..9530ffde41ed3 100644 --- a/src/test/ui/terminal-width/non-whitespace-trimming-unicode.stderr +++ b/src/test/ui/terminal-width/non-whitespace-trimming-unicode.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types --> $DIR/non-whitespace-trimming-unicode.rs:4:415 | -LL | ...♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆... - | ^^ expected (), found integer +LL | ...♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃... + | -- ^^ expected (), found integer + | | + | expected due to this | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/terminal-width/non-whitespace-trimming.stderr b/src/test/ui/terminal-width/non-whitespace-trimming.stderr index 622713eb5f6fc..fb2d92c7b3c03 100644 --- a/src/test/ui/terminal-width/non-whitespace-trimming.stderr +++ b/src/test/ui/terminal-width/non-whitespace-trimming.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types --> $DIR/non-whitespace-trimming.rs:4:241 | -LL | ...) = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = ()... - | ^^ expected (), found integer +LL | ...: () = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () =... + | -- ^^ expected (), found integer + | | + | expected due to this | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/terminal-width/whitespace-trimming.stderr b/src/test/ui/terminal-width/whitespace-trimming.stderr index 45a804b9f6a46..2e73f93150925 100644 --- a/src/test/ui/terminal-width/whitespace-trimming.stderr +++ b/src/test/ui/terminal-width/whitespace-trimming.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/whitespace-trimming.rs:4:193 | LL | ... let _: () = 42; - | ^^ expected (), found integer + | -- ^^ expected (), found integer + | | + | expected due to this | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr index 0394ddab46cda..eb34ed8c2a5c5 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr @@ -11,7 +11,9 @@ error[E0308]: mismatched types --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:22:17 | LL | let _: u8 = ::V; - | ^^^^^^^ expected u8, found enum `E2` + | -- ^^^^^^^ expected u8, found enum `E2` + | | + | expected due to this | = note: expected type `u8` found type `E2` diff --git a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr index d9600f1d1d6bc..ab74a32efe3aa 100644 --- a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr @@ -8,7 +8,9 @@ error[E0308]: mismatched types --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 | LL | let z: i32 = x; - | ^ expected i32, found opaque type + | --- ^ expected i32, found opaque type + | | + | expected due to this | = note: expected type `i32` found type `WrongGeneric::<&{integer}>` diff --git a/src/test/ui/type-alias-impl-trait/never_reveal_concrete_type.stderr b/src/test/ui/type-alias-impl-trait/never_reveal_concrete_type.stderr index 7c195f1fad006..0ab3dd079036e 100644 --- a/src/test/ui/type-alias-impl-trait/never_reveal_concrete_type.stderr +++ b/src/test/ui/type-alias-impl-trait/never_reveal_concrete_type.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/never_reveal_concrete_type.rs:13:27 | LL | let _: &'static str = x; - | ^ expected reference, found opaque type + | ------------ ^ expected reference, found opaque type + | | + | expected due to this | = note: expected type `&'static str` found type `NoReveal` diff --git a/src/test/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr b/src/test/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr index 5e5826978fc7e..0112d953aa206 100644 --- a/src/test/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr +++ b/src/test/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/no_revealing_outside_defining_module.rs:15:19 | LL | let _: &str = bomp(); - | ^^^^^^ expected &str, found opaque type + | ---- ^^^^^^ expected &str, found opaque type + | | + | expected due to this | = note: expected type `&str` found type `Boo` diff --git a/src/test/ui/type/type-check/assignment-expected-bool.stderr b/src/test/ui/type/type-check/assignment-expected-bool.stderr index b636a71f3afe2..a2e03dac813ce 100644 --- a/src/test/ui/type/type-check/assignment-expected-bool.stderr +++ b/src/test/ui/type/type-check/assignment-expected-bool.stderr @@ -140,7 +140,9 @@ error[E0308]: mismatched types --> $DIR/assignment-expected-bool.rs:31:20 | LL | let _: usize = 0 = 0; - | ^^^^^ expected usize, found () + | ----- ^^^^^ expected usize, found () + | | + | expected due to this | = note: expected type `usize` found type `()` diff --git a/src/test/ui/type/type-mismatch-multiple.stderr b/src/test/ui/type/type-mismatch-multiple.stderr index 8f6b23ea091a2..469a3449aa53f 100644 --- a/src/test/ui/type/type-mismatch-multiple.stderr +++ b/src/test/ui/type/type-mismatch-multiple.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/type-mismatch-multiple.rs:3:27 | LL | fn main() { let a: bool = 1; let b: i32 = true; } - | ^ expected bool, found integer + | ---- ^ expected bool, found integer + | | + | expected due to this | = note: expected type `bool` found type `{integer}` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/type-mismatch-multiple.rs:3:43 | LL | fn main() { let a: bool = 1; let b: i32 = true; } - | ^^^^ expected i32, found bool + | --- ^^^^ expected i32, found bool + | | + | expected due to this error: aborting due to 2 previous errors diff --git a/src/test/ui/type/type-shadow.stderr b/src/test/ui/type/type-shadow.stderr index f15bdc16d5144..88498bb9f6322 100644 --- a/src/test/ui/type/type-shadow.stderr +++ b/src/test/ui/type/type-shadow.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/type-shadow.rs:6:20 | LL | let y: Y = "hello"; - | ^^^^^^^ expected isize, found reference + | - ^^^^^^^ expected isize, found reference + | | + | expected due to this | = note: expected type `isize` found type `&'static str` diff --git a/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr b/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr index 89114874824d6..5b78a594acfa9 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/typeck_type_placeholder_mismatch.rs:13:21 | LL | let x: Foo<_> = Bar::(PhantomData); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar` + | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar` + | | + | expected due to this | = note: expected type `Foo<_>` found type `Bar` @@ -11,7 +13,9 @@ error[E0308]: mismatched types --> $DIR/typeck_type_placeholder_mismatch.rs:22:21 | LL | let x: Foo<_> = Bar::(PhantomData); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar` + | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar` + | | + | expected due to this | = note: expected type `Foo<_>` found type `Bar` diff --git a/src/test/ui/wrong-mul-method-signature.stderr b/src/test/ui/wrong-mul-method-signature.stderr index 2317bf8e8293c..f50f8ea7d1276 100644 --- a/src/test/ui/wrong-mul-method-signature.stderr +++ b/src/test/ui/wrong-mul-method-signature.stderr @@ -38,7 +38,9 @@ error[E0308]: mismatched types --> $DIR/wrong-mul-method-signature.rs:63:19 | LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found f64 + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found f64 + | | + | expected due to this | = note: expected type `Vec2` found type `f64`