From 086c8d3db71c7d448b55536d6862f177ad7f60dd Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 6 Sep 2019 10:51:52 +0200 Subject: [PATCH 1/7] Stabilize cfg rustdoc --- src/doc/rustdoc/src/the-doc-attribute.md | 31 +++++++++++++++++++ src/libsyntax/feature_gate/builtin_attrs.rs | 1 - src/test/ui/cfg-rustdoc.rs | 6 ++++ src/test/ui/cfg-rustdoc.stderr | 9 ++++++ .../feature-gate-doc_cfg-cfg-rustdoc.rs | 4 --- .../feature-gate-doc_cfg-cfg-rustdoc.stderr | 12 ------- 6 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 src/test/ui/cfg-rustdoc.rs create mode 100644 src/test/ui/cfg-rustdoc.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr diff --git a/src/doc/rustdoc/src/the-doc-attribute.md b/src/doc/rustdoc/src/the-doc-attribute.md index 80ac405eb2f2a..3aaac9268ffcf 100644 --- a/src/doc/rustdoc/src/the-doc-attribute.md +++ b/src/doc/rustdoc/src/the-doc-attribute.md @@ -214,3 +214,34 @@ the `strip-hidden` pass is removed. Since primitive types are defined in the compiler, there's no place to attach documentation attributes. This attribute is used by the standard library to provide a way to generate documentation for primitive types. + +## `#[cfg(rustdoc)]`: Documenting platform-/feature-specific information + +For conditional compilation, Rustdoc treats your crate the same way the compiler does: Only things +from the host target are available (or from the given `--target` if present), and everything else is +"filtered out" from the crate. This can cause problems if your crate is providing different things +on different targets and you want your documentation to reflect all the available items you +provide. + +If you want to make sure an item is seen by Rustdoc regardless of what platform it's targeting, +you can apply `#[cfg(rustdoc)]` to it. Rustdoc sets this whenever it's building documentation, so +anything that uses that flag will make it into documentation it generates. To apply this to an item +with other `#[cfg]` filters on it, you can write something like `#[cfg(any(windows, rustdoc))]`. +This will preserve the item either when built normally on Windows, or when being documented +anywhere. + +Please note that this feature won't be passed when building doctests. + +Example: + +```rust +/// Token struct that can only be used on Windows. +#[cfg(any(windows, rustdoc))] +pub struct WindowsToken; +/// Token struct that can only be used on Unix. +#[cfg(any(unix, rustdoc))] +pub struct UnixToken; +``` + +Here, the respective tokens can only be used by dependent crates on their respective platforms, but +they will both appear in documentation. diff --git a/src/libsyntax/feature_gate/builtin_attrs.rs b/src/libsyntax/feature_gate/builtin_attrs.rs index a13a4475ef01c..a9f41633f30fd 100644 --- a/src/libsyntax/feature_gate/builtin_attrs.rs +++ b/src/libsyntax/feature_gate/builtin_attrs.rs @@ -30,7 +30,6 @@ const GATED_CFGS: &[(Symbol, Symbol, GateFn)] = &[ (sym::target_thread_local, sym::cfg_target_thread_local, cfg_fn!(cfg_target_thread_local)), (sym::target_has_atomic, sym::cfg_target_has_atomic, cfg_fn!(cfg_target_has_atomic)), (sym::target_has_atomic_load_store, sym::cfg_target_has_atomic, cfg_fn!(cfg_target_has_atomic)), - (sym::doc, sym::doc_cfg, cfg_fn!(doc_cfg)), ]; #[derive(Debug)] diff --git a/src/test/ui/cfg-rustdoc.rs b/src/test/ui/cfg-rustdoc.rs new file mode 100644 index 0000000000000..a8e0c87eff851 --- /dev/null +++ b/src/test/ui/cfg-rustdoc.rs @@ -0,0 +1,6 @@ +#[cfg(rustdoc)] +pub struct Foo; + +fn main() { + let f = Foo; //~ ERROR +} diff --git a/src/test/ui/cfg-rustdoc.stderr b/src/test/ui/cfg-rustdoc.stderr new file mode 100644 index 0000000000000..c687d186989c0 --- /dev/null +++ b/src/test/ui/cfg-rustdoc.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `Foo` in this scope + --> $DIR/cfg-rustdoc.rs:5:13 + | +LL | let f = Foo; + | ^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.rs b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.rs deleted file mode 100644 index 9830503a8cac6..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[cfg(doc)] //~ ERROR: `cfg(doc)` is experimental and subject to change -pub struct SomeStruct; - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr deleted file mode 100644 index 26a1f4decf4cf..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: `cfg(doc)` is experimental and subject to change - --> $DIR/feature-gate-doc_cfg-cfg-rustdoc.rs:1:7 - | -LL | #[cfg(doc)] - | ^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/43781 - = help: add `#![feature(doc_cfg)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. From a056bf9714fca847494ee6aa6025acb1a7fdd852 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 6 Nov 2019 14:48:10 +0100 Subject: [PATCH 2/7] Rename the cfg attribute from rustdoc to doc --- src/doc/rustdoc/src/the-doc-attribute.md | 10 +++++----- src/librustdoc/core.rs | 2 +- src/libsyntax_pos/symbol.rs | 1 - src/test/ui/cfg-rustdoc.rs | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/doc/rustdoc/src/the-doc-attribute.md b/src/doc/rustdoc/src/the-doc-attribute.md index 3aaac9268ffcf..5fac0bddc3bfb 100644 --- a/src/doc/rustdoc/src/the-doc-attribute.md +++ b/src/doc/rustdoc/src/the-doc-attribute.md @@ -215,7 +215,7 @@ Since primitive types are defined in the compiler, there's no place to attach do attributes. This attribute is used by the standard library to provide a way to generate documentation for primitive types. -## `#[cfg(rustdoc)]`: Documenting platform-/feature-specific information +## `#[cfg(doc)]`: Documenting platform-/feature-specific information For conditional compilation, Rustdoc treats your crate the same way the compiler does: Only things from the host target are available (or from the given `--target` if present), and everything else is @@ -224,9 +224,9 @@ on different targets and you want your documentation to reflect all the availabl provide. If you want to make sure an item is seen by Rustdoc regardless of what platform it's targeting, -you can apply `#[cfg(rustdoc)]` to it. Rustdoc sets this whenever it's building documentation, so +you can apply `#[cfg(doc)]` to it. Rustdoc sets this whenever it's building documentation, so anything that uses that flag will make it into documentation it generates. To apply this to an item -with other `#[cfg]` filters on it, you can write something like `#[cfg(any(windows, rustdoc))]`. +with other `#[cfg]` filters on it, you can write something like `#[cfg(any(windows, doc))]`. This will preserve the item either when built normally on Windows, or when being documented anywhere. @@ -236,10 +236,10 @@ Example: ```rust /// Token struct that can only be used on Windows. -#[cfg(any(windows, rustdoc))] +#[cfg(any(windows, doc))] pub struct WindowsToken; /// Token struct that can only be used on Unix. -#[cfg(any(unix, rustdoc))] +#[cfg(any(unix, doc))] pub struct UnixToken; ``` diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 2b4ac7676fade..612f3c69871d7 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -250,7 +250,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt let extern_names: Vec = externs.iter().map(|(s,_)| s).cloned().collect(); - // Add the rustdoc cfg into the doc build. + // Add the doc cfg into the doc build. cfgs.push("doc".to_string()); let cpath = Some(input.clone()); diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 1139bf67a36d0..cab82f8c61b11 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -624,7 +624,6 @@ symbols! { rustc_test_marker, rustc_then_this_would_need, rustc_variance, - rustdoc, rustfmt, rust_eh_personality, rust_eh_unwind_resume, diff --git a/src/test/ui/cfg-rustdoc.rs b/src/test/ui/cfg-rustdoc.rs index a8e0c87eff851..dd8e1ed97c4d2 100644 --- a/src/test/ui/cfg-rustdoc.rs +++ b/src/test/ui/cfg-rustdoc.rs @@ -1,4 +1,4 @@ -#[cfg(rustdoc)] +#[cfg(doc)] pub struct Foo; fn main() { From 0d7a7b554771daee7b08caa8c49544910948c915 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Wed, 6 Nov 2019 11:10:21 -0600 Subject: [PATCH 3/7] move cfg(doc) docs into a separate page --- src/doc/rustdoc/src/SUMMARY.md | 1 + src/doc/rustdoc/src/advanced-features.md | 34 ++++++++++++++++++++++++ src/doc/rustdoc/src/the-doc-attribute.md | 31 --------------------- 3 files changed, 35 insertions(+), 31 deletions(-) create mode 100644 src/doc/rustdoc/src/advanced-features.md diff --git a/src/doc/rustdoc/src/SUMMARY.md b/src/doc/rustdoc/src/SUMMARY.md index d4202f5b367ab..f982863e67b94 100644 --- a/src/doc/rustdoc/src/SUMMARY.md +++ b/src/doc/rustdoc/src/SUMMARY.md @@ -7,4 +7,5 @@ - [Documentation tests](documentation-tests.md) - [Lints](lints.md) - [Passes](passes.md) +- [Advanced Features](advanced-features.md) - [Unstable features](unstable-features.md) diff --git a/src/doc/rustdoc/src/advanced-features.md b/src/doc/rustdoc/src/advanced-features.md new file mode 100644 index 0000000000000..47bef3cdde187 --- /dev/null +++ b/src/doc/rustdoc/src/advanced-features.md @@ -0,0 +1,34 @@ +# Advanced Features + +The features listed on this page fall outside the rest of the main categories. + +## `#[cfg(doc)]`: Documenting platform-/feature-specific information + +For conditional compilation, Rustdoc treats your crate the same way the compiler does: Only things +from the host target are available (or from the given `--target` if present), and everything else is +"filtered out" from the crate. This can cause problems if your crate is providing different things +on different targets and you want your documentation to reflect all the available items you +provide. + +If you want to make sure an item is seen by Rustdoc regardless of what platform it's targeting, +you can apply `#[cfg(doc)]` to it. Rustdoc sets this whenever it's building documentation, so +anything that uses that flag will make it into documentation it generates. To apply this to an item +with other `#[cfg]` filters on it, you can write something like `#[cfg(any(windows, doc))]`. +This will preserve the item either when built normally on Windows, or when being documented +anywhere. + +Please note that this feature is not passed to doctests. + +Example: + +```rust +/// Token struct that can only be used on Windows. +#[cfg(any(windows, doc))] +pub struct WindowsToken; +/// Token struct that can only be used on Unix. +#[cfg(any(unix, doc))] +pub struct UnixToken; +``` + +Here, the respective tokens can only be used by dependent crates on their respective platforms, but +they will both appear in documentation. diff --git a/src/doc/rustdoc/src/the-doc-attribute.md b/src/doc/rustdoc/src/the-doc-attribute.md index 5fac0bddc3bfb..80ac405eb2f2a 100644 --- a/src/doc/rustdoc/src/the-doc-attribute.md +++ b/src/doc/rustdoc/src/the-doc-attribute.md @@ -214,34 +214,3 @@ the `strip-hidden` pass is removed. Since primitive types are defined in the compiler, there's no place to attach documentation attributes. This attribute is used by the standard library to provide a way to generate documentation for primitive types. - -## `#[cfg(doc)]`: Documenting platform-/feature-specific information - -For conditional compilation, Rustdoc treats your crate the same way the compiler does: Only things -from the host target are available (or from the given `--target` if present), and everything else is -"filtered out" from the crate. This can cause problems if your crate is providing different things -on different targets and you want your documentation to reflect all the available items you -provide. - -If you want to make sure an item is seen by Rustdoc regardless of what platform it's targeting, -you can apply `#[cfg(doc)]` to it. Rustdoc sets this whenever it's building documentation, so -anything that uses that flag will make it into documentation it generates. To apply this to an item -with other `#[cfg]` filters on it, you can write something like `#[cfg(any(windows, doc))]`. -This will preserve the item either when built normally on Windows, or when being documented -anywhere. - -Please note that this feature won't be passed when building doctests. - -Example: - -```rust -/// Token struct that can only be used on Windows. -#[cfg(any(windows, doc))] -pub struct WindowsToken; -/// Token struct that can only be used on Unix. -#[cfg(any(unix, doc))] -pub struct UnixToken; -``` - -Here, the respective tokens can only be used by dependent crates on their respective platforms, but -they will both appear in documentation. From 34f03c01f688c0653b080914d4ab83461e1cfae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 18 Nov 2019 21:00:24 -0800 Subject: [PATCH 4/7] Point at type in `let` assignment on type errors --- src/librustc_typeck/check/demand.rs | 28 +++- .../failed-doctest-missing-codes.stdout | 4 +- src/test/ui/array-not-vector.stderr | 8 +- .../associated-types-eq-3.stderr | 4 +- .../associated-types-path-2.stderr | 4 +- src/test/ui/c-variadic/variadic-ffi-1.stderr | 8 +- src/test/ui/closures/closure-no-fn-1.stderr | 4 +- src/test/ui/closures/closure-no-fn-2.stderr | 4 +- src/test/ui/coercion/coerce-to-bang.stderr | 4 +- src/test/ui/coercion/coercion-slice.stderr | 9 +- .../fn-const-param-infer.stderr | 8 +- .../const-generics/raw-ptr-const-param.stderr | 4 +- .../slice-const-param-mismatch.stderr | 12 +- .../types-mismatch-const-args.stderr | 8 +- src/test/ui/conversion-methods.stderr | 36 ++--- src/test/ui/cross/cross-borrow-trait.stderr | 9 +- ...xpected-float-found-integer-literal.stderr | 35 +++-- .../did_you_mean/recursion_limit_deref.stderr | 4 +- src/test/ui/dst/dst-bad-coerce1.stderr | 8 +- src/test/ui/dst/dst-bad-coerce2.stderr | 16 ++- src/test/ui/dst/dst-bad-coerce4.stderr | 8 +- src/test/ui/dst/dst-bad-coercions.stderr | 38 ++++-- ...loat-literal-inference-restrictions.stderr | 13 +- src/test/ui/fn/fn-trait-formatting.stderr | 12 +- .../generic-type-params-name-repr.stderr | 24 +++- src/test/ui/hrtb/hrtb-exists-forall-fn.stderr | 4 +- src/test/ui/impl-trait/equality2.stderr | 8 +- .../ui/include-macros/mismatched-types.stderr | 8 +- src/test/ui/issues/issue-1362.stderr | 4 +- src/test/ui/issues/issue-22684.stderr | 4 +- src/test/ui/issues/issue-24322.stderr | 4 +- src/test/ui/issues/issue-27042.stderr | 4 + src/test/ui/issues/issue-3477.stderr | 4 +- src/test/ui/issues/issue-37665.stderr | 4 +- src/test/ui/issues/issue-38940.stderr | 4 +- src/test/ui/issues/issue-5100.stderr | 4 +- src/test/ui/issues/issue-53692.stderr | 18 +-- src/test/ui/issues/issue-56943.stderr | 4 +- .../ui/json-bom-plus-crlf-multifile.stderr | 8 +- src/test/ui/json-bom-plus-crlf.stderr | 8 +- .../meta-expected-error-correct-rev.a.stderr | 4 +- ...od-ambig-one-trait-unknown-int-type.stderr | 4 +- ...e-trait-object-with-separate-params.stderr | 20 ++- src/test/ui/mir-unpretty.stderr | 4 +- src/test/ui/mismatched_types/main.stderr | 4 +- .../never_type/never-assign-wrong-type.stderr | 4 +- src/test/ui/noexporttypeexe.stderr | 4 +- src/test/ui/numeric/const-scope.stderr | 16 ++- src/test/ui/numeric/numeric-cast-2.stderr | 12 +- .../issue-64879-trailing-before-guard.stderr | 4 +- .../or-patterns-syntactic-fail.stderr | 9 +- .../ui/parser/lex-bad-char-literals-6.stderr | 4 +- src/test/ui/parser/numeric-lifetime.stderr | 4 +- .../ui/parser/recover-from-homoglyph.stderr | 4 +- .../ui/parser/recover-missing-semi.stderr | 8 +- src/test/ui/parser/recover-tuple.stderr | 4 +- .../parser/unclosed-delimiter-in-dep.stderr | 4 +- .../attribute-spans-preserved.stderr | 8 +- .../ui/proc-macro/attribute-with-error.stderr | 16 ++- .../ui/proc-macro/nested-item-spans.stderr | 8 +- .../ui/proc-macro/span-preservation.stderr | 4 +- src/test/ui/ptr-coercion.stderr | 12 +- ...time-bounds-on-fns-where-clause.nll.stderr | 4 +- ...lifetime-bounds-on-fns-where-clause.stderr | 4 +- ...time-bounds-on-fns-where-clause.nll.stderr | 4 +- ...lifetime-bounds-on-fns-where-clause.stderr | 4 +- .../regions-lifetime-bounds-on-fns.nll.stderr | 4 +- .../regions-lifetime-bounds-on-fns.stderr | 4 +- src/test/ui/reify-intrinsic.stderr | 9 +- src/test/ui/resolve/privacy-enum-ctor.stderr | 27 ++-- src/test/ui/shift-various-bad-types.stderr | 4 +- src/test/ui/slice-mut.stderr | 4 +- src/test/ui/span/coerce-suggestions.stderr | 13 +- src/test/ui/span/move-closure.stderr | 4 +- src/test/ui/str/str-array-assignment.stderr | 9 +- src/test/ui/str/str-lit-type-mismatch.stderr | 27 ++-- .../ui/struct-literal-variant-in-if.stderr | 4 +- src/test/ui/substs-ppaux.normal.stderr | 36 ++--- src/test/ui/substs-ppaux.verbose.stderr | 36 ++--- src/test/ui/suggestions/as-ref.stderr | 17 ++- .../fn-or-tuple-struct-without-args.stderr | 126 ++++++++++-------- src/test/ui/suggestions/format-borrow.stderr | 18 +-- src/test/ui/suggestions/issue-59819.stderr | 27 ++-- .../mismatched-types-numeric-from.stderr | 4 +- ...ecover-from-semicolon-trailing-item.stderr | 8 +- src/test/ui/suggestions/suggest-box.stderr | 4 +- .../tag-that-dare-not-speak-its-name.stderr | 4 +- .../non-whitespace-trimming-2.stderr | 6 +- .../non-whitespace-trimming-unicode.stderr | 6 +- .../non-whitespace-trimming.stderr | 6 +- .../terminal-width/whitespace-trimming.stderr | 4 +- ...priority-higher-than-other-inherent.stderr | 4 +- ..._type_does_not_live_long_enough.nll.stderr | 4 +- ...eric_type_does_not_live_long_enough.stderr | 4 +- .../never_reveal_concrete_type.stderr | 4 +- ...o_revealing_outside_defining_module.stderr | 4 +- .../assignment-expected-bool.stderr | 4 +- .../ui/type/type-mismatch-multiple.stderr | 8 +- src/test/ui/type/type-shadow.stderr | 4 +- .../typeck_type_placeholder_mismatch.stderr | 8 +- src/test/ui/wrong-mul-method-signature.stderr | 4 +- 101 files changed, 684 insertions(+), 354 deletions(-) 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 9d486d0a661e9..e4ed462232232 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 error: aborting due to previous error diff --git a/src/test/ui/array-not-vector.stderr b/src/test/ui/array-not-vector.stderr index 412a8ae846124..0e187d9072a8a 100644 --- a/src/test/ui/array-not-vector.stderr +++ b/src/test/ui/array-not-vector.stderr @@ -2,13 +2,17 @@ error[E0308]: mismatched types --> $DIR/array-not-vector.rs:2:19 | LL | let _x: i32 = [1, 2, 3]; - | ^^^^^^^^^ expected `i32`, found array `[{integer}; 3]` + | --- ^^^^^^^^^ expected `i32`, found array `[{integer}; 3]` + | | + | expected due to this error[E0308]: mismatched types --> $DIR/array-not-vector.rs:7:20 | LL | let _y: &i32 = x; - | ^ expected `i32`, found slice `[i32]` + | ---- ^ expected `i32`, found slice `[i32]` + | | + | expected due to this | = note: expected reference `&i32` found reference `&[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 24c830d8b5bbb..d4e6bed82321b 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 struct `Bar` found associated 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 f1b7798262403..ec24260ec7548 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 3d1710648daa2..39217cc89c81a 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 fn pointer `unsafe extern "C" fn(isize, u8)` found fn item `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 fn pointer `extern "C" fn(isize, u8, ...)` found fn item `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 9945530a5a7fe..5e76ee5a9a56d 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 fn pointer `fn(u8) -> u8` found closure `[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 f3b0d155dd9fe..07ffd6e5c9931 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 fn pointer `fn() -> u8` found closure `[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 9629a247e016d..ca42705973750 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:48:21 | LL | let x: [!; 2] = [return, 22]; - | ^^^^^^^^^^^^ expected `!`, found integer + | ------ ^^^^^^^^^^^^ expected `!`, found integer + | | + | expected due to this | = note: expected array `[!; 2]` found array `[{integer}; 2]` diff --git a/src/test/ui/coercion/coercion-slice.stderr b/src/test/ui/coercion/coercion-slice.stderr index 0e7fc06a9b720..42dc954ffd5e7 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 `[{integer}; 1]` - | help: consider borrowing here: `&[0]` + | ------ ^^^ + | | | + | | expected `&[i32]`, found array `[{integer}; 1]` + | | help: consider borrowing here: `&[0]` + | expected due to this error: aborting due to previous error 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 8f61e35e492cf..3f53b91541cb1 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 struct `Checked` found struct `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 struct `Checked>` found struct `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 ff5c59fa375ff..9cd39b61dc936 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 struct `Const<{pointer}>` found struct `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 9d11da1331585..a588d82318b94 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 struct `ConstString<"Hello">` found struct `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 struct `ConstString<"ℇ㇈↦">` found struct `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 struct `ConstBytes` found struct `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 0ce98f1455c99..4266fd250b057 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 struct `A<'_, _, 2u32, _>` found struct `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 struct `A<'a, u16, _, _>` found struct `A<'b, u32, _, _>` diff --git a/src/test/ui/conversion-methods.stderr b/src/test/ui/conversion-methods.stderr index 1aca37a6fb82e..b3621a27acb71 100644 --- a/src/test/ui/conversion-methods.stderr +++ b/src/test/ui/conversion-methods.stderr @@ -2,37 +2,41 @@ 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 `&str` - | help: try using a conversion method: `"'Tis a fond Ambush—".to_string()` + | ------ ^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected struct `std::string::String`, found `&str` + | | help: try using a conversion method: `"'Tis a fond Ambush—".to_string()` + | expected due to this 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 `&std::path::Path` - | help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()` + | ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | expected struct `std::path::PathBuf`, found `&std::path::Path` + | | help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()` + | expected due to this 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 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 `&[{integer}; 3]` - | help: try using a conversion method: `(&[1, 2, 3]).to_vec()` + | ---------- ^^^^^^^^^^ + | | | + | | expected struct `std::vec::Vec`, found `&[{integer}; 3]` + | | help: try using a conversion method: `(&[1, 2, 3]).to_vec()` + | expected due to this | = note: expected struct `std::vec::Vec` found reference `&[{integer}; 3]` diff --git a/src/test/ui/cross/cross-borrow-trait.stderr b/src/test/ui/cross/cross-borrow-trait.stderr index 9bffa6bd111a6..618f6595d41d0 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 reference `&dyn Trait` found struct `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 e2c3c08a8d914..6f853ccab378a 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,40 +2,47 @@ 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 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 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 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 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 error: aborting due to 5 previous errors 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 233474e5fe689..fdbb5af9b3243 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 reference `&Bottom` found reference `&Top` diff --git a/src/test/ui/dst/dst-bad-coerce1.stderr b/src/test/ui/dst/dst-bad-coerce1.stderr index 3eb16663e13e1..121c76a01a5de 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 `[usize]`, found array `[isize; 3]` + | ------------- ^^ expected slice `[usize]`, found array `[isize; 3]` + | | + | expected due to this | = note: expected reference `&Fat<[usize]>` found reference `&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 `[usize]`, found array `[isize; 3]` + | ----------- ^^ expected slice `[usize]`, found array `[isize; 3]` + | | + | expected due to this | = note: expected reference `&([usize],)` found reference `&([isize; 3],)` diff --git a/src/test/ui/dst/dst-bad-coerce2.stderr b/src/test/ui/dst/dst-bad-coerce2.stderr index e76fcb5f72d59..3ded96cfb6148 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 mutable reference `&mut Fat<[isize]>` found reference `&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 mutable reference `&mut Fat` found reference `&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 mutable reference `&mut ([isize],)` found reference `&([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 mutable reference `&mut (dyn Bar,)` found reference `&(Foo,)` diff --git a/src/test/ui/dst/dst-bad-coerce4.stderr b/src/test/ui/dst/dst-bad-coerce4.stderr index e85d354e4680d..4c9954f35208b 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 `[isize; 3]`, found slice `[isize]` + | ---------------- ^^ expected array `[isize; 3]`, found slice `[isize]` + | | + | expected due to this | = note: expected reference `&Fat<[isize; 3]>` found reference `&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 `[isize; 3]`, found slice `[isize]` + | -------------- ^^ expected array `[isize; 3]`, found slice `[isize]` + | | + | expected due to this | = note: expected reference `&([isize; 3],)` found reference `&([isize],)` diff --git a/src/test/ui/dst/dst-bad-coercions.stderr b/src/test/ui/dst/dst-bad-coercions.stderr index 6058594d64ded..3e23c5f5c7443 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 reference `&S` found raw pointer `*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 reference `&dyn T` found raw pointer `*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 reference `&S` found raw pointer `*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 reference `&dyn T` found raw pointer `*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 mutable reference `&mut dyn T` found reference `&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 raw pointer `*mut dyn T` found reference `&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 raw pointer `*mut S` found reference `&S` diff --git a/src/test/ui/float-literal-inference-restrictions.stderr b/src/test/ui/float-literal-inference-restrictions.stderr index e6f84f4f35427..62ca8dc77294b 100644 --- a/src/test/ui/float-literal-inference-restrictions.stderr +++ b/src/test/ui/float-literal-inference-restrictions.stderr @@ -2,16 +2,19 @@ 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 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 5e7d6ad9534de..7d4de63759b88 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 unit type `()` found struct `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 unit type `()` found struct `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 unit type `()` found struct `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 f20bd1846d758..141807661199e 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 struct `Foo` found unit 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 struct `Foo` found unit 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 struct `HashMap` found unit 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 struct `HashMap` found unit 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 struct `Foo` found unit 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 struct `Foo` found unit type `()` diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr index 8534ee99c1fa7..328e98657effb 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 fn pointer `for<'b> fn(&'b u32)` found fn pointer `fn(&u32)` diff --git a/src/test/ui/impl-trait/equality2.stderr b/src/test/ui/impl-trait/equality2.stderr index 7a656fca28b58..312976b72d20e 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 opaque 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 associated type `::T` diff --git a/src/test/ui/include-macros/mismatched-types.stderr b/src/test/ui/include-macros/mismatched-types.stderr index 33daf372f986b..efe1f58a6f43d 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 `[u8]`, found `str` + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `str` + | | + | expected due to this | = note: expected reference `&[u8]` found reference `&'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 `[u8; 0]` + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `str`, found array `[u8; 0]` + | | + | expected due to this | = note: expected reference `&str` found reference `&'static [u8; 0]` diff --git a/src/test/ui/issues/issue-1362.stderr b/src/test/ui/issues/issue-1362.stderr index de67a72a63980..6fc2b99a11a4d 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 46524bc2c18e1..2407ece5e4f7d 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 error: aborting due to previous error diff --git a/src/test/ui/issues/issue-24322.stderr b/src/test/ui/issues/issue-24322.stderr index fb0c7a0d80904..1a4fab165405d 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 reference `&for<'r> fn(&'r B) -> u32` found reference `&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 71e4d7850143b..69c452b88f315 100644 --- a/src/test/ui/issues/issue-27042.stderr +++ b/src/test/ui/issues/issue-27042.stderr @@ -20,6 +20,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 @@ -35,6 +37,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 6510c215fcf1f..fd5f7dcf6e66a 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 8a9529a68b7fa..1e191a620af02 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 error: aborting due to previous error diff --git a/src/test/ui/issues/issue-38940.stderr b/src/test/ui/issues/issue-38940.stderr index 707fcc7e919cd..f60387f841aed 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 reference `&Bottom` found reference `&Top` diff --git a/src/test/ui/issues/issue-5100.stderr b/src/test/ui/issues/issue-5100.stderr index bcbcefef3b11a..9e1011496c45d 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 50a202d148948..b83fb346b14ef 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 struct `std::vec::Vec` found reference `&[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 error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-56943.stderr b/src/test/ui/issues/issue-56943.stderr index 7fd124046dc61..6caf974809e76 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 error: aborting due to previous error diff --git a/src/test/ui/json-bom-plus-crlf-multifile.stderr b/src/test/ui/json-bom-plus-crlf-multifile.stderr index 494bbd7f284f1..ab0feb3c451ad 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":"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 +"},"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":"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 variable. It can occur for several cases, the most common of which is a @@ -34,7 +34,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":"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 +"},"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":"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 variable. It can occur for several cases, the most common of which is a @@ -53,7 +53,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":"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 +"},"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":"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 variable. It can occur for several cases, the most common of which is a @@ -72,7 +72,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":[],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:25:22: error[E0308]: mismatched types +"},"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":[],"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 ea21a6b896141..a6217f86879f6 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":"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 +"},"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":"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 variable. It can occur for several cases, the most common of which is a @@ -34,7 +34,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":"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 +"},"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":"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 variable. It can occur for several cases, the most common of which is a @@ -53,7 +53,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":"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 +"},"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":"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 variable. It can occur for several cases, the most common of which is a @@ -72,7 +72,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":[],"rendered":"$DIR/json-bom-plus-crlf.rs:25:22: error[E0308]: mismatched types +"},"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":[],"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 535dbde612c03..5e6980a9dd1f7 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 87e95c2408037..fcd976475686f 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 bfec363eb997a..c9d7da84e09f4 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,13 +2,17 @@ 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 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 error[E0034]: multiple applicable items in scope --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:120:15 @@ -39,19 +43,25 @@ 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 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 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 error: aborting due to 6 previous errors diff --git a/src/test/ui/mir-unpretty.stderr b/src/test/ui/mir-unpretty.stderr index 5384dedb65a49..3808f8583b836 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 error: aborting due to previous error diff --git a/src/test/ui/mismatched_types/main.stderr b/src/test/ui/mismatched_types/main.stderr index 51c8e5f5d4ad1..a662741afcd9c 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 d4b1f0973ccef..4349d98029eaf 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:6:16 | LL | let x: ! = "hello"; - | ^^^^^^^ expected `!`, found `&str` + | - ^^^^^^^ expected `!`, found `&str` + | | + | expected due to this | = note: expected type `!` found reference `&'static str` diff --git a/src/test/ui/noexporttypeexe.stderr b/src/test/ui/noexporttypeexe.stderr index 18fb1755eb11f..e80fcd13685b6 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 enum `std::option::Option` diff --git a/src/test/ui/numeric/const-scope.stderr b/src/test/ui/numeric/const-scope.stderr index c6ddb35ddf5f2..6e1990e3a7222 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 133db19780c34..465b507b788fd 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 94435f2118b8a..9b827794f5be5 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 error: aborting due to 2 previous errors 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 7e4cf0d14e1f8..b6ff39d64d6db 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 error: aborting due to 16 previous errors 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 8f304bdf7131b..82c46ad82c7e4 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 `&str` + | ----- ^^ expected `usize`, found `&str` + | | + | expected due to this error[E0277]: can't compare `&str` with `char` --> $DIR/lex-bad-char-literals-6.rs:12:10 diff --git a/src/test/ui/parser/numeric-lifetime.stderr b/src/test/ui/parser/numeric-lifetime.stderr index d9585e7cbf2f4..73a828952b2a6 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 `&str` + | ----- ^^ expected `usize`, found `&str` + | | + | expected due to this error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/recover-from-homoglyph.stderr b/src/test/ui/parser/recover-from-homoglyph.stderr index 51a7c8e08026a..c807931beee19 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 error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/recover-missing-semi.stderr b/src/test/ui/parser/recover-missing-semi.stderr index b824f92dfaac9..2f2464d3629c6 100644 --- a/src/test/ui/parser/recover-missing-semi.stderr +++ b/src/test/ui/parser/recover-missing-semi.stderr @@ -20,13 +20,17 @@ error[E0308]: mismatched types --> $DIR/recover-missing-semi.rs:2:20 | LL | let _: usize = () - | ^^ expected `usize`, found `()` + | ----- ^^ expected `usize`, found `()` + | | + | expected due to this error[E0308]: mismatched types --> $DIR/recover-missing-semi.rs:9:20 | LL | let _: usize = () - | ^^ expected `usize`, found `()` + | ----- ^^ expected `usize`, found `()` + | | + | expected due to this error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/recover-tuple.stderr b/src/test/ui/parser/recover-tuple.stderr index e6e094dc2e3af..88891b54bb20c 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 `&str` + | ----- ^^ expected `usize`, found `&str` + | | + | expected due to this error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr index 426748b5086bb..bda59d4dea644 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 enum `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 d107697d2bf00..193482a42ab72 100644 --- a/src/test/ui/proc-macro/attribute-spans-preserved.stderr +++ b/src/test/ui/proc-macro/attribute-spans-preserved.stderr @@ -2,13 +2,17 @@ error[E0308]: mismatched types --> $DIR/attribute-spans-preserved.rs:7:23 | LL | #[ foo ( let y: u32 = "z"; ) ] - | ^^^ expected `u32`, found `&str` + | --- ^^^ expected `u32`, found `&str` + | | + | expected due to this error[E0308]: mismatched types --> $DIR/attribute-spans-preserved.rs:8:23 | LL | #[ bar { let x: u32 = "y"; } ] - | ^^^ expected `u32`, found `&str` + | --- ^^^ expected `u32`, found `&str` + | | + | expected due to this error: aborting due to 2 previous errors diff --git a/src/test/ui/proc-macro/attribute-with-error.stderr b/src/test/ui/proc-macro/attribute-with-error.stderr index 391a259c3800a..7f3a7e670b9b7 100644 --- a/src/test/ui/proc-macro/attribute-with-error.stderr +++ b/src/test/ui/proc-macro/attribute-with-error.stderr @@ -2,25 +2,33 @@ error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:10:18 | LL | let a: i32 = "foo"; - | ^^^^^ expected `i32`, found `&str` + | --- ^^^^^ expected `i32`, found `&str` + | | + | expected due to this error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:12:18 | LL | let b: i32 = "f'oo"; - | ^^^^^^ expected `i32`, found `&str` + | --- ^^^^^^ expected `i32`, found `&str` + | | + | expected due to this error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:25:22 | LL | let a: i32 = "foo"; - | ^^^^^ expected `i32`, found `&str` + | --- ^^^^^ expected `i32`, found `&str` + | | + | expected due to this error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:35:22 | LL | let a: i32 = "foo"; - | ^^^^^ expected `i32`, found `&str` + | --- ^^^^^ expected `i32`, found `&str` + | | + | expected due to this error: aborting due to 4 previous errors diff --git a/src/test/ui/proc-macro/nested-item-spans.stderr b/src/test/ui/proc-macro/nested-item-spans.stderr index 09e13c7014b07..44b338fa62215 100644 --- a/src/test/ui/proc-macro/nested-item-spans.stderr +++ b/src/test/ui/proc-macro/nested-item-spans.stderr @@ -2,13 +2,17 @@ error[E0308]: mismatched types --> $DIR/nested-item-spans.rs:9:22 | LL | let x: u32 = "x"; - | ^^^ expected `u32`, found `&str` + | --- ^^^ expected `u32`, found `&str` + | | + | expected due to this error[E0308]: mismatched types --> $DIR/nested-item-spans.rs:18:22 | LL | let x: u32 = "x"; - | ^^^ expected `u32`, found `&str` + | --- ^^^ expected `u32`, found `&str` + | | + | expected due to this error: aborting due to 2 previous errors diff --git a/src/test/ui/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr index c978380817791..cd6f0ea10eac9 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 `&str` + | ----- ^^^^^^^ expected `usize`, found `&str` + | | + | expected due to this error[E0308]: mismatched types --> $DIR/span-preservation.rs:17:29 diff --git a/src/test/ui/ptr-coercion.stderr b/src/test/ui/ptr-coercion.stderr index 49dc4b36268c4..29b7e5da849d4 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 raw pointer `*mut isize` found raw pointer `*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 raw pointer `*mut isize` found reference `&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 raw pointer `*mut isize` found raw pointer `*const isize` diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr index b47e2ea3981ef..c3e8789a903b1 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -2,7 +2,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 fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` found fn item `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}` 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 d2608e09ac551..159d32b50b03c 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 fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` found fn item `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.nll.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr index 85046f59da67d..2aadd8f4f8c7e 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -2,7 +2,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 fn pointer `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` found fn item `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 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 fa39d800b0ecd..dda6129e19536 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 fn pointer `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` found fn item `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.nll.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr index 78966048265d3..434a3e47b492a 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr @@ -2,7 +2,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 fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` found fn item `for<'r, 's> fn(&'r mut &isize, &'s 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 a251bb7eb1afd..01f43aeebaf7c 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 fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` found fn item `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 da43327897538..4defe12b1b37b 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 fn pointer `unsafe extern "rust-intrinsic" fn(isize) -> usize` found fn item `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 12270e4264483..688720e8cd388 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 enum `m::n::Z` found fn item `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 enum `m::E` found fn item `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 enum `m::E` found fn item `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 3be1217440b7e..91f8b0e630901 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 c1c5f316e958b..7d34defc1d577 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 mutable reference `&mut [_]` found reference `&[isize]` diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index 5918888ff89a3..343644006b153 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -2,16 +2,19 @@ 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 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 error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:12:10 diff --git a/src/test/ui/span/move-closure.stderr b/src/test/ui/span/move-closure.stderr index 9914d7e850711..ded581dc4968e 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 unit type `()` found closure `[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 909ff1e0263b6..a133c69eeefc8 100644 --- a/src/test/ui/str/str-array-assignment.stderr +++ b/src/test/ui/str/str-array-assignment.stderr @@ -32,10 +32,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 error: aborting due to 4 previous errors diff --git a/src/test/ui/str/str-lit-type-mismatch.stderr b/src/test/ui/str/str-lit-type-mismatch.stderr index 7174fd972eb7f..64ddfcc9b4765 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 `[u8]`, found `str` - | help: consider adding a leading `b`: `b"foo"` + | ----- ^^^^^ + | | | + | | expected slice `[u8]`, found `str` + | | help: consider adding a leading `b`: `b"foo"` + | expected due to this | = note: expected reference `&[u8]` found reference `&'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 `[u8; 4]`, found `str` - | help: consider adding a leading `b`: `b"baaa"` + | -------- ^^^^^^ + | | | + | | expected array `[u8; 4]`, found `str` + | | help: consider adding a leading `b`: `b"baaa"` + | expected due to this | = note: expected reference `&[u8; 4]` found reference `&'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 `[u8; 3]` - | help: consider removing the leading `b`: `"foo"` + | ---- ^^^^^^ + | | | + | | expected `str`, found array `[u8; 3]` + | | help: consider removing the leading `b`: `"foo"` + | expected due to this | = note: expected reference `&str` found reference `&'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 b75a53915b526..d232a46f8ec29 100644 --- a/src/test/ui/struct-literal-variant-in-if.stderr +++ b/src/test/ui/struct-literal-variant-in-if.stderr @@ -63,7 +63,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 error: aborting due to 7 previous errors diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/substs-ppaux.normal.stderr index 8a233105491e5..4423f3c130e2a 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 unit type `()` found fn item `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 unit type `()` found fn item `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 unit type `()` found fn item `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 unit type `()` found fn item `fn() {foo::<'static>}` diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/substs-ppaux.verbose.stderr index ab70d02e1578a..2aebdebee72c1 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 unit type `()` found fn item `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 unit type `()` found fn item `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 unit type `()` found fn item `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 unit type `()` found fn item `fn() {foo::}` diff --git a/src/test/ui/suggestions/as-ref.stderr b/src/test/ui/suggestions/as-ref.stderr index 1cc63f5c476db..8445a706f4306 100644 --- a/src/test/ui/suggestions/as-ref.stderr +++ b/src/test/ui/suggestions/as-ref.stderr @@ -34,10 +34,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 enum `std::option::Option<&usize>` found reference `&std::option::Option` @@ -46,7 +47,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 enum `std::result::Result<&usize, &usize>` found reference `&std::result::Result` @@ -59,7 +62,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 enum `std::result::Result<&usize, usize>` found reference `&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 e699a753d3aa2..2f0a457a79594 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 fn item `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 struct `S` found fn item `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 fn item `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 struct `V` found fn item `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 fn item `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 fn item `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 enum `E` found fn item `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 fn item `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 fn item `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 fn item `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 fn item `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 fn item `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 fn item `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 closure `[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 4b11139643194..44fac16260afc 100644 --- a/src/test/ui/suggestions/format-borrow.stderr +++ b/src/test/ui/suggestions/format-borrow.stderr @@ -2,19 +2,21 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:2:21 | LL | let a: String = &String::from("a"); - | ^^^^^^^^^^^^^^^^^^ - | | - | expected struct `std::string::String`, found `&std::string::String` - | help: consider removing the borrow: `String::from("a")` + | ------ ^^^^^^^^^^^^^^^^^^ + | | | + | | expected struct `std::string::String`, found `&std::string::String` + | | help: consider removing the borrow: `String::from("a")` + | expected due to this error[E0308]: mismatched types --> $DIR/format-borrow.rs:4:21 | LL | let b: String = &format!("b"); - | ^^^^^^^^^^^^^ - | | - | expected struct `std::string::String`, found `&std::string::String` - | help: consider removing the borrow: `format!("b")` + | ------ ^^^^^^^^^^^^^ + | | | + | | expected struct `std::string::String`, found `&std::string::String` + | | help: consider removing the borrow: `format!("b")` + | expected due to this error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/issue-59819.stderr b/src/test/ui/suggestions/issue-59819.stderr index 23991bbbe690b..b20327a9ff833 100644 --- a/src/test/ui/suggestions/issue-59819.stderr +++ b/src/test/ui/suggestions/issue-59819.stderr @@ -2,28 +2,31 @@ 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 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 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 error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/mismatched-types-numeric-from.stderr b/src/test/ui/suggestions/mismatched-types-numeric-from.stderr index f2c67dd1fdb4d..4d44d893a86d9 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 a93eca0c99dc3..163be4cfce7a1 100644 --- a/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr +++ b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr @@ -22,13 +22,17 @@ 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 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 error[E0308]: mismatched types --> $DIR/recover-from-semicolon-trailing-item.rs:14:9 diff --git a/src/test/ui/suggestions/suggest-box.stderr b/src/test/ui/suggestions/suggest-box.stderr index cda6d5254e7ad..19786bee9cb29 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 63280082e0e0b..cafb6d2d288ee 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 enum `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 64d0ea012c8dd..5dbb9ce45ee9e 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 error: aborting due to previous error 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 c1b6544cdc854..d4993fad15c97 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 error: aborting due to previous error diff --git a/src/test/ui/terminal-width/non-whitespace-trimming.stderr b/src/test/ui/terminal-width/non-whitespace-trimming.stderr index a8f2212b55725..c4ff0e16890b2 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 error: aborting due to previous error diff --git a/src/test/ui/terminal-width/whitespace-trimming.stderr b/src/test/ui/terminal-width/whitespace-trimming.stderr index 903673266cc47..e296d48893cda 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 error: aborting due to previous error 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 078971b89f773..95c3a08c04aa8 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 error: aborting due to 2 previous errors diff --git a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr index 4fe25d6d28739..dc41cbc5fe3f8 100644 --- a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.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 opaque type `WrongGeneric::<&{integer}>` 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 2a037e6817469..24d23de797690 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 opaque 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 89add864f9ada..07962e36da1e6 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 `&str`, found opaque type + | ------------ ^ expected `&str`, found opaque type + | | + | expected due to this | = note: expected reference `&'static str` found opaque 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 7650013e41b1e..a2081424ab497 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 reference `&str` found opaque 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 58a9e643cf629..9a1cf5b25625c 100644 --- a/src/test/ui/type/type-check/assignment-expected-bool.stderr +++ b/src/test/ui/type/type-check/assignment-expected-bool.stderr @@ -107,7 +107,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 error: aborting due to 13 previous errors diff --git a/src/test/ui/type/type-mismatch-multiple.stderr b/src/test/ui/type/type-mismatch-multiple.stderr index d615e599501be..2e8654d319640 100644 --- a/src/test/ui/type/type-mismatch-multiple.stderr +++ b/src/test/ui/type/type-mismatch-multiple.stderr @@ -2,13 +2,17 @@ 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 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 b5a80766804a5..25b4bff4d9aaa 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 `&str` + | - ^^^^^^^ expected `isize`, found `&str` + | | + | expected due to this error: aborting due to previous error diff --git a/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr b/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr index 1f6f89a6eb1cd..867412a24b282 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 struct `Foo<_>` found struct `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 struct `Foo<_>` found struct `Bar` diff --git a/src/test/ui/wrong-mul-method-signature.stderr b/src/test/ui/wrong-mul-method-signature.stderr index c0888b3b9d4d5..23645759c04b0 100644 --- a/src/test/ui/wrong-mul-method-signature.stderr +++ b/src/test/ui/wrong-mul-method-signature.stderr @@ -35,7 +35,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 error: aborting due to 5 previous errors From 4fcb3384adaa847a824ced961a225729ddb71f2d Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Sat, 23 Nov 2019 00:15:39 +0000 Subject: [PATCH 5/7] rustdoc: Mark `--extern-private` as unstable It's not even stable in rustc so it shouldn't be stable in rustdoc. --- src/librustdoc/lib.rs | 2 +- src/test/rustdoc/issue-66159.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 277475f6fffd8..b04e2592ee1c1 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -144,7 +144,7 @@ fn opts() -> Vec { stable("extern", |o| { o.optmulti("", "extern", "pass an --extern to rustc", "NAME[=PATH]") }), - stable("extern-private", |o| { + unstable("extern-private", |o| { o.optmulti("", "extern-private", "pass an --extern to rustc (compatibility only)", "NAME=PATH") }), diff --git a/src/test/rustdoc/issue-66159.rs b/src/test/rustdoc/issue-66159.rs index 88eca7338707c..a0a7adf6e8115 100644 --- a/src/test/rustdoc/issue-66159.rs +++ b/src/test/rustdoc/issue-66159.rs @@ -1,4 +1,5 @@ // aux-build:issue-66159-1.rs +// compile-flags:-Z unstable-options // extern-private:issue_66159_1 // The issue was an ICE which meant that we never actually generated the docs From 05ef20f92203b273d5019cce5ed7907a87420c6a Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Sat, 23 Nov 2019 02:08:10 +0000 Subject: [PATCH 6/7] rustdoc: Don't panic when failing to write .lock file It can be treated like any other unexpected IO error. --- src/librustc_data_structures/flock.rs | 12 ------------ src/librustdoc/html/render.rs | 3 ++- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/librustc_data_structures/flock.rs b/src/librustc_data_structures/flock.rs index b0bd137f2cc4a..01f25a054f0a7 100644 --- a/src/librustc_data_structures/flock.rs +++ b/src/librustc_data_structures/flock.rs @@ -298,15 +298,3 @@ cfg_if! { } } } - -impl Lock { - pub fn panicking_new(p: &Path, - wait: bool, - create: bool, - exclusive: bool) - -> Lock { - Lock::new(p, wait, create, exclusive).unwrap_or_else(|err| { - panic!("could not lock `{}`: {}", p.display(), err); - }) - } -} diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index bd2a6602e16be..4bfcbc52ba1f3 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -546,7 +546,8 @@ fn write_shared( // Write out the shared files. Note that these are shared among all rustdoc // docs placed in the output directory, so this needs to be a synchronized // operation with respect to all other rustdocs running around. - let _lock = flock::Lock::panicking_new(&cx.dst.join(".lock"), true, true, true); + let lock_file = cx.dst.join(".lock"); + let _lock = try_err!(flock::Lock::new(&lock_file, true, true, true), &lock_file); // Add all the static files. These may already exist, but we just // overwrite them anyway to make sure that they're fresh and up-to-date. From bbbdbb0e44bb4cea653584017acce4bcda158939 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 23 Nov 2019 18:19:57 +0300 Subject: [PATCH 7/7] Move def collector from `rustc` to `rustc_resolve` --- src/librustc/hir/map/definitions.rs | 11 +++++++- src/librustc/hir/map/mod.rs | 2 -- src/librustc_resolve/build_reduced_graph.rs | 5 ++-- .../map => librustc_resolve}/def_collector.rs | 27 +++++++++++-------- src/librustc_resolve/lib.rs | 1 + 5 files changed, 29 insertions(+), 17 deletions(-) rename src/{librustc/hir/map => librustc_resolve}/def_collector.rs (95%) diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 2b3bc37c87ccb..91b4971cd92be 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -105,7 +105,7 @@ pub struct Definitions { /// we know what parent node that fragment should be attached to thanks to this table. invocation_parents: FxHashMap, /// Indices of unnamed struct or variant fields with unresolved attributes. - pub(super) placeholder_field_indices: NodeMap, + placeholder_field_indices: NodeMap, } /// A unique identifier that we can use to lookup a definition @@ -535,6 +535,15 @@ impl Definitions { let old_parent = self.invocation_parents.insert(invoc_id, parent); assert!(old_parent.is_none(), "parent `DefIndex` is reset for an invocation"); } + + pub fn placeholder_field_index(&self, node_id: ast::NodeId) -> usize { + self.placeholder_field_indices[&node_id] + } + + pub fn set_placeholder_field_index(&mut self, node_id: ast::NodeId, index: usize) { + let old_index = self.placeholder_field_indices.insert(node_id, index); + assert!(old_index.is_none(), "placeholder field index is reset for a node ID"); + } } impl DefPathData { diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 83372dd8adefd..fc754c5e675e6 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -1,5 +1,4 @@ use self::collector::NodeCollector; -pub use self::def_collector::DefCollector; pub use self::definitions::{ Definitions, DefKey, DefPath, DefPathData, DisambiguatedDefPathData, DefPathHash }; @@ -25,7 +24,6 @@ use syntax_pos::{Span, DUMMY_SP}; pub mod blocks; mod collector; -mod def_collector; pub mod definitions; mod hir_id_validator; diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index fd401fde20454..a178c603a462b 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -5,6 +5,7 @@ //! unexpanded macros in the fragment are visited and registered. //! Imports are also considered items and placed into modules here, but not resolved yet. +use crate::def_collector::collect_definitions; use crate::macros::{LegacyBinding, LegacyScope}; use crate::resolve_imports::ImportDirective; use crate::resolve_imports::ImportDirectiveSubclass::{self, GlobImport, SingleImport}; @@ -16,7 +17,6 @@ use crate::{ResolutionError, Determinacy, PathResult, CrateLint}; use rustc::bug; use rustc::hir::def::{self, *}; use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId}; -use rustc::hir::map::DefCollector; use rustc::ty; use rustc::middle::cstore::CrateStore; use rustc_metadata::cstore::LoadedMacro; @@ -167,8 +167,7 @@ impl<'a> Resolver<'a> { fragment: &AstFragment, parent_scope: ParentScope<'a>, ) -> LegacyScope<'a> { - let mut def_collector = DefCollector::new(&mut self.definitions, parent_scope.expansion); - fragment.visit_with(&mut def_collector); + collect_definitions(&mut self.definitions, fragment, parent_scope.expansion); let mut visitor = BuildReducedGraphVisitor { r: self, parent_scope }; fragment.visit_with(&mut visitor); visitor.parent_scope.legacy diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc_resolve/def_collector.rs similarity index 95% rename from src/librustc/hir/map/def_collector.rs rename to src/librustc_resolve/def_collector.rs index cfd90f50b1b04..414ea6e9aa1b5 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc_resolve/def_collector.rs @@ -1,26 +1,31 @@ -use crate::hir::map::definitions::*; -use crate::hir::def_id::DefIndex; - +use log::debug; +use rustc::hir::map::definitions::*; +use rustc::hir::def_id::DefIndex; use syntax::ast::*; use syntax::visit; use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; +use syntax_expand::expand::AstFragment; use syntax_pos::hygiene::ExpnId; use syntax_pos::Span; +crate fn collect_definitions( + definitions: &mut Definitions, + fragment: &AstFragment, + expansion: ExpnId, +) { + let parent_def = definitions.invocation_parent(expansion); + fragment.visit_with(&mut DefCollector { definitions, parent_def, expansion }); +} + /// Creates `DefId`s for nodes in the AST. -pub struct DefCollector<'a> { +struct DefCollector<'a> { definitions: &'a mut Definitions, parent_def: DefIndex, expansion: ExpnId, } impl<'a> DefCollector<'a> { - pub fn new(definitions: &'a mut Definitions, expansion: ExpnId) -> Self { - let parent_def = definitions.invocation_parent(expansion); - DefCollector { definitions, parent_def, expansion } - } - fn create_def(&mut self, node_id: NodeId, data: DefPathData, @@ -82,7 +87,7 @@ impl<'a> DefCollector<'a> { .or_else(|| index.map(sym::integer)) .unwrap_or_else(|| { let node_id = NodeId::placeholder_from_expn_id(self.expansion); - sym::integer(self.definitions.placeholder_field_indices[&node_id]) + sym::integer(self.definitions.placeholder_field_index(node_id)) }); let def = self.create_def(field.id, DefPathData::ValueNs(name), field.span); self.with_parent(def, |this| visit::walk_struct_field(this, field)); @@ -186,7 +191,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { for (index, field) in data.fields().iter().enumerate() { self.collect_field(field, Some(index)); if field.is_placeholder && field.ident.is_none() { - self.definitions.placeholder_field_indices.insert(field.id, index); + self.definitions.set_placeholder_field_index(field.id, index); } } } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index c49db39643bc7..347b72885657a 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -68,6 +68,7 @@ use rustc_error_codes::*; type Res = def::Res; +mod def_collector; mod diagnostics; mod late; mod macros;