diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 84970e7c162b2..652f14e1f39c2 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1462,7 +1462,7 @@ impl HumanEmitter { max_line_num_len: usize, is_secondary: bool, is_cont: bool, - ) -> io::Result<()> { + ) -> io::Result { let mut buffer = StyledBuffer::new(); if !msp.has_primary_spans() && !msp.has_span_labels() && is_secondary && !self.short_message @@ -1575,12 +1575,14 @@ impl HumanEmitter { } let mut annotated_files = FileWithAnnotatedLines::collect_annotations(self, args, msp); trace!("{annotated_files:#?}"); + let mut code_window_status = CodeWindowStatus::Open; // Make sure our primary file comes first let primary_span = msp.primary_span().unwrap_or_default(); let (Some(sm), false) = (self.sm.as_ref(), primary_span.is_dummy()) else { // If we don't have span information, emit and exit - return emit_to_destination(&buffer.render(), level, &mut self.dst, self.short_message); + return emit_to_destination(&buffer.render(), level, &mut self.dst, self.short_message) + .map(|_| code_window_status); }; let primary_lo = sm.lookup_char_pos(primary_span.lo()); if let Ok(pos) = @@ -1589,6 +1591,9 @@ impl HumanEmitter { annotated_files.swap(0, pos); } + // An end column separator should be emitted when a file with with a + // source, is followed by one without a source + let mut col_sep_before_no_show_source = false; let annotated_files_len = annotated_files.len(); // Print out the annotate source lines that correspond with the error for (file_idx, annotated_file) in annotated_files.into_iter().enumerate() { @@ -1599,6 +1604,26 @@ impl HumanEmitter { &annotated_file.file, ) { if !self.short_message { + // Add an end column separator when a file without a source + // comes after one with a source + // ╭▸ $DIR/deriving-meta-unknown-trait.rs:1:10 + // │ + // LL │ #[derive(Eqr)] + // │ ━━━ + // ╰╴ (<- It prints *this* line) + // ╭▸ $SRC_DIR/core/src/cmp.rs:356:0 + // │ + // ╰╴note: similarly named derive macro `Eq` defined here + if col_sep_before_no_show_source { + let buffer_msg_line_offset = buffer.num_lines(); + self.draw_col_separator_end( + &mut buffer, + buffer_msg_line_offset, + max_line_num_len + 1, + ); + } + col_sep_before_no_show_source = false; + // We'll just print an unannotated message. for (annotation_id, line) in annotated_file.lines.iter().enumerate() { let mut annotations = line.annotations.clone(); @@ -1639,29 +1664,42 @@ impl HumanEmitter { } line_idx += 1; } - for (label, is_primary) in labels.into_iter() { + if is_cont + && file_idx == annotated_files_len - 1 + && annotation_id == annotated_file.lines.len() - 1 + && !labels.is_empty() + { + code_window_status = CodeWindowStatus::Closed; + } + let labels_len = labels.len(); + for (label_idx, (label, is_primary)) in labels.into_iter().enumerate() { let style = if is_primary { Style::LabelPrimary } else { Style::LabelSecondary }; - let pipe = self.col_separator(); - buffer.prepend(line_idx, &format!(" {pipe}"), Style::LineNumber); - for _ in 0..max_line_num_len { - buffer.prepend(line_idx, " ", Style::NoStyle); - } + self.draw_col_separator_no_space( + &mut buffer, + line_idx, + max_line_num_len + 1, + ); line_idx += 1; - let chr = self.note_separator(); - buffer.append(line_idx, &format!(" {chr} note: "), style); - for _ in 0..max_line_num_len { - buffer.prepend(line_idx, " ", Style::NoStyle); - } + self.draw_note_separator( + &mut buffer, + line_idx, + max_line_num_len + 1, + label_idx != labels_len - 1, + ); + buffer.append(line_idx, "note", Style::MainHeaderMsg); + buffer.append(line_idx, ": ", Style::NoStyle); buffer.append(line_idx, label, style); line_idx += 1; } } } continue; + } else { + col_sep_before_no_show_source = true; } // print out the span location and spacer before we print the annotated source @@ -1976,7 +2014,7 @@ impl HumanEmitter { // final step: take our styled buffer, render it, then output it emit_to_destination(&buffer.render(), level, &mut self.dst, self.short_message)?; - Ok(()) + Ok(code_window_status) } fn column_width(&self, code_offset: usize) -> usize { @@ -2491,7 +2529,7 @@ impl HumanEmitter { !children.is_empty() || suggestions.iter().any(|s| s.style != SuggestionStyle::CompletelyHidden), ) { - Ok(()) => { + Ok(code_window_status) => { if !children.is_empty() || suggestions.iter().any(|s| s.style != SuggestionStyle::CompletelyHidden) { @@ -2502,7 +2540,7 @@ impl HumanEmitter { { // We'll continue the vertical bar to point into the next note. self.draw_col_separator_no_space(&mut buffer, 0, max_line_num_len + 1); - } else { + } else if matches!(code_window_status, CodeWindowStatus::Open) { // We'll close the vertical bar to visually end the code window. self.draw_col_separator_end(&mut buffer, 0, max_line_num_len + 1); } @@ -2829,10 +2867,11 @@ impl HumanEmitter { } } - fn note_separator(&self) -> char { + fn note_separator(&self, is_cont: bool) -> &'static str { match self.theme { - OutputTheme::Ascii => '=', - OutputTheme::Unicode => '╰', + OutputTheme::Ascii => "= ", + OutputTheme::Unicode if is_cont => "├ ", + OutputTheme::Unicode => "╰ ", } } @@ -2945,11 +2984,7 @@ impl HumanEmitter { col: usize, is_cont: bool, ) { - let chr = match self.theme { - OutputTheme::Ascii => "= ", - OutputTheme::Unicode if is_cont => "├ ", - OutputTheme::Unicode => "╰ ", - }; + let chr = self.note_separator(is_cont); buffer.puts(line, col, chr, Style::LineNumber); } @@ -3050,6 +3085,12 @@ enum DisplaySuggestion { Add, } +#[derive(Clone, Copy, Debug)] +enum CodeWindowStatus { + Closed, + Open, +} + impl FileWithAnnotatedLines { /// Preprocess all the annotations so that they are grouped by file and by line number /// This helps us quickly iterate over the whole message (including secondary file spans) diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr index 3d82f572a1a69..823d8d5b92fce 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -25,6 +25,7 @@ error[E0599]: no method named `poll` found for struct `Pin<&mut impl Future>` + | --> $SRC_DIR/core/src/future/future.rs:LL:COL | = note: the method is available for `Pin<&mut impl Future>` here diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr index dc323f9a234d6..3bf8b7ba5d8f9 100644 --- a/tests/ui/c-variadic/issue-86053-1.stderr +++ b/tests/ui/c-variadic/issue-86053-1.stderr @@ -57,10 +57,10 @@ error[E0412]: cannot find type `F` in this scope | LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { | ^ + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here - | help: a trait with a similar name exists | LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index 3e95fab441ade..987625d22c9d3 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -9,10 +9,10 @@ error[E0412]: cannot find type `F` in this scope | LL | _func: F, | ^ + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here - | help: a trait with a similar name exists | LL | _func: Fn, diff --git a/tests/ui/closures/issue-90871.stderr b/tests/ui/closures/issue-90871.stderr index ef1cb213f73be..12020226680b2 100644 --- a/tests/ui/closures/issue-90871.stderr +++ b/tests/ui/closures/issue-90871.stderr @@ -3,6 +3,7 @@ error[E0412]: cannot find type `n` in this scope | LL | type_ascribe!(2, n([u8; || 1])) | ^ help: a trait with a similar name exists: `Fn` + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index b9db7461699fe..c9c8115660f27 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -3,10 +3,10 @@ error[E0412]: cannot find type `F` in this scope | LL | let f: F = async { 1 }; | ^ + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here - | help: a trait with a similar name exists | LL | let f: Fn = async { 1 }; diff --git a/tests/ui/consts/issue-89088.stderr b/tests/ui/consts/issue-89088.stderr index 56025e0d9b288..5008a2eada8f1 100644 --- a/tests/ui/consts/issue-89088.stderr +++ b/tests/ui/consts/issue-89088.stderr @@ -6,6 +6,7 @@ LL | const FOO: &A = &A::Field(Cow::Borrowed("foo")); ... LL | FOO => todo!(), | ^^^ constant of non-structural type + | --> $SRC_DIR/alloc/src/borrow.rs:LL:COL | = note: `Cow<'_, str>` must be annotated with `#[derive(PartialEq)]` to be usable in patterns diff --git a/tests/ui/derives/deriving-meta-unknown-trait.stderr b/tests/ui/derives/deriving-meta-unknown-trait.stderr index 28753b8f9f288..7ee90ae9eb0c3 100644 --- a/tests/ui/derives/deriving-meta-unknown-trait.stderr +++ b/tests/ui/derives/deriving-meta-unknown-trait.stderr @@ -3,6 +3,7 @@ error: cannot find derive macro `Eqr` in this scope | LL | #[derive(Eqr)] | ^^^ help: a derive macro with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named derive macro `Eq` defined here @@ -12,6 +13,7 @@ error: cannot find derive macro `Eqr` in this scope | LL | #[derive(Eqr)] | ^^^ help: a derive macro with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named derive macro `Eq` defined here diff --git a/tests/ui/did_you_mean/println-typo.stderr b/tests/ui/did_you_mean/println-typo.stderr index a1e0b1f1ba4f1..7dd6fbba620b0 100644 --- a/tests/ui/did_you_mean/println-typo.stderr +++ b/tests/ui/did_you_mean/println-typo.stderr @@ -3,6 +3,7 @@ error: cannot find macro `prinltn` in this scope | LL | prinltn!(); | ^^^^^^^ help: a macro with a similar name exists: `println` + | --> $SRC_DIR/std/src/macros.rs:LL:COL | = note: similarly named macro `println` defined here diff --git a/tests/ui/impl-trait/call_method_without_import.no_import.stderr b/tests/ui/impl-trait/call_method_without_import.no_import.stderr index dbac74b224793..2ca79aa7c10f9 100644 --- a/tests/ui/impl-trait/call_method_without_import.no_import.stderr +++ b/tests/ui/impl-trait/call_method_without_import.no_import.stderr @@ -3,6 +3,7 @@ error[E0599]: no method named `fmt` found for opaque type `impl Debug` in the cu | LL | x.fmt(f); | ^^^ method not found in `impl Debug` + | --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | = note: the method is available for `impl Debug` here diff --git a/tests/ui/impl-trait/impl-generic-mismatch.stderr b/tests/ui/impl-trait/impl-generic-mismatch.stderr index 18347bd0f978f..d7fff4c445d96 100644 --- a/tests/ui/impl-trait/impl-generic-mismatch.stderr +++ b/tests/ui/impl-trait/impl-generic-mismatch.stderr @@ -48,6 +48,7 @@ error[E0643]: method `hash` has incompatible signature for trait | LL | fn hash(&self, hasher: &mut impl Hasher) {} | ^^^^^^^^^^^ expected generic parameter, found `impl Trait` + | --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | = note: declaration in trait here diff --git a/tests/ui/imports/suggest-remove-issue-121315.stderr b/tests/ui/imports/suggest-remove-issue-121315.stderr index 5d0bf9bea6a94..c91ea8a87939c 100644 --- a/tests/ui/imports/suggest-remove-issue-121315.stderr +++ b/tests/ui/imports/suggest-remove-issue-121315.stderr @@ -3,10 +3,10 @@ error: the item `TryFrom` is imported redundantly | LL | use std::convert::TryFrom; | ^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryFrom` is already defined here - | note: the lint level is defined here --> $DIR/suggest-remove-issue-121315.rs:2:25 | @@ -18,6 +18,7 @@ error: the item `TryFrom` is imported redundantly | LL | use std::convert::{TryFrom, TryInto}; | ^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryFrom` is already defined here @@ -27,6 +28,7 @@ error: the item `TryInto` is imported redundantly | LL | use std::convert::{TryFrom, TryInto}; | ^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryInto` is already defined here @@ -48,6 +50,7 @@ error: the item `Into` is imported redundantly | LL | use std::convert::{AsMut, Into}; | ^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `Into` is already defined here diff --git a/tests/ui/issues/issue-17546.stderr b/tests/ui/issues/issue-17546.stderr index 25a94dd97232b..5bae738d3ecde 100644 --- a/tests/ui/issues/issue-17546.stderr +++ b/tests/ui/issues/issue-17546.stderr @@ -3,10 +3,10 @@ error[E0573]: expected type, found variant `NoResult` | LL | fn new() -> NoResult { | ^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named enum `Result` defined here - | help: try using the variant's enum | LL - fn new() -> NoResult { @@ -57,10 +57,10 @@ error[E0573]: expected type, found variant `NoResult` | LL | fn newer() -> NoResult { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named enum `Result` defined here - | help: try using the variant's enum | LL - fn newer() -> NoResult { diff --git a/tests/ui/issues/issue-27033.stderr b/tests/ui/issues/issue-27033.stderr index 7a0ca888d7471..129870f8c4098 100644 --- a/tests/ui/issues/issue-27033.stderr +++ b/tests/ui/issues/issue-27033.stderr @@ -3,6 +3,7 @@ error[E0530]: match bindings cannot shadow unit variants | LL | None @ _ => {} | ^^^^ cannot be named the same as a unit variant + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the unit variant `None` is defined here diff --git a/tests/ui/issues/issue-32655.stderr b/tests/ui/issues/issue-32655.stderr index b8362499b2d0a..db00b159ee412 100644 --- a/tests/ui/issues/issue-32655.stderr +++ b/tests/ui/issues/issue-32655.stderr @@ -6,6 +6,7 @@ LL | #[derive_Clone] ... LL | foo!(); | ------ in this macro invocation + | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named attribute macro `derive_const` defined here @@ -17,6 +18,7 @@ error: cannot find attribute `derive_Clone` in this scope | LL | #[derive_Clone] | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` + | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named attribute macro `derive_const` defined here diff --git a/tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr b/tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr index c14ab9e11e0fc..8a5c243ddf809 100644 --- a/tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr +++ b/tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr @@ -3,10 +3,10 @@ warning: the item `String` is imported redundantly | LL | use std::string::String; | ^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `String` is already defined here - | note: the lint level is defined here --> $DIR/use-redundant-issue-71450.rs:3:9 | diff --git a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr index 48d5c275055f3..71bc7d3b37161 100644 --- a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr +++ b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr @@ -3,10 +3,10 @@ warning: the item `Some` is imported redundantly | LL | use std::option::Option::Some; | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `Some` is already defined here - | note: the lint level is defined here --> $DIR/use-redundant-prelude-rust-2015.rs:3:9 | @@ -18,6 +18,7 @@ warning: the item `None` is imported redundantly | LL | use std::option::Option::None; | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `None` is already defined here @@ -27,6 +28,7 @@ warning: the item `Ok` is imported redundantly | LL | use std::result::Result::Ok; | ^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `Ok` is already defined here @@ -36,6 +38,7 @@ warning: the item `Err` is imported redundantly | LL | use std::result::Result::Err; | ^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `Err` is already defined here diff --git a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.stderr b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.stderr index 526771c597aa7..f9b7af2105c1f 100644 --- a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.stderr +++ b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.stderr @@ -3,10 +3,10 @@ warning: the item `TryFrom` is imported redundantly | LL | use std::convert::TryFrom; | ^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryFrom` is already defined here - | note: the lint level is defined here --> $DIR/use-redundant-prelude-rust-2021.rs:3:9 | @@ -18,6 +18,7 @@ warning: the item `TryInto` is imported redundantly | LL | use std::convert::TryInto; | ^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | = note: the item `TryInto` is already defined here diff --git a/tests/ui/macros/macro-name-typo.stderr b/tests/ui/macros/macro-name-typo.stderr index 9059b10faaacd..1cc7ea6ec1b60 100644 --- a/tests/ui/macros/macro-name-typo.stderr +++ b/tests/ui/macros/macro-name-typo.stderr @@ -3,6 +3,7 @@ error: cannot find macro `printlx` in this scope | LL | printlx!("oh noes!"); | ^^^^^^^ help: a macro with a similar name exists: `println` + | --> $SRC_DIR/std/src/macros.rs:LL:COL | = note: similarly named macro `println` defined here diff --git a/tests/ui/macros/macro-path-prelude-fail-3.stderr b/tests/ui/macros/macro-path-prelude-fail-3.stderr index 485d7b7869a9a..3d0a074deeb05 100644 --- a/tests/ui/macros/macro-path-prelude-fail-3.stderr +++ b/tests/ui/macros/macro-path-prelude-fail-3.stderr @@ -3,6 +3,7 @@ error: cannot find macro `inline` in this scope | LL | inline!(); | ^^^^^^ help: a macro with a similar name exists: `line` + | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named macro `line` defined here diff --git a/tests/ui/macros/missing-writer-issue-139830.stderr b/tests/ui/macros/missing-writer-issue-139830.stderr index 34dd61328e00c..0a1c6f6f3eac9 100644 --- a/tests/ui/macros/missing-writer-issue-139830.stderr +++ b/tests/ui/macros/missing-writer-issue-139830.stderr @@ -3,10 +3,10 @@ error[E0599]: cannot write into `String` | LL | let _ = write!(buf, "foo"); | ^^^ + | --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | = note: the method is available for `String` here - | note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method --> $DIR/missing-writer-issue-139830.rs:7:20 | diff --git a/tests/ui/methods/method-call-lifetime-args-unresolved.stderr b/tests/ui/methods/method-call-lifetime-args-unresolved.stderr index d3bd74a49fb3d..79df4d1af8f03 100644 --- a/tests/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/tests/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -14,6 +14,7 @@ warning: cannot specify lifetime arguments explicitly if late bound lifetime par | LL | 0.clone::<'a>(); | ^^ + | --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: the late bound lifetime parameter is introduced here diff --git a/tests/ui/parser/misspelled-keywords/ref.stderr b/tests/ui/parser/misspelled-keywords/ref.stderr index 21b99d6e6638b..dd33fdb21ba1a 100644 --- a/tests/ui/parser/misspelled-keywords/ref.stderr +++ b/tests/ui/parser/misspelled-keywords/ref.stderr @@ -15,6 +15,7 @@ error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has | LL | Some(refe list) => println!("{list:?}"), | ^^^^ ^^^^ expected 1 field, found 2 + | --> $SRC_DIR/core/src/option.rs:LL:COL | = note: tuple variant has 1 field diff --git a/tests/ui/parser/recover/recover-pat-exprs.stderr b/tests/ui/parser/recover/recover-pat-exprs.stderr index 33000022b8f90..a99f7e16fca83 100644 --- a/tests/ui/parser/recover/recover-pat-exprs.stderr +++ b/tests/ui/parser/recover/recover-pat-exprs.stderr @@ -690,6 +690,7 @@ error: expected one of `)`, `,`, `@`, `if`, or `|`, found `*` | LL | let b = matches!(x, (x * x | x.f()) | x[0]); | ^ expected one of `)`, `,`, `@`, `if`, or `|` + | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: while parsing argument for this `pat` macro fragment diff --git a/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr b/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr index 21d09ec44c4f8..6d43018462873 100644 --- a/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr +++ b/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr @@ -6,6 +6,7 @@ LL | const EMPTY: Vec<()> = Vec::new(); ... LL | EMPTY => {} | ^^^^^ constant of non-structural type + | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec<()>` must be annotated with `#[derive(PartialEq)]` to be usable in patterns diff --git a/tests/ui/pattern/issue-115599.stderr b/tests/ui/pattern/issue-115599.stderr index 69d10728ccdd7..ed465ea0bbadd 100644 --- a/tests/ui/pattern/issue-115599.stderr +++ b/tests/ui/pattern/issue-115599.stderr @@ -6,6 +6,7 @@ LL | const CONST_STRING: String = String::new(); ... LL | if let CONST_STRING = empty_str {} | ^^^^^^^^^^^^ constant of non-structural type + | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec` must be annotated with `#[derive(PartialEq)]` to be usable in patterns diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index 6c47b52c9de74..2b48e9046bf03 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -3,10 +3,10 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `st | LL | let _ = std::collections::HashMap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | = note: `std::collections::HashMap` defined here - | help: you might have meant to use an associated function to build this type | LL | let _ = std::collections::HashMap::new(); diff --git a/tests/ui/proc-macro/parent-source-spans.stderr b/tests/ui/proc-macro/parent-source-spans.stderr index a3b27fd7bcc1b..db1eed5e4588e 100644 --- a/tests/ui/proc-macro/parent-source-spans.stderr +++ b/tests/ui/proc-macro/parent-source-spans.stderr @@ -144,6 +144,7 @@ LL | parent_source_spans!($($tokens)*); ... LL | one!("hello", "world"); | ---------------------- in this macro invocation + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named tuple variant `Ok` defined here @@ -158,6 +159,7 @@ LL | parent_source_spans!($($tokens)*); ... LL | two!("yay", "rust"); | ------------------- in this macro invocation + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named tuple variant `Ok` defined here @@ -172,6 +174,7 @@ LL | parent_source_spans!($($tokens)*); ... LL | three!("hip", "hop"); | -------------------- in this macro invocation + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named tuple variant `Ok` defined here diff --git a/tests/ui/proc-macro/resolve-error.stderr b/tests/ui/proc-macro/resolve-error.stderr index 963298311ef5b..45b71a3e7b3af 100644 --- a/tests/ui/proc-macro/resolve-error.stderr +++ b/tests/ui/proc-macro/resolve-error.stderr @@ -76,6 +76,7 @@ error: cannot find derive macro `Dlone` in this scope | LL | #[derive(Dlone)] | ^^^^^ help: a derive macro with a similar name exists: `Clone` + | --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: similarly named derive macro `Clone` defined here @@ -85,6 +86,7 @@ error: cannot find derive macro `Dlone` in this scope | LL | #[derive(Dlone)] | ^^^^^ help: a derive macro with a similar name exists: `Clone` + | --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: similarly named derive macro `Clone` defined here diff --git a/tests/ui/resolve/levenshtein.stderr b/tests/ui/resolve/levenshtein.stderr index cf478210132ed..7fc5710c35ecc 100644 --- a/tests/ui/resolve/levenshtein.stderr +++ b/tests/ui/resolve/levenshtein.stderr @@ -18,6 +18,7 @@ error[E0412]: cannot find type `Opiton` in this scope | LL | type B = Opiton; // Misspelled type name from the prelude. | ^^^^^^ help: an enum with a similar name exists: `Option` + | --> $SRC_DIR/core/src/option.rs:LL:COL | = note: similarly named enum `Option` defined here diff --git a/tests/ui/suggestions/attribute-typos.stderr b/tests/ui/suggestions/attribute-typos.stderr index a1a01c0abd633..1816a27dcdc8e 100644 --- a/tests/ui/suggestions/attribute-typos.stderr +++ b/tests/ui/suggestions/attribute-typos.stderr @@ -15,6 +15,7 @@ error: cannot find attribute `tests` in this scope | LL | #[tests] | ^^^^^ help: an attribute macro with a similar name exists: `test` + | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named attribute macro `test` defined here diff --git a/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr b/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr index 0cd6267b3b313..c81ac34aaf49c 100644 --- a/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr +++ b/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr @@ -3,6 +3,7 @@ error[E0573]: expected type, found module `result` | LL | impl result { | ^^^^^^ help: an enum with a similar name exists: `Result` + | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named enum `Result` defined here diff --git a/tests/ui/suggestions/enum-method-probe.stderr b/tests/ui/suggestions/enum-method-probe.stderr index e66973d9d954b..648672a7ab6c8 100644 --- a/tests/ui/suggestions/enum-method-probe.stderr +++ b/tests/ui/suggestions/enum-method-probe.stderr @@ -99,10 +99,10 @@ error[E0624]: method `len` is private | LL | res.len(); | ^^^ private method + | --> $SRC_DIR/core/src/option.rs:LL:COL | = note: private method defined here - | note: the method `len` exists on the type `Vec<{integer}>` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: consider using `Option::expect` to unwrap the `Vec<{integer}>` value, panicking if the value is an `Option::None` diff --git a/tests/ui/suggestions/import-trait-for-method-call.stderr b/tests/ui/suggestions/import-trait-for-method-call.stderr index 58b07fe7a42c1..177ab76cd1f4f 100644 --- a/tests/ui/suggestions/import-trait-for-method-call.stderr +++ b/tests/ui/suggestions/import-trait-for-method-call.stderr @@ -3,6 +3,7 @@ error[E0599]: no method named `finish` found for struct `DefaultHasher` in the c | LL | h.finish() | ^^^^^^ method not found in `DefaultHasher` + | --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | = note: the method is available for `DefaultHasher` here diff --git a/tests/ui/suggestions/multi-suggestion.ascii.stderr b/tests/ui/suggestions/multi-suggestion.ascii.stderr index f2a146fbd5257..1744162e6cec6 100644 --- a/tests/ui/suggestions/multi-suggestion.ascii.stderr +++ b/tests/ui/suggestions/multi-suggestion.ascii.stderr @@ -3,10 +3,10 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `st | LL | let _ = std::collections::HashMap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL | = note: `std::collections::HashMap` defined here - | help: you might have meant to use an associated function to build this type | LL | let _ = std::collections::HashMap::new(); diff --git a/tests/ui/suggestions/multi-suggestion.unicode.stderr b/tests/ui/suggestions/multi-suggestion.unicode.stderr index 69df481579bc7..4835c263f1901 100644 --- a/tests/ui/suggestions/multi-suggestion.unicode.stderr +++ b/tests/ui/suggestions/multi-suggestion.unicode.stderr @@ -3,10 +3,10 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `st │ LL │ let _ = std::collections::HashMap(); │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ╰╴ ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL │ ╰ note: `std::collections::HashMap` defined here - ╰╴ help: you might have meant to use an associated function to build this type ╭╴ LL │ let _ = std::collections::HashMap::new(); @@ -34,7 +34,7 @@ LL │ wtf: Some(Box(U { note: constructor is not visible here due to private fields ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL │ - ╰ note: private field + ├ note: private field │ ╰ note: private field help: you might have meant to use an associated function to build this type diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 0008b4fb5ed2e..8ab8a1716b14f 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -44,6 +44,7 @@ error[E0599]: no method named `try_into` found for type `i32` in the current sco | LL | let _i: i16 = 0_i32.try_into().unwrap(); | ^^^^^^^^ + | --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | = note: the method is available for `i32` here diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 2288bd1129c43..40936ce1ec34d 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -3,10 +3,10 @@ error[E0404]: expected trait, found struct `String` | LL | struct Foo where T: Bar, ::Baz: String { | ^^^^^^ not a trait + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here - | help: constrain the associated type to `String` | LL - struct Foo where T: Bar, ::Baz: String { @@ -22,10 +22,10 @@ error[E0404]: expected trait, found struct `String` | LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { | ^^^^^^ not a trait + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here - | help: constrain the associated type to `String` | LL - struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { @@ -41,10 +41,10 @@ error[E0404]: expected trait, found struct `String` | LL | fn foo(_: T) where ::Baz: String { | ^^^^^^ not a trait + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here - | help: constrain the associated type to `String` | LL - fn foo(_: T) where ::Baz: String { @@ -60,10 +60,10 @@ error[E0404]: expected trait, found struct `String` | LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { | ^^^^^^ not a trait + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here - | help: constrain the associated type to `String` | LL - fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { @@ -85,6 +85,7 @@ error[E0404]: expected trait, found struct `String` | LL | fn issue_95327() where ::Assoc: String {} | ^^^^^^ help: a trait with a similar name exists: `ToString` + | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here diff --git a/tests/ui/type/issue-7607-1.stderr b/tests/ui/type/issue-7607-1.stderr index db4c8f25dbc43..69b6d62e987a4 100644 --- a/tests/ui/type/issue-7607-1.stderr +++ b/tests/ui/type/issue-7607-1.stderr @@ -3,6 +3,7 @@ error[E0412]: cannot find type `Fo` in this scope | LL | impl Fo { | ^^ help: a trait with a similar name exists: `Fn` + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here diff --git a/tests/ui/typeck/issue-83693.stderr b/tests/ui/typeck/issue-83693.stderr index 34bca426116e5..0359b8af93a37 100644 --- a/tests/ui/typeck/issue-83693.stderr +++ b/tests/ui/typeck/issue-83693.stderr @@ -3,6 +3,7 @@ error[E0412]: cannot find type `F` in this scope | LL | impl F { | ^ help: a trait with a similar name exists: `Fn` + | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here diff --git a/tests/ui/ufcs/ufcs-partially-resolved.stderr b/tests/ui/ufcs/ufcs-partially-resolved.stderr index 69d6bd74a736d..a854ecb062224 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.stderr +++ b/tests/ui/ufcs/ufcs-partially-resolved.stderr @@ -12,6 +12,7 @@ error[E0404]: expected trait, found enum `E` | LL | let _: ::N; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -42,6 +43,7 @@ error[E0404]: expected trait, found enum `E` | LL | ::N; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -63,6 +65,7 @@ error[E0404]: expected trait, found enum `E` | LL | let _: ::Y; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -72,6 +75,7 @@ error[E0404]: expected trait, found enum `E` | LL | ::Y; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -90,6 +94,7 @@ error[E0404]: expected trait, found enum `E` | LL | let _: ::N::NN; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -120,6 +125,7 @@ error[E0404]: expected trait, found enum `E` | LL | ::N::NN; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -141,6 +147,7 @@ error[E0404]: expected trait, found enum `E` | LL | let _: ::Y::NN; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here @@ -150,6 +157,7 @@ error[E0404]: expected trait, found enum `E` | LL | ::Y::NN; | ^ help: a trait with a similar name exists: `Eq` + | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here