diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index c0fb8e33a819e..5a885135dfd03 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -850,12 +850,14 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { Res::Def(kind @ DefKind::Mod, def_id) | Res::Def(kind @ DefKind::Enum, def_id) | Res::Def(kind @ DefKind::Trait, def_id) => { - let module = self.r.new_module(parent, - ModuleKind::Def(kind, def_id, ident.name), - def_id, - expansion, - span); - self.r.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, expansion)); + let module = self.r.new_module( + parent, + ModuleKind::Def(kind, def_id, ident.name), + def_id, + expansion, + span, + ); + self.r.define(parent, ident, TypeNS, (module, vis, span, expansion)); } Res::Def(DefKind::Struct, _) | Res::Def(DefKind::Union, _) @@ -868,17 +870,17 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { | Res::Def(DefKind::AssocOpaqueTy, _) | Res::PrimTy(..) | Res::ToolMod => - self.r.define(parent, ident, TypeNS, (res, vis, DUMMY_SP, expansion)), + self.r.define(parent, ident, TypeNS, (res, vis, span, expansion)), Res::Def(DefKind::Fn, _) | Res::Def(DefKind::Method, _) | Res::Def(DefKind::Static, _) | Res::Def(DefKind::Const, _) | Res::Def(DefKind::AssocConst, _) | Res::Def(DefKind::Ctor(..), _) => - self.r.define(parent, ident, ValueNS, (res, vis, DUMMY_SP, expansion)), + self.r.define(parent, ident, ValueNS, (res, vis, span, expansion)), Res::Def(DefKind::Macro(..), _) | Res::NonMacroAttr(..) => - self.r.define(parent, ident, MacroNS, (res, vis, DUMMY_SP, expansion)), + self.r.define(parent, ident, MacroNS, (res, vis, span, expansion)), Res::Def(DefKind::TyParam, _) | Res::Def(DefKind::ConstParam, _) | Res::Local(..) | Res::SelfTy(..) | Res::SelfCtor(..) | Res::Err => bug!("unexpected resolution: {:?}", res) diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 7634093fbefba..511221e143b17 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -58,21 +58,6 @@ fn reduce_impl_span_to_impl_keyword(cm: &SourceMap, impl_span: Span) -> Span { impl_span } -crate fn add_typo_suggestion( - err: &mut DiagnosticBuilder<'_>, suggestion: Option, span: Span -) -> bool { - if let Some(suggestion) = suggestion { - let msg = format!( - "{} {} with a similar name exists", suggestion.res.article(), suggestion.res.descr() - ); - err.span_suggestion( - span, &msg, suggestion.candidate.to_string(), Applicability::MaybeIncorrect - ); - return true; - } - false -} - impl<'a> Resolver<'a> { crate fn add_module_candidates( &mut self, @@ -641,7 +626,7 @@ impl<'a> Resolver<'a> { let suggestion = self.early_lookup_typo_candidate( ScopeSet::Macro(macro_kind), parent_scope, ident, is_expected ); - add_typo_suggestion(err, suggestion, ident.span); + self.add_typo_suggestion(err, suggestion, ident.span); if macro_kind == MacroKind::Derive && (ident.as_str() == "Send" || ident.as_str() == "Sync") { @@ -652,6 +637,33 @@ impl<'a> Resolver<'a> { err.help("have you added the `#[macro_use]` on the module/import?"); } } + + crate fn add_typo_suggestion( + &self, + err: &mut DiagnosticBuilder<'_>, + suggestion: Option, + span: Span, + ) -> bool { + if let Some(suggestion) = suggestion { + let msg = format!( + "{} {} with a similar name exists", suggestion.res.article(), suggestion.res.descr() + ); + err.span_suggestion( + span, &msg, suggestion.candidate.to_string(), Applicability::MaybeIncorrect + ); + let def_span = suggestion.res.opt_def_id() + .and_then(|def_id| self.definitions.opt_span(def_id)); + if let Some(span) = def_span { + err.span_label(span, &format!( + "similarly named {} `{}` defined here", + suggestion.res.descr(), + suggestion.candidate.as_str(), + )); + } + return true; + } + false + } } impl<'a, 'b> ImportResolver<'a, 'b> { diff --git a/src/librustc_resolve/error_codes.rs b/src/librustc_resolve/error_codes.rs index be2e9f505aa6f..9515c87ce4bb5 100644 --- a/src/librustc_resolve/error_codes.rs +++ b/src/librustc_resolve/error_codes.rs @@ -974,7 +974,7 @@ function: struct Foo { a: bool }; let f = Foo(); -// error: expected function, found `Foo` +// error: expected function, tuple struct or tuple variant, found `Foo` // `Foo` is a struct name, but this expression uses it like a function name ``` @@ -992,7 +992,8 @@ yield this error: ```compile_fail,E0423 println(""); -// error: expected function, found macro `println` +// error: expected function, tuple struct or tuple variant, +// found macro `println` // did you mean `println!(...)`? (notice the trailing `!`) ``` @@ -1592,7 +1593,7 @@ enum State { fn print_on_failure(state: &State) { match *state { - // error: expected unit struct/variant or constant, found tuple + // error: expected unit struct, unit variant or constant, found tuple // variant `State::Failed` State::Failed => println!("Failed"), _ => () diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 136ab1f0444fa..faf7696288bd1 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -199,21 +199,36 @@ impl<'a> PathSource<'a> { } fn descr_expected(self) -> &'static str { - match self { + match &self { PathSource::Type => "type", PathSource::Trait(_) => "trait", - PathSource::Pat => "unit struct/variant or constant", + PathSource::Pat => "unit struct, unit variant or constant", PathSource::Struct => "struct, variant or union type", - PathSource::TupleStruct => "tuple struct/variant", + PathSource::TupleStruct => "tuple struct or tuple variant", PathSource::TraitItem(ns) => match ns { TypeNS => "associated type", ValueNS => "method or associated constant", MacroNS => bug!("associated macro"), }, - PathSource::Expr(parent) => match parent.map(|p| &p.kind) { + PathSource::Expr(parent) => match &parent.as_ref().map(|p| &p.kind) { // "function" here means "anything callable" rather than `DefKind::Fn`, // this is not precise but usually more helpful than just "value". - Some(&ExprKind::Call(..)) => "function", + Some(ExprKind::Call(call_expr, _)) => { + match &call_expr.kind { + ExprKind::Path(_, path) => { + let mut msg = "function"; + if let Some(segment) = path.segments.iter().last() { + if let Some(c) = segment.ident.to_string().chars().next() { + if c.is_uppercase() { + msg = "function, tuple struct or tuple variant"; + } + } + } + msg + } + _ => "function" + } + } _ => "value", }, } diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 2721df4c68763..71a6f0d464d9f 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -1,7 +1,7 @@ use crate::{CrateLint, Module, ModuleKind, ModuleOrUniformRoot}; use crate::{PathResult, PathSource, Segment}; use crate::path_names_to_string; -use crate::diagnostics::{add_typo_suggestion, ImportSuggestion, TypoSuggestion}; +use crate::diagnostics::{ImportSuggestion, TypoSuggestion}; use crate::late::{LateResolutionVisitor, RibKind}; use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; @@ -237,18 +237,19 @@ impl<'a> LateResolutionVisitor<'a, '_> { } // Try Levenshtein algorithm. - let levenshtein_worked = add_typo_suggestion( - &mut err, self.lookup_typo_candidate(path, ns, is_expected, span), ident_span - ); + let typo_sugg = self.lookup_typo_candidate(path, ns, is_expected, span); + let levenshtein_worked = self.r.add_typo_suggestion(&mut err, typo_sugg, ident_span); // Try context-dependent help if relaxed lookup didn't work. if let Some(res) = res { - if self.smart_resolve_context_dependent_help(&mut err, - span, - source, - res, - &path_str, - &fallback_label) { + if self.smart_resolve_context_dependent_help( + &mut err, + span, + source, + res, + &path_str, + &fallback_label, + ) { return (err, candidates); } } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 96a097695fa1f..f7132cd868aac 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2269,7 +2269,7 @@ pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, vs: &'tcx [hir::Variant], i fn report_unexpected_variant_res(tcx: TyCtxt<'_>, res: Res, span: Span, qpath: &QPath) { span_err!(tcx.sess, span, E0533, - "expected unit struct/variant or constant, found {} `{}`", + "expected unit struct, unit variant or constant, found {} `{}`", res.descr(), hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false))); } diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs index 97c30f208f5ec..950ae7c1d62e2 100644 --- a/src/librustc_typeck/check/pat.rs +++ b/src/librustc_typeck/check/pat.rs @@ -613,9 +613,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } }; let report_unexpected_res = |res: Res| { - let msg = format!("expected tuple struct/variant, found {} `{}`", - res.descr(), - hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false))); + let msg = format!( + "expected tuple struct or tuple variant, found {} `{}`", + res.descr(), + hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false)), + ); let mut err = struct_span_err!(tcx.sess, pat.span, E0164, "{}", msg); match (res, &pat.kind) { (Res::Def(DefKind::Fn, _), _) | (Res::Def(DefKind::Method, _), _) => { diff --git a/src/librustc_typeck/error_codes.rs b/src/librustc_typeck/error_codes.rs index 75b508a1bbf0f..ae67f54ac1229 100644 --- a/src/librustc_typeck/error_codes.rs +++ b/src/librustc_typeck/error_codes.rs @@ -4346,11 +4346,12 @@ enum X { Entry, } -X::Entry(); // error: expected function, found `X::Entry` +X::Entry(); // error: expected function, tuple struct or tuple variant, + // found `X::Entry` // Or even simpler: let x = 0i32; -x(); // error: expected function, found `i32` +x(); // error: expected function, tuple struct or tuple variant, found `i32` ``` Only functions and methods can be called using `()`. Example: diff --git a/src/test/ui/associated-types/associated-types-eq-1.stderr b/src/test/ui/associated-types/associated-types-eq-1.stderr index aa987316801a7..66c5f34644c01 100644 --- a/src/test/ui/associated-types/associated-types-eq-1.stderr +++ b/src/test/ui/associated-types/associated-types-eq-1.stderr @@ -1,6 +1,8 @@ error[E0412]: cannot find type `A` in this scope --> $DIR/associated-types-eq-1.rs:10:12 | +LL | fn foo2(x: I) { + | - similarly named type parameter `I` defined here LL | let _: A = x.boo(); | ^ help: a type parameter with a similar name exists: `I` diff --git a/src/test/ui/class-missing-self.rs b/src/test/ui/class-missing-self.rs index 515754e54fe07..8ad347d20e6e4 100644 --- a/src/test/ui/class-missing-self.rs +++ b/src/test/ui/class-missing-self.rs @@ -7,7 +7,7 @@ impl Cat { fn meow(&self) { println!("Meow"); meows += 1; //~ ERROR cannot find value `meows` in this scope - sleep(); //~ ERROR cannot find function `sleep` in this scope + sleep(); //~ ERROR cannot find function `sleep` in this } } diff --git a/src/test/ui/const-generics/struct-with-invalid-const-param.stderr b/src/test/ui/const-generics/struct-with-invalid-const-param.stderr index b3aa35e079aec..a96b071c05f42 100644 --- a/src/test/ui/const-generics/struct-with-invalid-const-param.stderr +++ b/src/test/ui/const-generics/struct-with-invalid-const-param.stderr @@ -2,7 +2,10 @@ error[E0573]: expected type, found const parameter `C` --> $DIR/struct-with-invalid-const-param.rs:4:23 | LL | struct S(C); - | ^ help: a struct with a similar name exists: `S` + | ----------------------^-- + | | | + | | help: a struct with a similar name exists: `S` + | similarly named struct `S` defined here warning: the feature `const_generics` is incomplete and may cause the compiler to crash --> $DIR/struct-with-invalid-const-param.rs:1:12 diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs index 7d3aba364897f..9602d27469427 100644 --- a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs +++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs @@ -16,21 +16,21 @@ enum ManyVariants { } fn result_test() { - let x = Option(1); //~ ERROR expected function, found enum + let x = Option(1); //~ ERROR expected function, tuple struct or tuple variant, found enum - if let Option(_) = x { //~ ERROR expected tuple struct/variant, found enum + if let Option(_) = x { //~ ERROR expected tuple struct or tuple variant, found enum println!("It is OK."); } let y = Example::Ex(String::from("test")); - if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum + if let Example(_) = y { //~ ERROR expected tuple struct or tuple variant, found enum println!("It is OK."); } - let y = Void(); //~ ERROR expected function, found enum + let y = Void(); //~ ERROR expected function, tuple struct or tuple variant, found enum - let z = ManyVariants(); //~ ERROR expected function, found enum + let z = ManyVariants(); //~ ERROR expected function, tuple struct or tuple variant, found enum } fn main() {} diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr index 0a2fbe4918f15..2140fd3a5a037 100644 --- a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr +++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr @@ -1,4 +1,4 @@ -error[E0423]: expected function, found enum `Option` +error[E0423]: expected function, tuple struct or tuple variant, found enum `Option` --> $DIR/issue-43871-enum-instead-of-variant.rs:19:13 | LL | let x = Option(1); @@ -11,7 +11,7 @@ LL | let x = std::option::Option::None(1); LL | let x = std::option::Option::Some(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0532]: expected tuple struct/variant, found enum `Option` +error[E0532]: expected tuple struct or tuple variant, found enum `Option` --> $DIR/issue-43871-enum-instead-of-variant.rs:21:12 | LL | if let Option(_) = x { @@ -24,7 +24,7 @@ LL | if let std::option::Option::None(_) = x { LL | if let std::option::Option::Some(_) = x { | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0532]: expected tuple struct/variant, found enum `Example` +error[E0532]: expected tuple struct or tuple variant, found enum `Example` --> $DIR/issue-43871-enum-instead-of-variant.rs:27:12 | LL | if let Example(_) = y { @@ -37,13 +37,13 @@ LL | if let Example::Ex(_) = y { LL | if let Example::NotEx(_) = y { | ^^^^^^^^^^^^^^ -error[E0423]: expected function, found enum `Void` +error[E0423]: expected function, tuple struct or tuple variant, found enum `Void` --> $DIR/issue-43871-enum-instead-of-variant.rs:31:13 | LL | let y = Void(); | ^^^^ -error[E0423]: expected function, found enum `ManyVariants` +error[E0423]: expected function, tuple struct or tuple variant, found enum `ManyVariants` --> $DIR/issue-43871-enum-instead-of-variant.rs:33:13 | LL | let z = ManyVariants(); diff --git a/src/test/ui/empty/empty-struct-braces-expr.rs b/src/test/ui/empty/empty-struct-braces-expr.rs index e33fcb70db775..1a38d3d7601b8 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.rs +++ b/src/test/ui/empty/empty-struct-braces-expr.rs @@ -13,12 +13,15 @@ enum E { fn main() { let e1 = Empty1; //~ ERROR expected value, found struct `Empty1` - let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1` + let e1 = Empty1(); + //~^ ERROR expected function, tuple struct or tuple variant, found struct `Empty1` let e3 = E::Empty3; //~ ERROR expected value, found struct variant `E::Empty3` - let e3 = E::Empty3(); //~ ERROR expected function, found struct variant `E::Empty3` + let e3 = E::Empty3(); + //~^ ERROR expected function, tuple struct or tuple variant, found struct variant `E::Empty3` let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` - let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1` + let xe1 = XEmpty1(); + //~^ ERROR expected function, tuple struct or tuple variant, found struct `XEmpty1` let xe3 = XE::Empty3; //~ ERROR no variant or associated item named `Empty3` found for type let xe3 = XE::Empty3(); //~ ERROR no variant or associated item named `Empty3` found for type diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr index 9712157552716..f427c1ba0adfb 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.stderr +++ b/src/test/ui/empty/empty-struct-braces-expr.stderr @@ -10,7 +10,7 @@ LL | let e1 = Empty1; | did you mean `Empty1 { /* fields */ }`? | help: a unit struct with a similar name exists: `XEmpty2` -error[E0423]: expected function, found struct `Empty1` +error[E0423]: expected function, tuple struct or tuple variant, found struct `Empty1` --> $DIR/empty-struct-braces-expr.rs:16:14 | LL | struct Empty1 {} @@ -23,7 +23,7 @@ LL | let e1 = Empty1(); | help: a unit struct with a similar name exists: `XEmpty2` error[E0423]: expected value, found struct variant `E::Empty3` - --> $DIR/empty-struct-braces-expr.rs:17:14 + --> $DIR/empty-struct-braces-expr.rs:18:14 | LL | Empty3 {} | --------- `E::Empty3` defined here @@ -31,8 +31,8 @@ LL | Empty3 {} LL | let e3 = E::Empty3; | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? -error[E0423]: expected function, found struct variant `E::Empty3` - --> $DIR/empty-struct-braces-expr.rs:18:14 +error[E0423]: expected function, tuple struct or tuple variant, found struct variant `E::Empty3` + --> $DIR/empty-struct-braces-expr.rs:19:14 | LL | Empty3 {} | --------- `E::Empty3` defined here @@ -41,7 +41,7 @@ LL | let e3 = E::Empty3(); | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0423]: expected value, found struct `XEmpty1` - --> $DIR/empty-struct-braces-expr.rs:20:15 + --> $DIR/empty-struct-braces-expr.rs:22:15 | LL | let xe1 = XEmpty1; | ^^^^^^^ @@ -49,8 +49,8 @@ LL | let xe1 = XEmpty1; | did you mean `XEmpty1 { /* fields */ }`? | help: a unit struct with a similar name exists: `XEmpty2` -error[E0423]: expected function, found struct `XEmpty1` - --> $DIR/empty-struct-braces-expr.rs:21:15 +error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1` + --> $DIR/empty-struct-braces-expr.rs:23:15 | LL | let xe1 = XEmpty1(); | ^^^^^^^ @@ -59,7 +59,7 @@ LL | let xe1 = XEmpty1(); | help: a unit struct with a similar name exists: `XEmpty2` error[E0599]: no variant or associated item named `Empty3` found for type `empty_struct::XE` in the current scope - --> $DIR/empty-struct-braces-expr.rs:22:19 + --> $DIR/empty-struct-braces-expr.rs:25:19 | LL | let xe3 = XE::Empty3; | ^^^^^^ @@ -68,7 +68,7 @@ LL | let xe3 = XE::Empty3; | help: there is a variant with a similar name: `XEmpty3` error[E0599]: no variant or associated item named `Empty3` found for type `empty_struct::XE` in the current scope - --> $DIR/empty-struct-braces-expr.rs:23:19 + --> $DIR/empty-struct-braces-expr.rs:26:19 | LL | let xe3 = XE::Empty3(); | ^^^^^^ @@ -77,7 +77,7 @@ LL | let xe3 = XE::Empty3(); | help: there is a variant with a similar name: `XEmpty3` error: no variant `Empty1` in enum `empty_struct::XE` - --> $DIR/empty-struct-braces-expr.rs:25:9 + --> $DIR/empty-struct-braces-expr.rs:28:9 | LL | XE::Empty1 {}; | ^^^^^^ help: there is a variant with a similar name: `XEmpty3` diff --git a/src/test/ui/empty/empty-struct-braces-pat-1.rs b/src/test/ui/empty/empty-struct-braces-pat-1.rs index 81062320fe47c..9bed93f9c1536 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-1.rs +++ b/src/test/ui/empty/empty-struct-braces-pat-1.rs @@ -22,13 +22,13 @@ fn main() { } match e3 { E::Empty3 => () - //~^ ERROR expected unit struct/variant or constant, found struct variant `E::Empty3` + //~^ ERROR expected unit struct, unit variant or constant, found struct variant `E::Empty3` } match xe1 { XEmpty1 => () // Not an error, `XEmpty1` is interpreted as a new binding } match xe3 { XE::XEmpty3 => () - //~^ ERROR expected unit struct/variant or constant, found struct variant `XE::XEmpty3` + //~^ ERROR expected unit struct, unit variant or constant, found struct variant `XE::XEmpty3` } } diff --git a/src/test/ui/empty/empty-struct-braces-pat-1.stderr b/src/test/ui/empty/empty-struct-braces-pat-1.stderr index 271e811a2fd65..9b5f31157d1bb 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-1.stderr +++ b/src/test/ui/empty/empty-struct-braces-pat-1.stderr @@ -1,4 +1,4 @@ -error[E0532]: expected unit struct/variant or constant, found struct variant `E::Empty3` +error[E0532]: expected unit struct, unit variant or constant, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-pat-1.rs:24:9 | LL | Empty3 {} @@ -7,7 +7,7 @@ LL | Empty3 {} LL | E::Empty3 => () | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? -error[E0532]: expected unit struct/variant or constant, found struct variant `XE::XEmpty3` +error[E0532]: expected unit struct, unit variant or constant, found struct variant `XE::XEmpty3` --> $DIR/empty-struct-braces-pat-1.rs:31:9 | LL | XE::XEmpty3 => () diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.rs b/src/test/ui/empty/empty-struct-braces-pat-2.rs index 187d953d805e1..cfe4641f35604 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-2.rs +++ b/src/test/ui/empty/empty-struct-braces-pat-2.rs @@ -12,15 +12,15 @@ fn main() { let xe1 = XEmpty1 {}; match e1 { - Empty1() => () //~ ERROR expected tuple struct/variant, found struct `Empty1` + Empty1() => () //~ ERROR expected tuple struct or tuple variant, found struct `Empty1` } match xe1 { - XEmpty1() => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` + XEmpty1() => () //~ ERROR expected tuple struct or tuple variant, found struct `XEmpty1` } match e1 { - Empty1(..) => () //~ ERROR expected tuple struct/variant, found struct `Empty1` + Empty1(..) => () //~ ERROR expected tuple struct or tuple variant, found struct `Empty1` } match xe1 { - XEmpty1(..) => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` + XEmpty1(..) => () //~ ERROR expected tuple struct or tuple variant, found struct `XEmpty1` } } diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.stderr b/src/test/ui/empty/empty-struct-braces-pat-2.stderr index 3352473788894..0b3c9ae51519e 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-2.stderr +++ b/src/test/ui/empty/empty-struct-braces-pat-2.stderr @@ -1,4 +1,4 @@ -error[E0532]: expected tuple struct/variant, found struct `Empty1` +error[E0532]: expected tuple struct or tuple variant, found struct `Empty1` --> $DIR/empty-struct-braces-pat-2.rs:15:9 | LL | struct Empty1 {} @@ -10,7 +10,7 @@ LL | Empty1() => () | did you mean `Empty1 { /* fields */ }`? | help: a tuple struct with a similar name exists: `XEmpty6` -error[E0532]: expected tuple struct/variant, found struct `XEmpty1` +error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1` --> $DIR/empty-struct-braces-pat-2.rs:18:9 | LL | XEmpty1() => () @@ -19,7 +19,7 @@ LL | XEmpty1() => () | did you mean `XEmpty1 { /* fields */ }`? | help: a tuple struct with a similar name exists: `XEmpty6` -error[E0532]: expected tuple struct/variant, found struct `Empty1` +error[E0532]: expected tuple struct or tuple variant, found struct `Empty1` --> $DIR/empty-struct-braces-pat-2.rs:21:9 | LL | struct Empty1 {} @@ -31,7 +31,7 @@ LL | Empty1(..) => () | did you mean `Empty1 { /* fields */ }`? | help: a tuple struct with a similar name exists: `XEmpty6` -error[E0532]: expected tuple struct/variant, found struct `XEmpty1` +error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1` --> $DIR/empty-struct-braces-pat-2.rs:24:9 | LL | XEmpty1(..) => () diff --git a/src/test/ui/empty/empty-struct-braces-pat-3.rs b/src/test/ui/empty/empty-struct-braces-pat-3.rs index fad28d78fe557..54d547eefcc95 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-3.rs +++ b/src/test/ui/empty/empty-struct-braces-pat-3.rs @@ -15,18 +15,18 @@ fn main() { match e3 { E::Empty3() => () - //~^ ERROR expected tuple struct/variant, found struct variant `E::Empty3` + //~^ ERROR expected tuple struct or tuple variant, found struct variant `E::Empty3` } match xe3 { XE::XEmpty3() => () - //~^ ERROR expected tuple struct/variant, found struct variant `XE::XEmpty3` + //~^ ERROR expected tuple struct or tuple variant, found struct variant `XE::XEmpty3` } match e3 { E::Empty3(..) => () - //~^ ERROR expected tuple struct/variant, found struct variant `E::Empty3` + //~^ ERROR expected tuple struct or tuple variant, found struct variant `E::Empty3` } match xe3 { XE::XEmpty3(..) => () - //~^ ERROR expected tuple struct/variant, found struct variant `XE::XEmpty3 + //~^ ERROR expected tuple struct or tuple variant, found struct variant `XE::XEmpty3 } } diff --git a/src/test/ui/empty/empty-struct-braces-pat-3.stderr b/src/test/ui/empty/empty-struct-braces-pat-3.stderr index aefdd772b1bfd..785396c448bb0 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-3.stderr +++ b/src/test/ui/empty/empty-struct-braces-pat-3.stderr @@ -1,4 +1,4 @@ -error[E0532]: expected tuple struct/variant, found struct variant `E::Empty3` +error[E0532]: expected tuple struct or tuple variant, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-pat-3.rs:17:9 | LL | Empty3 {} @@ -7,7 +7,7 @@ LL | Empty3 {} LL | E::Empty3() => () | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? -error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3` +error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3` --> $DIR/empty-struct-braces-pat-3.rs:21:9 | LL | XE::XEmpty3() => () @@ -16,7 +16,7 @@ LL | XE::XEmpty3() => () | | help: a tuple variant with a similar name exists: `XEmpty5` | did you mean `XE::XEmpty3 { /* fields */ }`? -error[E0532]: expected tuple struct/variant, found struct variant `E::Empty3` +error[E0532]: expected tuple struct or tuple variant, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-pat-3.rs:25:9 | LL | Empty3 {} @@ -25,7 +25,7 @@ LL | Empty3 {} LL | E::Empty3(..) => () | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? -error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3` +error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3` --> $DIR/empty-struct-braces-pat-3.rs:29:9 | LL | XE::XEmpty3(..) => () diff --git a/src/test/ui/empty/empty-struct-tuple-pat.rs b/src/test/ui/empty/empty-struct-tuple-pat.rs index 00a48594e93af..47da8a306a4b2 100644 --- a/src/test/ui/empty/empty-struct-tuple-pat.rs +++ b/src/test/ui/empty/empty-struct-tuple-pat.rs @@ -27,11 +27,11 @@ fn main() { match e4 { E::Empty4 => () - //~^ ERROR expected unit struct/variant or constant, found tuple variant `E::Empty4` + //~^ ERROR expected unit struct, unit variant or constant, found tuple variant `E::Empty4` } match xe5 { XE::XEmpty5 => (), - //~^ ERROR expected unit struct/variant or constant, found tuple variant `XE::XEmpty5` + //~^ ERROR expected unit struct, unit variant or constant, found tuple variant `XE::XEmpty5` _ => {}, } } diff --git a/src/test/ui/empty/empty-struct-tuple-pat.stderr b/src/test/ui/empty/empty-struct-tuple-pat.stderr index 4b828c0d942e3..cfbb468e5e633 100644 --- a/src/test/ui/empty/empty-struct-tuple-pat.stderr +++ b/src/test/ui/empty/empty-struct-tuple-pat.stderr @@ -16,7 +16,7 @@ LL | use empty_struct::*; LL | XEmpty6 => () | ^^^^^^^ cannot be named the same as a tuple struct -error[E0532]: expected unit struct/variant or constant, found tuple variant `E::Empty4` +error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E::Empty4` --> $DIR/empty-struct-tuple-pat.rs:29:9 | LL | Empty4() @@ -25,7 +25,7 @@ LL | Empty4() LL | E::Empty4 => () | ^^^^^^^^^ did you mean `E::Empty4( /* fields */ )`? -error[E0532]: expected unit struct/variant or constant, found tuple variant `XE::XEmpty5` +error[E0532]: expected unit struct, unit variant or constant, found tuple variant `XE::XEmpty5` --> $DIR/empty-struct-tuple-pat.rs:33:9 | LL | XE::XEmpty5 => (), diff --git a/src/test/ui/empty/empty-struct-unit-pat.rs b/src/test/ui/empty/empty-struct-unit-pat.rs index 8a0e2f505e443..44a1e9e3d93bc 100644 --- a/src/test/ui/empty/empty-struct-unit-pat.rs +++ b/src/test/ui/empty/empty-struct-unit-pat.rs @@ -18,32 +18,37 @@ fn main() { let xe4 = XE::XEmpty4; match e2 { - Empty2() => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2` + Empty2() => () //~ ERROR expected tuple struct or tuple variant, found unit struct `Empty2` } match xe2 { - XEmpty2() => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2` + XEmpty2() => () + //~^ ERROR expected tuple struct or tuple variant, found unit struct `XEmpty2` } match e2 { - Empty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2` + Empty2(..) => () + //~^ ERROR expected tuple struct or tuple variant, found unit struct `Empty2` } match xe2 { - XEmpty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2` + XEmpty2(..) => () + //~^ ERROR expected tuple struct or tuple variant, found unit struct `XEmpty2` } match e4 { - E::Empty4() => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4` + E::Empty4() => () + //~^ ERROR expected tuple struct or tuple variant, found unit variant `E::Empty4` } match xe4 { XE::XEmpty4() => (), - //~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4` + //~^ ERROR expected tuple struct or tuple variant, found unit variant `XE::XEmpty4` _ => {}, } match e4 { - E::Empty4(..) => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4` + E::Empty4(..) => () + //~^ ERROR expected tuple struct or tuple variant, found unit variant `E::Empty4` } match xe4 { XE::XEmpty4(..) => (), - //~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4` + //~^ ERROR expected tuple struct or tuple variant, found unit variant `XE::XEmpty4` _ => {}, } } diff --git a/src/test/ui/empty/empty-struct-unit-pat.stderr b/src/test/ui/empty/empty-struct-unit-pat.stderr index 268fc7a6e0c19..fd41a6ed38284 100644 --- a/src/test/ui/empty/empty-struct-unit-pat.stderr +++ b/src/test/ui/empty/empty-struct-unit-pat.stderr @@ -1,49 +1,49 @@ -error[E0532]: expected tuple struct/variant, found unit struct `Empty2` +error[E0532]: expected tuple struct or tuple variant, found unit struct `Empty2` --> $DIR/empty-struct-unit-pat.rs:21:9 | LL | Empty2() => () | ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` -error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2` +error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2` --> $DIR/empty-struct-unit-pat.rs:24:9 | LL | XEmpty2() => () | ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` -error[E0532]: expected tuple struct/variant, found unit struct `Empty2` - --> $DIR/empty-struct-unit-pat.rs:27:9 +error[E0532]: expected tuple struct or tuple variant, found unit struct `Empty2` + --> $DIR/empty-struct-unit-pat.rs:28:9 | LL | Empty2(..) => () | ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` -error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2` - --> $DIR/empty-struct-unit-pat.rs:30:9 +error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2` + --> $DIR/empty-struct-unit-pat.rs:32:9 | LL | XEmpty2(..) => () | ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` -error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4` - --> $DIR/empty-struct-unit-pat.rs:34:9 +error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4` + --> $DIR/empty-struct-unit-pat.rs:37:9 | LL | E::Empty4() => () - | ^^^^^^^^^ not a tuple struct/variant + | ^^^^^^^^^ not a tuple struct or tuple variant -error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4` - --> $DIR/empty-struct-unit-pat.rs:37:9 +error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XEmpty4` + --> $DIR/empty-struct-unit-pat.rs:41:9 | LL | XE::XEmpty4() => (), | ^^^^------- | | | help: a tuple variant with a similar name exists: `XEmpty5` -error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4` - --> $DIR/empty-struct-unit-pat.rs:42:9 +error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4` + --> $DIR/empty-struct-unit-pat.rs:46:9 | LL | E::Empty4(..) => () - | ^^^^^^^^^ not a tuple struct/variant + | ^^^^^^^^^ not a tuple struct or tuple variant -error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4` - --> $DIR/empty-struct-unit-pat.rs:45:9 +error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XEmpty4` + --> $DIR/empty-struct-unit-pat.rs:50:9 | LL | XE::XEmpty4(..) => (), | ^^^^------- diff --git a/src/test/ui/enums-pats-not-idents.rs b/src/test/ui/enums-pats-not-idents.rs index 1593f1e1b16ef..5b918eef6d65b 100644 --- a/src/test/ui/enums-pats-not-idents.rs +++ b/src/test/ui/enums-pats-not-idents.rs @@ -1,3 +1,3 @@ fn main() { - let a(1) = 13; //~ ERROR cannot find tuple struct/variant `a` in this scope + let a(1) = 13; //~ ERROR cannot find tuple struct or tuple variant `a` in this scope } diff --git a/src/test/ui/enums-pats-not-idents.stderr b/src/test/ui/enums-pats-not-idents.stderr index 6b1e6046260a9..072b88716ad7c 100644 --- a/src/test/ui/enums-pats-not-idents.stderr +++ b/src/test/ui/enums-pats-not-idents.stderr @@ -1,4 +1,4 @@ -error[E0531]: cannot find tuple struct/variant `a` in this scope +error[E0531]: cannot find tuple struct or tuple variant `a` in this scope --> $DIR/enums-pats-not-idents.rs:2:9 | LL | let a(1) = 13; diff --git a/src/test/ui/error-codes/E0164.stderr b/src/test/ui/error-codes/E0164.stderr index 0a153d85b4215..4bbddb1978cc5 100644 --- a/src/test/ui/error-codes/E0164.stderr +++ b/src/test/ui/error-codes/E0164.stderr @@ -1,4 +1,4 @@ -error[E0164]: expected tuple struct/variant, found associated constant `::B` +error[E0164]: expected tuple struct or tuple variant, found associated constant `::B` --> $DIR/E0164.rs:9:9 | LL | Foo::B(i) => i, diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr index 4e016dbd1c029..09792845d162c 100644 --- a/src/test/ui/error-codes/E0423.stderr +++ b/src/test/ui/error-codes/E0423.stderr @@ -26,17 +26,23 @@ help: surround the struct literal with parentheses LL | for _ in (std::ops::Range { start: 0, end: 10 }) {} | ^ ^ -error[E0423]: expected function, found struct `Foo` +error[E0423]: expected function, tuple struct or tuple variant, found struct `Foo` --> $DIR/E0423.rs:4:13 | -LL | struct Foo { a: bool }; - | ---------------------- `Foo` defined here +LL | struct Foo { a: bool }; + | ---------------------- `Foo` defined here LL | -LL | let f = Foo(); - | ^^^ - | | - | did you mean `Foo { /* fields */ }`? - | help: a function with a similar name exists (notice the capitalization): `foo` +LL | let f = Foo(); + | ^^^ + | | + | did you mean `Foo { /* fields */ }`? + | help: a function with a similar name exists (notice the capitalization): `foo` +... +LL | / fn foo() { +LL | | for _ in std::ops::Range { start: 0, end: 10 } {} +LL | | +LL | | } + | |_- similarly named function `foo` defined here error[E0423]: expected value, found struct `T` --> $DIR/E0423.rs:14:8 diff --git a/src/test/ui/error-codes/E0424.stderr b/src/test/ui/error-codes/E0424.stderr index 567d1b3cc75f4..690a101496d73 100644 --- a/src/test/ui/error-codes/E0424.stderr +++ b/src/test/ui/error-codes/E0424.stderr @@ -7,7 +7,7 @@ LL | | self.bar(); LL | | } | |_____- this function doesn't have a `self` parameter -error[E0424]: expected unit struct/variant or constant, found module `self` +error[E0424]: expected unit struct, unit variant or constant, found module `self` --> $DIR/E0424.rs:12:9 | LL | / fn main () { diff --git a/src/test/ui/error-codes/E0532.rs b/src/test/ui/error-codes/E0532.rs index 931ca4628fe1d..486da0e029ef3 100644 --- a/src/test/ui/error-codes/E0532.rs +++ b/src/test/ui/error-codes/E0532.rs @@ -3,7 +3,7 @@ fn main() { match SomeStruct(value) { StructConst1(_) => { }, - //~^ ERROR expected tuple struct/variant, found constant `StructConst1` + //~^ ERROR expected tuple struct or tuple variant, found constant `StructConst1` _ => { }, } diff --git a/src/test/ui/error-codes/E0532.stderr b/src/test/ui/error-codes/E0532.stderr index 887ede0a4124b..eeccadccc636a 100644 --- a/src/test/ui/error-codes/E0532.stderr +++ b/src/test/ui/error-codes/E0532.stderr @@ -1,8 +1,8 @@ -error[E0532]: expected tuple struct/variant, found constant `StructConst1` +error[E0532]: expected tuple struct or tuple variant, found constant `StructConst1` --> $DIR/E0532.rs:5:9 | LL | StructConst1(_) => { }, - | ^^^^^^^^^^^^ not a tuple struct/variant + | ^^^^^^^^^^^^ not a tuple struct or tuple variant error: aborting due to previous error diff --git a/src/test/ui/fn-in-pat.rs b/src/test/ui/fn-in-pat.rs index ed76b2c5db025..b83252012b8f8 100644 --- a/src/test/ui/fn-in-pat.rs +++ b/src/test/ui/fn-in-pat.rs @@ -8,7 +8,7 @@ fn hof(_: F) where F: FnMut(()) {} fn ice() { hof(|c| match c { - A::new() => (), //~ ERROR expected tuple struct/variant, found method + A::new() => (), //~ ERROR expected tuple struct or tuple variant, found method _ => () }) } diff --git a/src/test/ui/fn-in-pat.stderr b/src/test/ui/fn-in-pat.stderr index 0bb24365ef42b..70f84993acfe7 100644 --- a/src/test/ui/fn-in-pat.stderr +++ b/src/test/ui/fn-in-pat.stderr @@ -1,4 +1,4 @@ -error[E0164]: expected tuple struct/variant, found method `::new` +error[E0164]: expected tuple struct or tuple variant, found method `::new` --> $DIR/fn-in-pat.rs:11:9 | LL | A::new() => (), diff --git a/src/test/ui/glob-resolve1.stderr b/src/test/ui/glob-resolve1.stderr index ddd1e0954893f..3db24431586da 100644 --- a/src/test/ui/glob-resolve1.stderr +++ b/src/test/ui/glob-resolve1.stderr @@ -46,6 +46,9 @@ LL | import(); error[E0412]: cannot find type `A` in this scope --> $DIR/glob-resolve1.rs:28:11 | +LL | pub enum B { B1 } + | ----------------- similarly named enum `B` defined here +... LL | foo::(); | ^ | @@ -61,6 +64,9 @@ LL | use bar::A; error[E0412]: cannot find type `C` in this scope --> $DIR/glob-resolve1.rs:29:11 | +LL | pub enum B { B1 } + | ----------------- similarly named enum `B` defined here +... LL | foo::(); | ^ | @@ -76,6 +82,9 @@ LL | use bar::C; error[E0412]: cannot find type `D` in this scope --> $DIR/glob-resolve1.rs:30:11 | +LL | pub enum B { B1 } + | ----------------- similarly named enum `B` defined here +... LL | foo::(); | ^ | diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs index 6ff3ab73639c0..ce8c2d5168fbb 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs @@ -1,3 +1,5 @@ +// ignore-x86 +// ^ due to stderr output differences // aux-build:two_macros.rs macro_rules! define_vec { diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr index e8dfd43b6767c..8e01fc8df3def 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr @@ -1,5 +1,5 @@ error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:19:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:21:9 | LL | extern crate std as core; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,20 +8,24 @@ LL | define_other_core!(); | --------------------- in this macro invocation error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:13:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:15:9 | LL | Vec::panic!(); | ^^^ ambiguous name | - = note: `Vec` could refer to a struct from prelude -note: `Vec` could also refer to the crate imported here - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:5:9 +note: `Vec` could refer to the crate imported here + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:7:9 | LL | extern crate std as Vec; | ^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | define_vec!(); | -------------- in this macro invocation +note: `Vec` could also refer to the struct defined here + --> $SRC_DIR/libstd/prelude/v1.rs:LL:COL + | +LL | pub use crate::vec::Vec; + | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-10200.rs b/src/test/ui/issues/issue-10200.rs index 12867a878f310..fe36a7e00bff3 100644 --- a/src/test/ui/issues/issue-10200.rs +++ b/src/test/ui/issues/issue-10200.rs @@ -3,7 +3,7 @@ fn foo(_: usize) -> Foo { Foo(false) } fn main() { match Foo(true) { - foo(x) //~ ERROR expected tuple struct/variant, found function `foo` + foo(x) //~ ERROR expected tuple struct or tuple variant, found function `foo` => () } } diff --git a/src/test/ui/issues/issue-10200.stderr b/src/test/ui/issues/issue-10200.stderr index b1057d45869a8..e60489f5b82f4 100644 --- a/src/test/ui/issues/issue-10200.stderr +++ b/src/test/ui/issues/issue-10200.stderr @@ -1,6 +1,9 @@ -error[E0532]: expected tuple struct/variant, found function `foo` +error[E0532]: expected tuple struct or tuple variant, found function `foo` --> $DIR/issue-10200.rs:6:9 | +LL | struct Foo(bool); + | ----------------- similarly named tuple struct `Foo` defined here +... LL | foo(x) | ^^^ help: a tuple struct with a similar name exists (notice the capitalization): `Foo` diff --git a/src/test/ui/issues/issue-12863.rs b/src/test/ui/issues/issue-12863.rs index d7941a70d51fd..1ac1c3d818e58 100644 --- a/src/test/ui/issues/issue-12863.rs +++ b/src/test/ui/issues/issue-12863.rs @@ -2,6 +2,7 @@ mod foo { pub fn bar() {} } fn main() { match () { - foo::bar => {} //~ ERROR expected unit struct/variant or constant, found function `foo::bar` + foo::bar => {} + //~^ ERROR expected unit struct, unit variant or constant, found function `foo::bar` } } diff --git a/src/test/ui/issues/issue-12863.stderr b/src/test/ui/issues/issue-12863.stderr index bec70a5fb95a2..9c29a37cb930b 100644 --- a/src/test/ui/issues/issue-12863.stderr +++ b/src/test/ui/issues/issue-12863.stderr @@ -1,8 +1,8 @@ -error[E0532]: expected unit struct/variant or constant, found function `foo::bar` +error[E0532]: expected unit struct, unit variant or constant, found function `foo::bar` --> $DIR/issue-12863.rs:5:9 | LL | foo::bar => {} - | ^^^^^^^^ not a unit struct/variant or constant + | ^^^^^^^^ not a unit struct, unit variant or constant error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17933.rs b/src/test/ui/issues/issue-17933.rs index c649b64dcd44a..6da4e6e15284b 100644 --- a/src/test/ui/issues/issue-17933.rs +++ b/src/test/ui/issues/issue-17933.rs @@ -3,7 +3,7 @@ pub static X: usize = 1; fn main() { match 1 { self::X => { }, - //~^ ERROR expected unit struct/variant or constant, found static `self::X` + //~^ ERROR expected unit struct, unit variant or constant, found static `self::X` _ => { }, } } diff --git a/src/test/ui/issues/issue-17933.stderr b/src/test/ui/issues/issue-17933.stderr index e48a65087f4a3..33534d3f8f6a9 100644 --- a/src/test/ui/issues/issue-17933.stderr +++ b/src/test/ui/issues/issue-17933.stderr @@ -1,8 +1,8 @@ -error[E0532]: expected unit struct/variant or constant, found static `self::X` +error[E0532]: expected unit struct, unit variant or constant, found static `self::X` --> $DIR/issue-17933.rs:5:9 | LL | self::X => { }, - | ^^^^^^^ not a unit struct/variant or constant + | ^^^^^^^ not a unit struct, unit variant or constant error: aborting due to previous error diff --git a/src/test/ui/issues/issue-19086.rs b/src/test/ui/issues/issue-19086.rs index 9802814a87a51..cc83874cb16c2 100644 --- a/src/test/ui/issues/issue-19086.rs +++ b/src/test/ui/issues/issue-19086.rs @@ -8,6 +8,6 @@ fn main() { let f = FooB { x: 3, y: 4 }; match f { FooB(a, b) => println!("{} {}", a, b), - //~^ ERROR expected tuple struct/variant, found struct variant `FooB` + //~^ ERROR expected tuple struct or tuple variant, found struct variant `FooB` } } diff --git a/src/test/ui/issues/issue-19086.stderr b/src/test/ui/issues/issue-19086.stderr index e2229cbc20922..27992da0ebd2f 100644 --- a/src/test/ui/issues/issue-19086.stderr +++ b/src/test/ui/issues/issue-19086.stderr @@ -1,4 +1,4 @@ -error[E0532]: expected tuple struct/variant, found struct variant `FooB` +error[E0532]: expected tuple struct or tuple variant, found struct variant `FooB` --> $DIR/issue-19086.rs:10:9 | LL | FooB { x: i32, y: i32 } diff --git a/src/test/ui/issues/issue-27033.rs b/src/test/ui/issues/issue-27033.rs index a23819a20f9aa..bcb06d743a05d 100644 --- a/src/test/ui/issues/issue-27033.rs +++ b/src/test/ui/issues/issue-27033.rs @@ -1,3 +1,5 @@ +// ignore-x86 +// ^ due to stderr output differences fn main() { match Some(1) { None @ _ => {} //~ ERROR match bindings cannot shadow unit variants diff --git a/src/test/ui/issues/issue-27033.stderr b/src/test/ui/issues/issue-27033.stderr index ab95433228037..a4baa7bdf7f85 100644 --- a/src/test/ui/issues/issue-27033.stderr +++ b/src/test/ui/issues/issue-27033.stderr @@ -1,11 +1,16 @@ error[E0530]: match bindings cannot shadow unit variants - --> $DIR/issue-27033.rs:3:9 + --> $DIR/issue-27033.rs:5:9 | LL | None @ _ => {} | ^^^^ cannot be named the same as a unit variant + | + ::: $SRC_DIR/libstd/prelude/v1.rs:LL:COL + | +LL | pub use crate::option::Option::{self, Some, None}; + | ---- the unit variant `None` is defined here error[E0530]: match bindings cannot shadow constants - --> $DIR/issue-27033.rs:7:9 + --> $DIR/issue-27033.rs:9:9 | LL | const C: u8 = 1; | ---------------- the constant `C` is defined here diff --git a/src/test/ui/issues/issue-28992-empty.rs b/src/test/ui/issues/issue-28992-empty.rs index 22961fc61d134..f61daa94c5d72 100644 --- a/src/test/ui/issues/issue-28992-empty.rs +++ b/src/test/ui/issues/issue-28992-empty.rs @@ -10,7 +10,7 @@ impl S { } fn main() { - if let C1(..) = 0 {} //~ ERROR expected tuple struct/variant, found constant `C1` + if let C1(..) = 0 {} //~ ERROR expected tuple struct or tuple variant, found constant `C1` if let S::C2(..) = 0 {} - //~^ ERROR expected tuple struct/variant, found associated constant `::C2` + //~^ ERROR expected tuple struct or tuple variant, found associated constant `::C2` } diff --git a/src/test/ui/issues/issue-28992-empty.stderr b/src/test/ui/issues/issue-28992-empty.stderr index 9f9f574aa5dd4..a4311880bcbe9 100644 --- a/src/test/ui/issues/issue-28992-empty.stderr +++ b/src/test/ui/issues/issue-28992-empty.stderr @@ -1,10 +1,10 @@ -error[E0532]: expected tuple struct/variant, found constant `C1` +error[E0532]: expected tuple struct or tuple variant, found constant `C1` --> $DIR/issue-28992-empty.rs:13:12 | LL | if let C1(..) = 0 {} - | ^^ not a tuple struct/variant + | ^^ not a tuple struct or tuple variant -error[E0164]: expected tuple struct/variant, found associated constant `::C2` +error[E0164]: expected tuple struct or tuple variant, found associated constant `::C2` --> $DIR/issue-28992-empty.rs:14:12 | LL | if let S::C2(..) = 0 {} diff --git a/src/test/ui/issues/issue-31845.stderr b/src/test/ui/issues/issue-31845.stderr index 10cb398cb24f1..75d8859961a04 100644 --- a/src/test/ui/issues/issue-31845.stderr +++ b/src/test/ui/issues/issue-31845.stderr @@ -1,8 +1,11 @@ error[E0425]: cannot find function `g` in this scope --> $DIR/issue-31845.rs:7:12 | -LL | g(); - | ^ help: a function with a similar name exists: `h` +LL | / fn h() { +LL | | g(); + | | ^ help: a function with a similar name exists: `h` +LL | | } + | |_________- similarly named function `h` defined here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-32004.rs b/src/test/ui/issues/issue-32004.rs index aeddb00e2b04c..b3493508c5a9f 100644 --- a/src/test/ui/issues/issue-32004.rs +++ b/src/test/ui/issues/issue-32004.rs @@ -8,12 +8,12 @@ struct S; fn main() { match Foo::Baz { Foo::Bar => {} - //~^ ERROR expected unit struct/variant or constant, found tuple variant `Foo::Bar` + //~^ ERROR expected unit struct, unit variant or constant, found tuple variant `Foo::Bar` _ => {} } match S { S(()) => {} - //~^ ERROR expected tuple struct/variant, found unit struct `S` + //~^ ERROR expected tuple struct or tuple variant, found unit struct `S` } } diff --git a/src/test/ui/issues/issue-32004.stderr b/src/test/ui/issues/issue-32004.stderr index e9a5e217392a6..ab723e26680dc 100644 --- a/src/test/ui/issues/issue-32004.stderr +++ b/src/test/ui/issues/issue-32004.stderr @@ -1,8 +1,10 @@ -error[E0532]: expected unit struct/variant or constant, found tuple variant `Foo::Bar` +error[E0532]: expected unit struct, unit variant or constant, found tuple variant `Foo::Bar` --> $DIR/issue-32004.rs:10:9 | LL | Bar(i32), | -------- `Foo::Bar` defined here +LL | Baz + | --- similarly named unit variant `Baz` defined here ... LL | Foo::Bar => {} | ^^^^^--- @@ -10,11 +12,11 @@ LL | Foo::Bar => {} | | help: a unit variant with a similar name exists: `Baz` | did you mean `Foo::Bar( /* fields */ )`? -error[E0532]: expected tuple struct/variant, found unit struct `S` +error[E0532]: expected tuple struct or tuple variant, found unit struct `S` --> $DIR/issue-32004.rs:16:9 | LL | S(()) => {} - | ^ not a tuple struct/variant + | ^ not a tuple struct or tuple variant error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-32086.rs b/src/test/ui/issues/issue-32086.rs index 3188377584dc0..d595d1dd7e6d1 100644 --- a/src/test/ui/issues/issue-32086.rs +++ b/src/test/ui/issues/issue-32086.rs @@ -2,6 +2,6 @@ struct S(u8); const C: S = S(10); fn main() { - let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C` - let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C` + let C(a) = S(11); //~ ERROR expected tuple struct or tuple variant, found constant `C` + let C(..) = S(11); //~ ERROR expected tuple struct or tuple variant, found constant `C` } diff --git a/src/test/ui/issues/issue-32086.stderr b/src/test/ui/issues/issue-32086.stderr index b5a120c4b9cee..e566dea89088d 100644 --- a/src/test/ui/issues/issue-32086.stderr +++ b/src/test/ui/issues/issue-32086.stderr @@ -1,12 +1,18 @@ -error[E0532]: expected tuple struct/variant, found constant `C` +error[E0532]: expected tuple struct or tuple variant, found constant `C` --> $DIR/issue-32086.rs:5:9 | +LL | struct S(u8); + | ------------- similarly named tuple struct `S` defined here +... LL | let C(a) = S(11); | ^ help: a tuple struct with a similar name exists: `S` -error[E0532]: expected tuple struct/variant, found constant `C` +error[E0532]: expected tuple struct or tuple variant, found constant `C` --> $DIR/issue-32086.rs:6:9 | +LL | struct S(u8); + | ------------- similarly named tuple struct `S` defined here +... LL | let C(..) = S(11); | ^ help: a tuple struct with a similar name exists: `S` diff --git a/src/test/ui/issues/issue-35675.rs b/src/test/ui/issues/issue-35675.rs index fae5cdc0733f1..7876811a9ac39 100644 --- a/src/test/ui/issues/issue-35675.rs +++ b/src/test/ui/issues/issue-35675.rs @@ -7,13 +7,13 @@ enum Fruit { fn should_return_fruit() -> Apple { //~^ ERROR cannot find type `Apple` in this scope Apple(5) - //~^ ERROR cannot find function `Apple` in this scope + //~^ ERROR cannot find function, tuple struct or tuple variant `Apple` in this scope } fn should_return_fruit_too() -> Fruit::Apple { //~^ ERROR expected type, found variant `Fruit::Apple` Apple(5) - //~^ ERROR cannot find function `Apple` in this scope + //~^ ERROR cannot find function, tuple struct or tuple variant `Apple` in this scope } fn foo() -> Ok { diff --git a/src/test/ui/issues/issue-35675.stderr b/src/test/ui/issues/issue-35675.stderr index 8072141aefd20..a9a27da55b1a1 100644 --- a/src/test/ui/issues/issue-35675.stderr +++ b/src/test/ui/issues/issue-35675.stderr @@ -9,7 +9,7 @@ help: there is an enum variant `Fruit::Apple`; try using the variant's enum LL | fn should_return_fruit() -> Fruit { | ^^^^^ -error[E0425]: cannot find function `Apple` in this scope +error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in this scope --> $DIR/issue-35675.rs:9:5 | LL | Apple(5) @@ -29,7 +29,7 @@ LL | fn should_return_fruit_too() -> Fruit::Apple { | not a type | help: try using the variant's enum: `Fruit` -error[E0425]: cannot find function `Apple` in this scope +error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in this scope --> $DIR/issue-35675.rs:15:5 | LL | Apple(5) diff --git a/src/test/ui/issues/issue-38412.rs b/src/test/ui/issues/issue-38412.rs index a7c818d9bcb70..058e1be756577 100644 --- a/src/test/ui/issues/issue-38412.rs +++ b/src/test/ui/issues/issue-38412.rs @@ -1,6 +1,6 @@ fn main() { let Box(a) = loop { }; - //~^ ERROR expected tuple struct/variant, found struct `Box` + //~^ ERROR expected tuple struct or tuple variant, found struct `Box` // (The below is a trick to allow compiler to infer a type for // variable `a` without attempting to ascribe a type to the diff --git a/src/test/ui/issues/issue-38412.stderr b/src/test/ui/issues/issue-38412.stderr index c44a0bfc8b027..318c92ad35fc5 100644 --- a/src/test/ui/issues/issue-38412.stderr +++ b/src/test/ui/issues/issue-38412.stderr @@ -1,4 +1,4 @@ -error[E0532]: expected tuple struct/variant, found struct `Box` +error[E0532]: expected tuple struct or tuple variant, found struct `Box` --> $DIR/issue-38412.rs:2:9 | LL | let Box(a) = loop { }; diff --git a/src/test/ui/issues/issue-42944.rs b/src/test/ui/issues/issue-42944.rs index 9d746673f4dae..cc365dc4c938e 100644 --- a/src/test/ui/issues/issue-42944.rs +++ b/src/test/ui/issues/issue-42944.rs @@ -6,13 +6,15 @@ mod bar { use foo::B; fn foo() { - B(()); //~ ERROR expected function, found struct `B` [E0423] + B(()); + //~^ ERROR expected function, tuple struct or tuple variant, found struct `B` [E0423] } } mod baz { fn foo() { - B(()); //~ ERROR cannot find function `B` in this scope [E0425] + B(()); + //~^ ERROR cannot find function, tuple struct or tuple variant `B` in this scope [E0425] } } diff --git a/src/test/ui/issues/issue-42944.stderr b/src/test/ui/issues/issue-42944.stderr index 4ab272b9e9b3b..c71194f41c114 100644 --- a/src/test/ui/issues/issue-42944.stderr +++ b/src/test/ui/issues/issue-42944.stderr @@ -1,11 +1,11 @@ -error[E0423]: expected function, found struct `B` +error[E0423]: expected function, tuple struct or tuple variant, found struct `B` --> $DIR/issue-42944.rs:9:9 | LL | B(()); | ^ constructor is not visible here due to private fields -error[E0425]: cannot find function `B` in this scope - --> $DIR/issue-42944.rs:15:9 +error[E0425]: cannot find function, tuple struct or tuple variant `B` in this scope + --> $DIR/issue-42944.rs:16:9 | LL | B(()); | ^ not found in this scope diff --git a/src/test/ui/issues/issue-46332.stderr b/src/test/ui/issues/issue-46332.stderr index c7e9d71700e6d..5d8a859a7379c 100644 --- a/src/test/ui/issues/issue-46332.stderr +++ b/src/test/ui/issues/issue-46332.stderr @@ -1,6 +1,9 @@ error[E0422]: cannot find struct, variant or union type `TyUInt` in this scope --> $DIR/issue-46332.rs:9:5 | +LL | struct TyUint {} + | ---------------- similarly named struct `TyUint` defined here +... LL | TyUInt {}; | ^^^^^^ help: a struct with a similar name exists (notice the capitalization): `TyUint` diff --git a/src/test/ui/issues/issue-55587.rs b/src/test/ui/issues/issue-55587.rs index 8b78749f6529a..d9100cf555b3c 100644 --- a/src/test/ui/issues/issue-55587.rs +++ b/src/test/ui/issues/issue-55587.rs @@ -1,5 +1,5 @@ use std::path::Path; fn main() { - let Path::new(); //~ ERROR expected tuple struct/variant + let Path::new(); //~ ERROR expected tuple struct or tuple variant } diff --git a/src/test/ui/issues/issue-55587.stderr b/src/test/ui/issues/issue-55587.stderr index 3928a3cd53201..307227e1c4d10 100644 --- a/src/test/ui/issues/issue-55587.stderr +++ b/src/test/ui/issues/issue-55587.stderr @@ -1,4 +1,4 @@ -error[E0164]: expected tuple struct/variant, found method `::new` +error[E0164]: expected tuple struct or tuple variant, found method `::new` --> $DIR/issue-55587.rs:4:9 | LL | let Path::new(); diff --git a/src/test/ui/issues/issue-56835.rs b/src/test/ui/issues/issue-56835.rs index 4f976da680e64..7132d15ee5fbf 100644 --- a/src/test/ui/issues/issue-56835.rs +++ b/src/test/ui/issues/issue-56835.rs @@ -3,7 +3,7 @@ pub struct Foo {} impl Foo { fn bar(Self(foo): Self) {} //~^ ERROR the `Self` constructor can only be used with tuple or unit structs - //~^^ ERROR expected tuple struct/variant, found self constructor `Self` [E0164] + //~^^ ERROR expected tuple struct or tuple variant, found self constructor `Self` [E0164] } fn main() {} diff --git a/src/test/ui/issues/issue-56835.stderr b/src/test/ui/issues/issue-56835.stderr index f9fdf23af9715..c200ba8d52a32 100644 --- a/src/test/ui/issues/issue-56835.stderr +++ b/src/test/ui/issues/issue-56835.stderr @@ -4,7 +4,7 @@ error: the `Self` constructor can only be used with tuple or unit structs LL | fn bar(Self(foo): Self) {} | ^^^^^^^^^ help: use curly brackets: `Self { /* fields */ }` -error[E0164]: expected tuple struct/variant, found self constructor `Self` +error[E0164]: expected tuple struct or tuple variant, found self constructor `Self` --> $DIR/issue-56835.rs:4:12 | LL | fn bar(Self(foo): Self) {} diff --git a/src/test/ui/issues/issue-58022.rs b/src/test/ui/issues/issue-58022.rs index c6dd45e6cf3e9..30527903ed0f2 100644 --- a/src/test/ui/issues/issue-58022.rs +++ b/src/test/ui/issues/issue-58022.rs @@ -11,7 +11,8 @@ impl Bar<[u8]> { const SIZE: usize = 32; fn new(slice: &[u8; Self::SIZE]) -> Self { - Foo(Box::new(*slice)) //~ ERROR: expected function, found trait `Foo` + Foo(Box::new(*slice)) + //~^ ERROR: expected function, tuple struct or tuple variant, found trait `Foo` } } diff --git a/src/test/ui/issues/issue-58022.stderr b/src/test/ui/issues/issue-58022.stderr index 71bad7b81fa87..a3e4cb6320240 100644 --- a/src/test/ui/issues/issue-58022.stderr +++ b/src/test/ui/issues/issue-58022.stderr @@ -1,8 +1,8 @@ -error[E0423]: expected function, found trait `Foo` +error[E0423]: expected function, tuple struct or tuple variant, found trait `Foo` --> $DIR/issue-58022.rs:14:9 | LL | Foo(Box::new(*slice)) - | ^^^ not a function + | ^^^ not a function, tuple struct or tuple variant error[E0283]: type annotations needed: cannot resolve `_: Foo` --> $DIR/issue-58022.rs:4:25 diff --git a/src/test/ui/issues/issue-5927.rs b/src/test/ui/issues/issue-5927.rs index 847936cc95402..14f95827be8ea 100644 --- a/src/test/ui/issues/issue-5927.rs +++ b/src/test/ui/issues/issue-5927.rs @@ -1,6 +1,6 @@ fn main() { let z = match 3 { - x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope + x(1) => x(1) //~ ERROR cannot find tuple struct or tuple variant `x` in this scope //~^ ERROR cannot find function `x` in this scope }; assert!(z == 3); diff --git a/src/test/ui/issues/issue-5927.stderr b/src/test/ui/issues/issue-5927.stderr index 3d4550ec8b238..d6cd6853dbdb5 100644 --- a/src/test/ui/issues/issue-5927.stderr +++ b/src/test/ui/issues/issue-5927.stderr @@ -1,4 +1,4 @@ -error[E0531]: cannot find tuple struct/variant `x` in this scope +error[E0531]: cannot find tuple struct or tuple variant `x` in this scope --> $DIR/issue-5927.rs:3:9 | LL | x(1) => x(1) diff --git a/src/test/ui/issues/issue-63983.rs b/src/test/ui/issues/issue-63983.rs index c1c79091fc802..ab952666fd1da 100644 --- a/src/test/ui/issues/issue-63983.rs +++ b/src/test/ui/issues/issue-63983.rs @@ -6,9 +6,9 @@ enum MyEnum { fn foo(en: MyEnum) { match en { MyEnum::Tuple => "", - //~^ ERROR expected unit struct/variant or constant, found tuple variant `MyEnum::Tuple` +//~^ ERROR expected unit struct, unit variant or constant, found tuple variant `MyEnum::Tuple` MyEnum::Struct => "", - //~^ ERROR expected unit struct/variant or constant, found struct variant `MyEnum::Struct` +//~^ ERROR expected unit struct, unit variant or constant, found struct variant `MyEnum::Struct` }; } diff --git a/src/test/ui/issues/issue-63983.stderr b/src/test/ui/issues/issue-63983.stderr index 8949c475b6f72..e54466faedde6 100644 --- a/src/test/ui/issues/issue-63983.stderr +++ b/src/test/ui/issues/issue-63983.stderr @@ -1,4 +1,4 @@ -error[E0532]: expected unit struct/variant or constant, found tuple variant `MyEnum::Tuple` +error[E0532]: expected unit struct, unit variant or constant, found tuple variant `MyEnum::Tuple` --> $DIR/issue-63983.rs:8:9 | LL | Tuple(i32), @@ -7,7 +7,7 @@ LL | Tuple(i32), LL | MyEnum::Tuple => "", | ^^^^^^^^^^^^^ did you mean `MyEnum::Tuple( /* fields */ )`? -error[E0532]: expected unit struct/variant or constant, found struct variant `MyEnum::Struct` +error[E0532]: expected unit struct, unit variant or constant, found struct variant `MyEnum::Struct` --> $DIR/issue-63983.rs:10:9 | LL | Struct{ s: i32 }, diff --git a/src/test/ui/issues/issue-64792-bad-unicode-ctor.rs b/src/test/ui/issues/issue-64792-bad-unicode-ctor.rs index 7bce57923a5b7..f1427ef46e928 100644 --- a/src/test/ui/issues/issue-64792-bad-unicode-ctor.rs +++ b/src/test/ui/issues/issue-64792-bad-unicode-ctor.rs @@ -1,5 +1,5 @@ struct X {} -const Y: X = X("ö"); //~ ERROR expected function, found struct `X` +const Y: X = X("ö"); //~ ERROR expected function, tuple struct or tuple variant, found struct `X` fn main() {} diff --git a/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr b/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr index ae9025bb041ab..44e5d38abbc54 100644 --- a/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr +++ b/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr @@ -1,14 +1,15 @@ -error[E0423]: expected function, found struct `X` +error[E0423]: expected function, tuple struct or tuple variant, found struct `X` --> $DIR/issue-64792-bad-unicode-ctor.rs:3:14 | LL | struct X {} | ----------- `X` defined here LL | LL | const Y: X = X("ö"); - | ^ - | | - | did you mean `X { /* fields */ }`? - | help: a constant with a similar name exists: `Y` + | -------------^------ + | | | + | | did you mean `X { /* fields */ }`? + | | help: a constant with a similar name exists: `Y` + | similarly named constant `Y` defined here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-pr29383.rs b/src/test/ui/issues/issue-pr29383.rs index 334fdacb81ec4..2bcc0aa2782dd 100644 --- a/src/test/ui/issues/issue-pr29383.rs +++ b/src/test/ui/issues/issue-pr29383.rs @@ -6,7 +6,9 @@ enum E { fn main() { match None { None => {} - Some(E::A(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::A` - Some(E::B(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::B` + Some(E::A(..)) => {} + //~^ ERROR expected tuple struct or tuple variant, found unit variant `E::A` + Some(E::B(..)) => {} + //~^ ERROR expected tuple struct or tuple variant, found unit variant `E::B` } } diff --git a/src/test/ui/issues/issue-pr29383.stderr b/src/test/ui/issues/issue-pr29383.stderr index 9695e1e3c07f5..e92fd6c2fdc5a 100644 --- a/src/test/ui/issues/issue-pr29383.stderr +++ b/src/test/ui/issues/issue-pr29383.stderr @@ -1,14 +1,14 @@ -error[E0532]: expected tuple struct/variant, found unit variant `E::A` +error[E0532]: expected tuple struct or tuple variant, found unit variant `E::A` --> $DIR/issue-pr29383.rs:9:14 | LL | Some(E::A(..)) => {} - | ^^^^ not a tuple struct/variant + | ^^^^ not a tuple struct or tuple variant -error[E0532]: expected tuple struct/variant, found unit variant `E::B` - --> $DIR/issue-pr29383.rs:10:14 +error[E0532]: expected tuple struct or tuple variant, found unit variant `E::B` + --> $DIR/issue-pr29383.rs:11:14 | LL | Some(E::B(..)) => {} - | ^^^^ not a tuple struct/variant + | ^^^^ not a tuple struct or tuple variant error: aborting due to 2 previous errors diff --git a/src/test/ui/keyword/keyword-self-as-identifier.rs b/src/test/ui/keyword/keyword-self-as-identifier.rs index b30002cddafea..72e4f01e21edd 100644 --- a/src/test/ui/keyword/keyword-self-as-identifier.rs +++ b/src/test/ui/keyword/keyword-self-as-identifier.rs @@ -1,3 +1,3 @@ fn main() { - let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope + let Self = 22; //~ ERROR cannot find unit struct, unit variant or constant `Self` in this scope } diff --git a/src/test/ui/keyword/keyword-self-as-identifier.stderr b/src/test/ui/keyword/keyword-self-as-identifier.stderr index be57c6ad26fd8..060e7c3eafc26 100644 --- a/src/test/ui/keyword/keyword-self-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-self-as-identifier.stderr @@ -1,4 +1,4 @@ -error[E0531]: cannot find unit struct/variant or constant `Self` in this scope +error[E0531]: cannot find unit struct, unit variant or constant `Self` in this scope --> $DIR/keyword-self-as-identifier.rs:2:9 | LL | let Self = 22; diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr index 01c8ebea62a2c..b2caba893e072 100644 --- a/src/test/ui/macros/macro_undefined.stderr +++ b/src/test/ui/macros/macro_undefined.stderr @@ -1,8 +1,13 @@ error: cannot find macro `k` in this scope --> $DIR/macro_undefined.rs:11:5 | -LL | k!(); - | ^ help: a macro with a similar name exists: `kl` +LL | / macro_rules! kl { +LL | | () => () +LL | | } + | |_____- similarly named macro `kl` defined here +... +LL | k!(); + | ^ help: a macro with a similar name exists: `kl` error: aborting due to previous error diff --git a/src/test/ui/match/match-fn-call.rs b/src/test/ui/match/match-fn-call.rs index d9c50e75c4944..99092602c9647 100644 --- a/src/test/ui/match/match-fn-call.rs +++ b/src/test/ui/match/match-fn-call.rs @@ -4,9 +4,9 @@ fn main() { let path = Path::new("foo"); match path { Path::new("foo") => println!("foo"), - //~^ ERROR expected tuple struct/variant + //~^ ERROR expected tuple struct or tuple variant Path::new("bar") => println!("bar"), - //~^ ERROR expected tuple struct/variant + //~^ ERROR expected tuple struct or tuple variant _ => (), } } diff --git a/src/test/ui/match/match-fn-call.stderr b/src/test/ui/match/match-fn-call.stderr index bd918428351b9..611904e6e91a0 100644 --- a/src/test/ui/match/match-fn-call.stderr +++ b/src/test/ui/match/match-fn-call.stderr @@ -1,4 +1,4 @@ -error[E0164]: expected tuple struct/variant, found method `::new` +error[E0164]: expected tuple struct or tuple variant, found method `::new` --> $DIR/match-fn-call.rs:6:9 | LL | Path::new("foo") => println!("foo"), @@ -6,7 +6,7 @@ LL | Path::new("foo") => println!("foo"), | = help: for more information, visit https://doc.rust-lang.org/book/ch18-00-patterns.html -error[E0164]: expected tuple struct/variant, found method `::new` +error[E0164]: expected tuple struct or tuple variant, found method `::new` --> $DIR/match-fn-call.rs:8:9 | LL | Path::new("bar") => println!("bar"), diff --git a/src/test/ui/match/match-pattern-field-mismatch-2.rs b/src/test/ui/match/match-pattern-field-mismatch-2.rs index 3351c756a3145..fa03cdac29fc2 100644 --- a/src/test/ui/match/match-pattern-field-mismatch-2.rs +++ b/src/test/ui/match/match-pattern-field-mismatch-2.rs @@ -10,7 +10,7 @@ fn main() { Color::Rgb(_, _, _) => { } Color::Cmyk(_, _, _, _) => { } Color::NoColor(_) => { } - //~^ ERROR expected tuple struct/variant, found unit variant `Color::NoColor` + //~^ ERROR expected tuple struct or tuple variant, found unit variant `Color::NoColor` } } } diff --git a/src/test/ui/match/match-pattern-field-mismatch-2.stderr b/src/test/ui/match/match-pattern-field-mismatch-2.stderr index a42d62e80297b..cfffcd13851b8 100644 --- a/src/test/ui/match/match-pattern-field-mismatch-2.stderr +++ b/src/test/ui/match/match-pattern-field-mismatch-2.stderr @@ -1,8 +1,8 @@ -error[E0532]: expected tuple struct/variant, found unit variant `Color::NoColor` +error[E0532]: expected tuple struct or tuple variant, found unit variant `Color::NoColor` --> $DIR/match-pattern-field-mismatch-2.rs:12:11 | LL | Color::NoColor(_) => { } - | ^^^^^^^^^^^^^^ not a tuple struct/variant + | ^^^^^^^^^^^^^^ not a tuple struct or tuple variant error: aborting due to previous error diff --git a/src/test/ui/match/match-pattern-field-mismatch.rs b/src/test/ui/match/match-pattern-field-mismatch.rs index 1266aec6220f7..a4fa97fef38e9 100644 --- a/src/test/ui/match/match-pattern-field-mismatch.rs +++ b/src/test/ui/match/match-pattern-field-mismatch.rs @@ -8,7 +8,7 @@ fn main() { fn foo(c: Color) { match c { Color::Rgb(_, _) => { } - //~^ ERROR this pattern has 2 fields, but the corresponding tuple variant has 3 fields + //~^ ERROR this pattern has 2 fields, but the corresponding tuple variant has 3 Color::Cmyk(_, _, _, _) => { } Color::NoColor => { } } diff --git a/src/test/ui/methods/method-path-in-pattern.rs b/src/test/ui/methods/method-path-in-pattern.rs index 21a91f3f32b24..49f5e09edf45a 100644 --- a/src/test/ui/methods/method-path-in-pattern.rs +++ b/src/test/ui/methods/method-path-in-pattern.rs @@ -13,20 +13,20 @@ impl MyTrait for Foo {} fn main() { match 0u32 { Foo::bar => {} - //~^ ERROR expected unit struct/variant or constant, found method `::bar` + //~^ ERROR expected unit struct, unit variant or constant, found method `::bar` } match 0u32 { ::bar => {} - //~^ ERROR expected unit struct/variant or constant, found method `::bar` + //~^ ERROR expected unit struct, unit variant or constant, found method `::bar` } match 0u32 { ::trait_bar => {} - //~^ ERROR expected unit struct/variant or constant, found method `::trait_bar` + //~^ ERROR expected unit struct, unit variant or constant, found method `::trait_bar` } if let Foo::bar = 0u32 {} - //~^ ERROR expected unit struct/variant or constant, found method `::bar` + //~^ ERROR expected unit struct, unit variant or constant, found method `::bar` if let ::bar = 0u32 {} - //~^ ERROR expected unit struct/variant or constant, found method `::bar` + //~^ ERROR expected unit struct, unit variant or constant, found method `::bar` if let Foo::trait_bar = 0u32 {} - //~^ ERROR expected unit struct/variant or constant, found method `::trait_bar` + //~^ ERROR expected unit struct, unit variant or constant, found method `::trait_bar` } diff --git a/src/test/ui/methods/method-path-in-pattern.stderr b/src/test/ui/methods/method-path-in-pattern.stderr index 257fff4c37dc0..b290c34d52774 100644 --- a/src/test/ui/methods/method-path-in-pattern.stderr +++ b/src/test/ui/methods/method-path-in-pattern.stderr @@ -1,34 +1,34 @@ -error[E0533]: expected unit struct/variant or constant, found method `::bar` +error[E0533]: expected unit struct, unit variant or constant, found method `::bar` --> $DIR/method-path-in-pattern.rs:15:9 | LL | Foo::bar => {} | ^^^^^^^^ -error[E0533]: expected unit struct/variant or constant, found method `::bar` +error[E0533]: expected unit struct, unit variant or constant, found method `::bar` --> $DIR/method-path-in-pattern.rs:19:9 | LL | ::bar => {} | ^^^^^^^^^^ -error[E0533]: expected unit struct/variant or constant, found method `::trait_bar` +error[E0533]: expected unit struct, unit variant or constant, found method `::trait_bar` --> $DIR/method-path-in-pattern.rs:23:9 | LL | ::trait_bar => {} | ^^^^^^^^^^^^^^^^ -error[E0533]: expected unit struct/variant or constant, found method `::bar` +error[E0533]: expected unit struct, unit variant or constant, found method `::bar` --> $DIR/method-path-in-pattern.rs:26:12 | LL | if let Foo::bar = 0u32 {} | ^^^^^^^^ -error[E0533]: expected unit struct/variant or constant, found method `::bar` +error[E0533]: expected unit struct, unit variant or constant, found method `::bar` --> $DIR/method-path-in-pattern.rs:28:12 | LL | if let ::bar = 0u32 {} | ^^^^^^^^^^ -error[E0533]: expected unit struct/variant or constant, found method `::trait_bar` +error[E0533]: expected unit struct, unit variant or constant, found method `::trait_bar` --> $DIR/method-path-in-pattern.rs:30:12 | LL | if let Foo::trait_bar = 0u32 {} diff --git a/src/test/ui/methods/method-resolvable-path-in-pattern.rs b/src/test/ui/methods/method-resolvable-path-in-pattern.rs index 1d373cfa6a767..c05160792d360 100644 --- a/src/test/ui/methods/method-resolvable-path-in-pattern.rs +++ b/src/test/ui/methods/method-resolvable-path-in-pattern.rs @@ -9,6 +9,6 @@ impl MyTrait for Foo {} fn main() { match 0u32 { ::trait_bar => {} - //~^ ERROR expected unit struct/variant or constant, found method `MyTrait::trait_bar` + //~^ ERROR expected unit struct, unit variant or constant, found method `MyTrait::trait_bar` } } diff --git a/src/test/ui/methods/method-resolvable-path-in-pattern.stderr b/src/test/ui/methods/method-resolvable-path-in-pattern.stderr index f631c92172021..4b25b694e13ac 100644 --- a/src/test/ui/methods/method-resolvable-path-in-pattern.stderr +++ b/src/test/ui/methods/method-resolvable-path-in-pattern.stderr @@ -1,8 +1,8 @@ -error[E0532]: expected unit struct/variant or constant, found method `MyTrait::trait_bar` +error[E0532]: expected unit struct, unit variant or constant, found method `MyTrait::trait_bar` --> $DIR/method-resolvable-path-in-pattern.rs:11:9 | LL | ::trait_bar => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a unit struct/variant or constant + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant error: aborting due to previous error diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index c3f2c79fdd21e..0484661a2e154 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -1,6 +1,9 @@ error[E0423]: expected value, found type alias `m1::S` --> $DIR/namespace-mix.rs:34:11 | +LL | pub struct TS(); + | ---------------- similarly named tuple struct `TS` defined here +... LL | check(m1::S); | ^^^^^ | @@ -39,6 +42,8 @@ error[E0423]: expected value, found struct variant `m7::V` | LL | V {}, | ---- `m7::V` defined here +LL | TV(), + | ---- similarly named tuple variant `TV` defined here ... LL | check(m7::V); | ^^^^^ did you mean `m7::V { /* fields */ }`? diff --git a/src/test/ui/parser/recover-from-bad-variant.rs b/src/test/ui/parser/recover-from-bad-variant.rs index 35088fb306882..27b03c0c2db27 100644 --- a/src/test/ui/parser/recover-from-bad-variant.rs +++ b/src/test/ui/parser/recover-from-bad-variant.rs @@ -8,7 +8,7 @@ fn main() { //~^ ERROR expected type, found `3` match x { Enum::Foo(a, b) => {} - //~^ ERROR expected tuple struct/variant, found struct variant `Enum::Foo` + //~^ ERROR expected tuple struct or tuple variant, found struct variant `Enum::Foo` Enum::Bar(a, b) => {} } } diff --git a/src/test/ui/parser/recover-from-bad-variant.stderr b/src/test/ui/parser/recover-from-bad-variant.stderr index 32bb88d31c4c7..375e2d5454489 100644 --- a/src/test/ui/parser/recover-from-bad-variant.stderr +++ b/src/test/ui/parser/recover-from-bad-variant.stderr @@ -9,7 +9,7 @@ LL | let x = Enum::Foo(a: 3, b: 4); = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` = note: for more information, see https://github.com/rust-lang/rust/issues/23416 -error[E0532]: expected tuple struct/variant, found struct variant `Enum::Foo` +error[E0532]: expected tuple struct or tuple variant, found struct variant `Enum::Foo` --> $DIR/recover-from-bad-variant.rs:10:9 | LL | Foo { a: usize, b: usize }, diff --git a/src/test/ui/pattern/pattern-error-continue.rs b/src/test/ui/pattern/pattern-error-continue.rs index 7e79868f874d9..79cc4b552a717 100644 --- a/src/test/ui/pattern/pattern-error-continue.rs +++ b/src/test/ui/pattern/pattern-error-continue.rs @@ -15,7 +15,7 @@ fn f(_c: char) {} fn main() { match A::B(1, 2) { A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but - A::D(_) => (), //~ ERROR expected tuple struct/variant, found unit variant `A::D` + A::D(_) => (), //~ ERROR expected tuple struct or tuple variant, found unit variant `A::D` _ => () } match 'c' { diff --git a/src/test/ui/pattern/pattern-error-continue.stderr b/src/test/ui/pattern/pattern-error-continue.stderr index 4fbc630644baa..5a7dab30d83be 100644 --- a/src/test/ui/pattern/pattern-error-continue.stderr +++ b/src/test/ui/pattern/pattern-error-continue.stderr @@ -4,9 +4,12 @@ error[E0433]: failed to resolve: use of undeclared type or module `E` LL | E::V => {} | ^ use of undeclared type or module `E` -error[E0532]: expected tuple struct/variant, found unit variant `A::D` +error[E0532]: expected tuple struct or tuple variant, found unit variant `A::D` --> $DIR/pattern-error-continue.rs:18:9 | +LL | B(isize, isize), + | --------------- similarly named tuple variant `B` defined here +... LL | A::D(_) => (), | ^^^- | | diff --git a/src/test/ui/privacy/privacy-ns1.rs b/src/test/ui/privacy/privacy-ns1.rs index 91cf8e8161994..3326b12ffa535 100644 --- a/src/test/ui/privacy/privacy-ns1.rs +++ b/src/test/ui/privacy/privacy-ns1.rs @@ -17,7 +17,7 @@ pub mod foo1 { fn test_glob1() { use foo1::*; - Bar(); //~ ERROR expected function, found trait `Bar` + Bar(); //~ ERROR expected function, tuple struct or tuple variant, found trait `Bar` } // private type, public value @@ -47,7 +47,7 @@ pub mod foo3 { fn test_glob3() { use foo3::*; - Bar(); //~ ERROR cannot find function `Bar` in this scope + Bar(); //~ ERROR cannot find function, tuple struct or tuple variant `Bar` in this scope let _x: Box; //~ ERROR cannot find type `Bar` in this scope } diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr index 16da57a78e092..3c766a33baae8 100644 --- a/src/test/ui/privacy/privacy-ns1.stderr +++ b/src/test/ui/privacy/privacy-ns1.stderr @@ -1,6 +1,9 @@ -error[E0423]: expected function, found trait `Bar` +error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar` --> $DIR/privacy-ns1.rs:20:5 | +LL | pub struct Baz; + | --------------- similarly named unit struct `Baz` defined here +... LL | Bar(); | ^^^ | @@ -20,6 +23,9 @@ LL | use foo3::Bar; error[E0573]: expected type, found function `Bar` --> $DIR/privacy-ns1.rs:35:17 | +LL | pub struct Baz; + | --------------- similarly named struct `Baz` defined here +... LL | let _x: Box; | ^^^ | @@ -36,9 +42,12 @@ LL | use foo2::Bar; LL | use foo3::Bar; | -error[E0425]: cannot find function `Bar` in this scope +error[E0425]: cannot find function, tuple struct or tuple variant `Bar` in this scope --> $DIR/privacy-ns1.rs:50:5 | +LL | pub struct Baz; + | --------------- similarly named unit struct `Baz` defined here +... LL | Bar(); | ^^^ | @@ -58,6 +67,9 @@ LL | use foo3::Bar; error[E0412]: cannot find type `Bar` in this scope --> $DIR/privacy-ns1.rs:51:17 | +LL | pub struct Baz; + | --------------- similarly named struct `Baz` defined here +... LL | let _x: Box; | ^^^ | diff --git a/src/test/ui/privacy/privacy-ns2.rs b/src/test/ui/privacy/privacy-ns2.rs index c4e400f5adbd9..788a36fd92ca2 100644 --- a/src/test/ui/privacy/privacy-ns2.rs +++ b/src/test/ui/privacy/privacy-ns2.rs @@ -17,13 +17,13 @@ pub mod foo1 { fn test_single1() { use foo1::Bar; - Bar(); //~ ERROR expected function, found trait `Bar` + Bar(); //~ ERROR expected function, tuple struct or tuple variant, found trait `Bar` } fn test_list1() { use foo1::{Bar,Baz}; - Bar(); //~ ERROR expected function, found trait `Bar` + Bar(); //~ ERROR expected function, tuple struct or tuple variant, found trait `Bar` } // private type, public value diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr index f0d5da6868596..48e06821cd61c 100644 --- a/src/test/ui/privacy/privacy-ns2.stderr +++ b/src/test/ui/privacy/privacy-ns2.stderr @@ -1,8 +1,8 @@ -error[E0423]: expected function, found trait `Bar` +error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar` --> $DIR/privacy-ns2.rs:20:5 | LL | Bar(); - | ^^^ not a function + | ^^^ not a function, tuple struct or tuple variant | help: possible better candidates are found in other modules, you can import them into scope | @@ -13,9 +13,12 @@ LL | use foo2::Bar; LL | use foo3::Bar; | -error[E0423]: expected function, found trait `Bar` +error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar` --> $DIR/privacy-ns2.rs:26:5 | +LL | pub struct Baz; + | --------------- similarly named unit struct `Baz` defined here +... LL | Bar(); | ^^^ | @@ -50,6 +53,9 @@ LL | use foo3::Bar; error[E0573]: expected type, found function `Bar` --> $DIR/privacy-ns2.rs:47:17 | +LL | pub struct Baz; + | --------------- similarly named struct `Baz` defined here +... LL | let _x: Box; | ^^^ | diff --git a/src/test/ui/proc-macro/parent-source-spans.rs b/src/test/ui/proc-macro/parent-source-spans.rs index 799f1de586ed4..7b2ffefb05b19 100644 --- a/src/test/ui/proc-macro/parent-source-spans.rs +++ b/src/test/ui/proc-macro/parent-source-spans.rs @@ -1,6 +1,4 @@ // aux-build:parent-source-spans.rs - - #![feature(decl_macro, proc_macro_hygiene)] extern crate parent_source_spans; diff --git a/src/test/ui/proc-macro/parent-source-spans.stderr b/src/test/ui/proc-macro/parent-source-spans.stderr index 423122539c803..3e54a71f0e810 100644 --- a/src/test/ui/proc-macro/parent-source-spans.stderr +++ b/src/test/ui/proc-macro/parent-source-spans.stderr @@ -1,5 +1,5 @@ error: first final: "hello" - --> $DIR/parent-source-spans.rs:17:12 + --> $DIR/parent-source-spans.rs:15:12 | LL | three!($a, $b); | ^^ @@ -8,7 +8,7 @@ LL | one!("hello", "world"); | ----------------------- in this macro invocation error: second final: "world" - --> $DIR/parent-source-spans.rs:17:16 + --> $DIR/parent-source-spans.rs:15:16 | LL | three!($a, $b); | ^^ @@ -17,7 +17,7 @@ LL | one!("hello", "world"); | ----------------------- in this macro invocation error: first parent: "hello" - --> $DIR/parent-source-spans.rs:11:5 + --> $DIR/parent-source-spans.rs:9:5 | LL | two!($a, $b); | ^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | one!("hello", "world"); | ----------------------- in this macro invocation error: second parent: "world" - --> $DIR/parent-source-spans.rs:11:5 + --> $DIR/parent-source-spans.rs:9:5 | LL | two!($a, $b); | ^^^^^^^^^^^^^ @@ -35,31 +35,31 @@ LL | one!("hello", "world"); | ----------------------- in this macro invocation error: first grandparent: "hello" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:35:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^^ error: second grandparent: "world" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:35:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^^ error: first source: "hello" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:35:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^^ error: second source: "world" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:35:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^^ error: first final: "yay" - --> $DIR/parent-source-spans.rs:17:12 + --> $DIR/parent-source-spans.rs:15:12 | LL | three!($a, $b); | ^^ @@ -68,7 +68,7 @@ LL | two!("yay", "rust"); | -------------------- in this macro invocation error: second final: "rust" - --> $DIR/parent-source-spans.rs:17:16 + --> $DIR/parent-source-spans.rs:15:16 | LL | three!($a, $b); | ^^ @@ -77,55 +77,55 @@ LL | two!("yay", "rust"); | -------------------- in this macro invocation error: first parent: "yay" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:41:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^^ error: second parent: "rust" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:41:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^^ error: first source: "yay" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:41:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^^ error: second source: "rust" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:41:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^^ error: first final: "hip" - --> $DIR/parent-source-spans.rs:49:12 + --> $DIR/parent-source-spans.rs:47:12 | LL | three!("hip", "hop"); | ^^^^^ error: second final: "hop" - --> $DIR/parent-source-spans.rs:49:19 + --> $DIR/parent-source-spans.rs:47:19 | LL | three!("hip", "hop"); | ^^^^^ error: first source: "hip" - --> $DIR/parent-source-spans.rs:49:12 + --> $DIR/parent-source-spans.rs:47:12 | LL | three!("hip", "hop"); | ^^^^^ error: second source: "hop" - --> $DIR/parent-source-spans.rs:49:19 + --> $DIR/parent-source-spans.rs:47:19 | LL | three!("hip", "hop"); | ^^^^^ error[E0425]: cannot find value `ok` in this scope - --> $DIR/parent-source-spans.rs:30:5 + --> $DIR/parent-source-spans.rs:28:5 | LL | parent_source_spans!($($tokens)*); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` @@ -134,7 +134,7 @@ LL | one!("hello", "world"); | ----------------------- in this macro invocation error[E0425]: cannot find value `ok` in this scope - --> $DIR/parent-source-spans.rs:30:5 + --> $DIR/parent-source-spans.rs:28:5 | LL | parent_source_spans!($($tokens)*); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` @@ -143,7 +143,7 @@ LL | two!("yay", "rust"); | -------------------- in this macro invocation error[E0425]: cannot find value `ok` in this scope - --> $DIR/parent-source-spans.rs:30:5 + --> $DIR/parent-source-spans.rs:28:5 | LL | parent_source_spans!($($tokens)*); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` diff --git a/src/test/ui/proc-macro/resolve-error.stderr b/src/test/ui/proc-macro/resolve-error.stderr index 3dca5cee63caa..02c82c01ed3e0 100644 --- a/src/test/ui/proc-macro/resolve-error.stderr +++ b/src/test/ui/proc-macro/resolve-error.stderr @@ -13,14 +13,24 @@ LL | Dlona!(); error: cannot find macro `attr_proc_macra` in this scope --> $DIR/resolve-error.rs:50:5 | -LL | attr_proc_macra!(); - | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `attr_proc_mac` +LL | / macro_rules! attr_proc_mac { +LL | | () => {} +LL | | } + | |_- similarly named macro `attr_proc_mac` defined here +... +LL | attr_proc_macra!(); + | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `attr_proc_mac` error: cannot find macro `FooWithLongNama` in this scope --> $DIR/resolve-error.rs:47:5 | -LL | FooWithLongNama!(); - | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `FooWithLongNam` +LL | / macro_rules! FooWithLongNam { +LL | | () => {} +LL | | } + | |_- similarly named macro `FooWithLongNam` defined here +... +LL | FooWithLongNama!(); + | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `FooWithLongNam` error: cannot find derive macro `attr_proc_macra` in this scope --> $DIR/resolve-error.rs:42:10 diff --git a/src/test/ui/qualified/qualified-path-params.rs b/src/test/ui/qualified/qualified-path-params.rs index ea2ae0e86bf64..b1b60b4b73fb9 100644 --- a/src/test/ui/qualified/qualified-path-params.rs +++ b/src/test/ui/qualified/qualified-path-params.rs @@ -18,7 +18,7 @@ impl S { fn main() { match 10 { ::A::f:: => {} - //~^ ERROR expected unit struct/variant or constant, found method `<::A>::f` + //~^ ERROR expected unit struct, unit variant or constant, found method `<::A>::f` 0 ..= ::A::f:: => {} //~ ERROR only char and numeric types are allowed in range } } diff --git a/src/test/ui/qualified/qualified-path-params.stderr b/src/test/ui/qualified/qualified-path-params.stderr index 3e8fcdc7ca3e2..92792f2e86a83 100644 --- a/src/test/ui/qualified/qualified-path-params.stderr +++ b/src/test/ui/qualified/qualified-path-params.stderr @@ -1,4 +1,4 @@ -error[E0533]: expected unit struct/variant or constant, found method `<::A>::f` +error[E0533]: expected unit struct, unit variant or constant, found method `<::A>::f` --> $DIR/qualified-path-params.rs:20:9 | LL | ::A::f:: => {} diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.rs b/src/test/ui/resolve/enums-are-namespaced-xc.rs index 4c660c27e3b1a..dfc16d6ce443c 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.rs +++ b/src/test/ui/resolve/enums-are-namespaced-xc.rs @@ -5,7 +5,7 @@ fn main() { let _ = namespaced_enums::A; //~^ ERROR cannot find value `A` let _ = namespaced_enums::B(10); - //~^ ERROR cannot find function `B` + //~^ ERROR cannot find function, tuple struct or tuple variant `B` let _ = namespaced_enums::C { a: 10 }; //~^ ERROR cannot find struct, variant or union type `C` } diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.stderr b/src/test/ui/resolve/enums-are-namespaced-xc.stderr index 092051ed874ed..61816709ecc5d 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.stderr +++ b/src/test/ui/resolve/enums-are-namespaced-xc.stderr @@ -9,7 +9,7 @@ help: possible candidate is found in another module, you can import it into scop LL | use namespaced_enums::Foo::A; | -error[E0425]: cannot find function `B` in crate `namespaced_enums` +error[E0425]: cannot find function, tuple struct or tuple variant `B` in crate `namespaced_enums` --> $DIR/enums-are-namespaced-xc.rs:7:31 | LL | let _ = namespaced_enums::B(10); diff --git a/src/test/ui/resolve/issue-18252.rs b/src/test/ui/resolve/issue-18252.rs index 894762115ab10..af0a3cbcb2d81 100644 --- a/src/test/ui/resolve/issue-18252.rs +++ b/src/test/ui/resolve/issue-18252.rs @@ -4,5 +4,5 @@ enum Foo { fn main() { let f = Foo::Variant(42); - //~^ ERROR expected function, found struct variant `Foo::Variant` + //~^ ERROR expected function, tuple struct or tuple variant, found struct variant `Foo::Variant` } diff --git a/src/test/ui/resolve/issue-18252.stderr b/src/test/ui/resolve/issue-18252.stderr index c76e5ef8b3617..39b444498102c 100644 --- a/src/test/ui/resolve/issue-18252.stderr +++ b/src/test/ui/resolve/issue-18252.stderr @@ -1,4 +1,4 @@ -error[E0423]: expected function, found struct variant `Foo::Variant` +error[E0423]: expected function, tuple struct or tuple variant, found struct variant `Foo::Variant` --> $DIR/issue-18252.rs:6:13 | LL | Variant { x: usize } diff --git a/src/test/ui/resolve/issue-5035.stderr b/src/test/ui/resolve/issue-5035.stderr index 96befdbe07339..1674c166ddacb 100644 --- a/src/test/ui/resolve/issue-5035.stderr +++ b/src/test/ui/resolve/issue-5035.stderr @@ -7,6 +7,9 @@ LL | use ImportError; error[E0404]: expected trait, found type alias `K` --> $DIR/issue-5035.rs:3:6 | +LL | trait I {} + | ---------- similarly named trait `I` defined here +LL | type K = dyn I; LL | impl K for isize {} | ^ | | diff --git a/src/test/ui/resolve/issue-6702.rs b/src/test/ui/resolve/issue-6702.rs index 6469c7ec29fa1..954dc36f38e30 100644 --- a/src/test/ui/resolve/issue-6702.rs +++ b/src/test/ui/resolve/issue-6702.rs @@ -4,5 +4,6 @@ struct Monster { fn main() { - let _m = Monster(); //~ ERROR expected function, found struct `Monster` + let _m = Monster(); + //~^ ERROR expected function, tuple struct or tuple variant, found struct `Monster` } diff --git a/src/test/ui/resolve/issue-6702.stderr b/src/test/ui/resolve/issue-6702.stderr index 3fdc7acb274e5..252d50c70f8c4 100644 --- a/src/test/ui/resolve/issue-6702.stderr +++ b/src/test/ui/resolve/issue-6702.stderr @@ -1,4 +1,4 @@ -error[E0423]: expected function, found struct `Monster` +error[E0423]: expected function, tuple struct or tuple variant, found struct `Monster` --> $DIR/issue-6702.rs:7:14 | LL | / struct Monster { diff --git a/src/test/ui/resolve/levenshtein.stderr b/src/test/ui/resolve/levenshtein.stderr index e693a0ef91fc2..8d8f3f35211e2 100644 --- a/src/test/ui/resolve/levenshtein.stderr +++ b/src/test/ui/resolve/levenshtein.stderr @@ -7,6 +7,9 @@ LL | fn foo(c: esize) {} // Misspelled primitive type name. error[E0412]: cannot find type `Baz` in this scope --> $DIR/levenshtein.rs:10:10 | +LL | enum Bar { } + | ------------ similarly named enum `Bar` defined here +LL | LL | type A = Baz; // Misspelled type name. | ^^^ help: an enum with a similar name exists: `Bar` @@ -25,24 +28,36 @@ LL | type A = Baz; // No suggestion here, Bar is not visible error[E0425]: cannot find value `MAXITEM` in this scope --> $DIR/levenshtein.rs:24:20 | +LL | const MAX_ITEM: usize = 10; + | --------------------------- similarly named constant `MAX_ITEM` defined here +... LL | let v = [0u32; MAXITEM]; // Misspelled constant name. | ^^^^^^^ help: a constant with a similar name exists: `MAX_ITEM` error[E0425]: cannot find function `foobar` in this scope --> $DIR/levenshtein.rs:26:5 | +LL | fn foo_bar() {} + | --------------- similarly named function `foo_bar` defined here +... LL | foobar(); // Misspelled function name. | ^^^^^^ help: a function with a similar name exists: `foo_bar` error[E0412]: cannot find type `first` in module `m` --> $DIR/levenshtein.rs:28:15 | +LL | pub struct First; + | ----------------- similarly named struct `First` defined here +... LL | let b: m::first = m::second; // Misspelled item in module. | ^^^^^ help: a struct with a similar name exists (notice the capitalization): `First` error[E0425]: cannot find value `second` in module `m` --> $DIR/levenshtein.rs:28:26 | +LL | pub struct Second; + | ------------------ similarly named unit struct `Second` defined here +... LL | let b: m::first = m::second; // Misspelled item in module. | ^^^^^^ help: a unit struct with a similar name exists (notice the capitalization): `Second` diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index b7cc79cfed9e6..8a450ab85e926 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -16,8 +16,15 @@ LL | m::Z::Unit; error[E0423]: expected value, found enum `Z` --> $DIR/privacy-enum-ctor.rs:25:9 | -LL | Z; - | ^ +LL | / fn f() { +LL | | n::Z; +LL | | +LL | | Z; + | | ^ +... | +LL | | // This is ok, it is equivalent to not having braces +LL | | } + | |_____- similarly named function `f` defined here | help: a function with a similar name exists | @@ -46,8 +53,17 @@ LL | let _: Z = Z::Struct; error[E0423]: expected value, found enum `m::E` --> $DIR/privacy-enum-ctor.rs:41:16 | -LL | let _: E = m::E; - | ^^^^ +LL | / fn f() { +LL | | n::Z; +LL | | +LL | | Z; +... | +LL | | // This is ok, it is equivalent to not having braces +LL | | } + | |_____- similarly named function `f` defined here +... +LL | let _: E = m::E; + | ^^^^ | help: a function with a similar name exists | @@ -114,8 +130,17 @@ LL | let _: E = E::Struct; error[E0412]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:57:12 | -LL | let _: Z = m::n::Z; - | ^ +LL | / pub enum E { +LL | | Fn(u8), +LL | | Struct { +LL | | s: u8, +LL | | }, +LL | | Unit, +LL | | } + | |_____- similarly named enum `E` defined here +... +LL | let _: Z = m::n::Z; + | ^ | help: an enum with a similar name exists | @@ -144,8 +169,17 @@ LL | let _: Z = m::Z::Unit; error[E0412]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:61:12 | -LL | let _: Z = m::n::Z::Fn; - | ^ +LL | / pub enum E { +LL | | Fn(u8), +LL | | Struct { +LL | | s: u8, +LL | | }, +LL | | Unit, +LL | | } + | |_____- similarly named enum `E` defined here +... +LL | let _: Z = m::n::Z::Fn; + | ^ | help: an enum with a similar name exists | @@ -159,8 +193,17 @@ LL | use m::n::Z; error[E0412]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:64:12 | -LL | let _: Z = m::n::Z::Struct; - | ^ +LL | / pub enum E { +LL | | Fn(u8), +LL | | Struct { +LL | | s: u8, +LL | | }, +LL | | Unit, +LL | | } + | |_____- similarly named enum `E` defined here +... +LL | let _: Z = m::n::Z::Struct; + | ^ | help: an enum with a similar name exists | @@ -185,8 +228,17 @@ LL | let _: Z = m::n::Z::Struct; error[E0412]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:68:12 | -LL | let _: Z = m::n::Z::Unit {}; - | ^ +LL | / pub enum E { +LL | | Fn(u8), +LL | | Struct { +LL | | s: u8, +LL | | }, +LL | | Unit, +LL | | } + | |_____- similarly named enum `E` defined here +... +LL | let _: Z = m::n::Z::Unit {}; + | ^ | help: an enum with a similar name exists | diff --git a/src/test/ui/resolve/privacy-struct-ctor.stderr b/src/test/ui/resolve/privacy-struct-ctor.stderr index 51928c32e31f7..f1a1de4d9c0fd 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.stderr +++ b/src/test/ui/resolve/privacy-struct-ctor.stderr @@ -1,6 +1,9 @@ error[E0423]: expected value, found struct `Z` --> $DIR/privacy-struct-ctor.rs:20:9 | +LL | pub struct S(u8); + | ----------------- similarly named tuple struct `S` defined here +... LL | Z; | ^ | | diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.rs b/src/test/ui/resolve/resolve-assoc-suggestions.rs index 8cdbe64af0d83..ee9bce60ce631 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.rs +++ b/src/test/ui/resolve/resolve-assoc-suggestions.rs @@ -16,21 +16,21 @@ impl Tr for S { let _: field; //~^ ERROR cannot find type `field` let field(..); - //~^ ERROR cannot find tuple struct/variant `field` + //~^ ERROR cannot find tuple struct or tuple variant `field` field; //~^ ERROR cannot find value `field` let _: Type; //~^ ERROR cannot find type `Type` let Type(..); - //~^ ERROR cannot find tuple struct/variant `Type` + //~^ ERROR cannot find tuple struct or tuple variant `Type` Type; //~^ ERROR cannot find value `Type` let _: method; //~^ ERROR cannot find type `method` let method(..); - //~^ ERROR cannot find tuple struct/variant `method` + //~^ ERROR cannot find tuple struct or tuple variant `method` method; //~^ ERROR cannot find value `method` } diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.stderr b/src/test/ui/resolve/resolve-assoc-suggestions.stderr index f3b8909ab2236..a05ac0f854395 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.stderr +++ b/src/test/ui/resolve/resolve-assoc-suggestions.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `field` in this scope LL | let _: field; | ^^^^^ not found in this scope -error[E0531]: cannot find tuple struct/variant `field` in this scope +error[E0531]: cannot find tuple struct or tuple variant `field` in this scope --> $DIR/resolve-assoc-suggestions.rs:18:13 | LL | let field(..); @@ -22,7 +22,7 @@ error[E0412]: cannot find type `Type` in this scope LL | let _: Type; | ^^^^ help: try: `Self::Type` -error[E0531]: cannot find tuple struct/variant `Type` in this scope +error[E0531]: cannot find tuple struct or tuple variant `Type` in this scope --> $DIR/resolve-assoc-suggestions.rs:25:13 | LL | let Type(..); @@ -40,7 +40,7 @@ error[E0412]: cannot find type `method` in this scope LL | let _: method; | ^^^^^^ not found in this scope -error[E0531]: cannot find tuple struct/variant `method` in this scope +error[E0531]: cannot find tuple struct or tuple variant `method` in this scope --> $DIR/resolve-assoc-suggestions.rs:32:13 | LL | let method(..); diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index 9a3d5feee0426..33080340cb67a 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -25,6 +25,9 @@ LL | a.b.J error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:32:5 | +LL | pub const I: i32 = 1; + | --------------------- similarly named constant `I` defined here +... LL | a::b.J | ^^^^ | @@ -48,6 +51,9 @@ LL | a.b.f(); error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:40:12 | +LL | pub const I: i32 = 1; + | --------------------- similarly named constant `I` defined here +... LL | v.push(a::b); | ^^^- | | @@ -56,6 +62,9 @@ LL | v.push(a::b); error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:45:5 | +LL | pub const I: i32 = 1; + | --------------------- similarly named constant `I` defined here +... LL | a::b.f() | ^^^^ | @@ -71,6 +80,9 @@ LL | a::b::f() error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:50:5 | +LL | pub const I: i32 = 1; + | --------------------- similarly named constant `I` defined here +... LL | a::b | ^^^- | | @@ -79,6 +91,9 @@ LL | a::b error[E0423]: expected function, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:5 | +LL | pub const I: i32 = 1; + | --------------------- similarly named constant `I` defined here +... LL | a::b() | ^^^- | | diff --git a/src/test/ui/resolve/tuple-struct-alias.rs b/src/test/ui/resolve/tuple-struct-alias.rs index 65977e1110c5c..298e7e479983d 100644 --- a/src/test/ui/resolve/tuple-struct-alias.rs +++ b/src/test/ui/resolve/tuple-struct-alias.rs @@ -4,6 +4,6 @@ type A = S; fn main() { let s = A(0, 1); //~ ERROR expected function match s { - A(..) => {} //~ ERROR expected tuple struct/variant + A(..) => {} //~ ERROR expected tuple struct or tuple variant } } diff --git a/src/test/ui/resolve/tuple-struct-alias.stderr b/src/test/ui/resolve/tuple-struct-alias.stderr index 02af357a2c32c..5a7873301c8c7 100644 --- a/src/test/ui/resolve/tuple-struct-alias.stderr +++ b/src/test/ui/resolve/tuple-struct-alias.stderr @@ -1,14 +1,20 @@ -error[E0423]: expected function, found type alias `A` +error[E0423]: expected function, tuple struct or tuple variant, found type alias `A` --> $DIR/tuple-struct-alias.rs:5:13 | +LL | struct S(u8, u16); + | ------------------ similarly named tuple struct `S` defined here +... LL | let s = A(0, 1); | ^ help: a tuple struct with a similar name exists: `S` | = note: can't use a type alias as a constructor -error[E0532]: expected tuple struct/variant, found type alias `A` +error[E0532]: expected tuple struct or tuple variant, found type alias `A` --> $DIR/tuple-struct-alias.rs:7:9 | +LL | struct S(u8, u16); + | ------------------ similarly named tuple struct `S` defined here +... LL | A(..) => {} | ^ help: a tuple struct with a similar name exists: `S` | diff --git a/src/test/ui/rfc-2008-non-exhaustive/struct.rs b/src/test/ui/rfc-2008-non-exhaustive/struct.rs index cf383a260e044..8cff35c4bc5ec 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/struct.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/struct.rs @@ -18,7 +18,7 @@ fn main() { //~^ ERROR `..` required with struct marked as non-exhaustive let ts = TupleStruct(640, 480); - //~^ ERROR expected function, found struct `TupleStruct` [E0423] + //~^ ERROR expected function, tuple struct or tuple variant, found struct `TupleStruct` [E0423] let ts_explicit = structs::TupleStruct(640, 480); //~^ ERROR tuple struct constructor `TupleStruct` is private [E0603] diff --git a/src/test/ui/rfc-2008-non-exhaustive/struct.stderr b/src/test/ui/rfc-2008-non-exhaustive/struct.stderr index 04cfe51cab025..944965a15e3d0 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/struct.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/struct.stderr @@ -1,4 +1,4 @@ -error[E0423]: expected function, found struct `TupleStruct` +error[E0423]: expected function, tuple struct or tuple variant, found struct `TupleStruct` --> $DIR/struct.rs:20:14 | LL | let ts = TupleStruct(640, 480); diff --git a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs index ab87ecbde30e9..d52ac7ec3c39d 100644 --- a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs +++ b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs @@ -2,5 +2,5 @@ fn main() { let crate = 0; - //~^ ERROR expected unit struct/variant or constant, found module `crate` + //~^ ERROR expected unit struct, unit variant or constant, found module `crate` } diff --git a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr index e07b5d80fb806..acbb4cf1a6942 100644 --- a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr +++ b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr @@ -1,8 +1,8 @@ -error[E0532]: expected unit struct/variant or constant, found module `crate` +error[E0532]: expected unit struct, unit variant or constant, found module `crate` --> $DIR/keyword-crate-as-identifier.rs:4:9 | LL | let crate = 0; - | ^^^^^ not a unit struct/variant or constant + | ^^^^^ not a unit struct, unit variant or constant error: aborting due to previous error diff --git a/src/test/ui/self/self_type_keyword-2.rs b/src/test/ui/self/self_type_keyword-2.rs index dde5762fd7804..cfb87f5186d32 100644 --- a/src/test/ui/self/self_type_keyword-2.rs +++ b/src/test/ui/self/self_type_keyword-2.rs @@ -2,12 +2,12 @@ use self::Self as Foo; //~ ERROR unresolved import `self::Self` pub fn main() { let Self = 5; - //~^ ERROR cannot find unit struct/variant or constant `Self` in this scope + //~^ ERROR cannot find unit struct, unit variant or constant `Self` in this scope match 15 { Self => (), - //~^ ERROR cannot find unit struct/variant or constant `Self` in this scope + //~^ ERROR cannot find unit struct, unit variant or constant `Self` in this scope Foo { x: Self } => (), - //~^ ERROR cannot find unit struct/variant or constant `Self` in this scope + //~^ ERROR cannot find unit struct, unit variant or constant `Self` in this scope } } diff --git a/src/test/ui/self/self_type_keyword-2.stderr b/src/test/ui/self/self_type_keyword-2.stderr index 560c6d2199ca0..4e931f91f70c4 100644 --- a/src/test/ui/self/self_type_keyword-2.stderr +++ b/src/test/ui/self/self_type_keyword-2.stderr @@ -4,19 +4,19 @@ error[E0432]: unresolved import `self::Self` LL | use self::Self as Foo; | ^^^^^^^^^^^^^^^^^ no `Self` in the root -error[E0531]: cannot find unit struct/variant or constant `Self` in this scope +error[E0531]: cannot find unit struct, unit variant or constant `Self` in this scope --> $DIR/self_type_keyword-2.rs:4:9 | LL | let Self = 5; | ^^^^ not found in this scope -error[E0531]: cannot find unit struct/variant or constant `Self` in this scope +error[E0531]: cannot find unit struct, unit variant or constant `Self` in this scope --> $DIR/self_type_keyword-2.rs:8:9 | LL | Self => (), | ^^^^ not found in this scope -error[E0531]: cannot find unit struct/variant or constant `Self` in this scope +error[E0531]: cannot find unit struct, unit variant or constant `Self` in this scope --> $DIR/self_type_keyword-2.rs:10:18 | LL | Foo { x: Self } => (), diff --git a/src/test/ui/self/self_type_keyword.rs b/src/test/ui/self/self_type_keyword.rs index dfb7d6583d9dd..b42bf8eea1a16 100644 --- a/src/test/ui/self/self_type_keyword.rs +++ b/src/test/ui/self/self_type_keyword.rs @@ -15,7 +15,7 @@ pub fn main() { //~^ ERROR expected identifier, found keyword `Self` mut Self => (), //~^ ERROR `mut` must be followed by a named binding - //~| ERROR cannot find unit struct/variant or constant `Self` + //~| ERROR cannot find unit struct, unit variant or constant `Self` ref mut Self => (), //~^ ERROR expected identifier, found keyword `Self` Self!() => (), diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr index e3b871bd86764..fa603276c8eb5 100644 --- a/src/test/ui/self/self_type_keyword.stderr +++ b/src/test/ui/self/self_type_keyword.stderr @@ -60,7 +60,7 @@ error: cannot find macro `Self` in this scope LL | Self!() => (), | ^^^^ -error[E0531]: cannot find unit struct/variant or constant `Self` in this scope +error[E0531]: cannot find unit struct, unit variant or constant `Self` in this scope --> $DIR/self_type_keyword.rs:16:13 | LL | mut Self => (), 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 1af0f7a191e80..56810a4915869 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 @@ -1,6 +1,8 @@ error[E0423]: expected value, found struct variant `E::B` --> $DIR/fn-or-tuple-struct-without-args.rs:36:16 | +LL | A(usize), + | -------- similarly named tuple variant `A` defined here LL | B { a: usize }, | -------------- `E::B` defined here ... diff --git a/src/test/ui/traits/trait-impl-for-module.stderr b/src/test/ui/traits/trait-impl-for-module.stderr index c62bcfca94de9..4b3c930dccd45 100644 --- a/src/test/ui/traits/trait-impl-for-module.stderr +++ b/src/test/ui/traits/trait-impl-for-module.stderr @@ -1,8 +1,12 @@ error[E0573]: expected type, found module `a` --> $DIR/trait-impl-for-module.rs:7:12 | -LL | impl A for a { - | ^ help: a trait with a similar name exists: `A` +LL | / trait A { +LL | | } + | |_- similarly named trait `A` defined here +LL | +LL | impl A for a { + | ^ help: a trait with a similar name exists: `A` error: aborting due to previous error diff --git a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-Self-issue-58006.rs b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-Self-issue-58006.rs index c1e56fc4caa9f..ab40bf580ea8f 100644 --- a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-Self-issue-58006.rs +++ b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-Self-issue-58006.rs @@ -6,7 +6,7 @@ impl Enum { fn foo(&self) -> () { match self { Self::A => (), - //~^ ERROR expected unit struct/variant or constant, found tuple variant + //~^ ERROR expected unit struct, unit variant or constant, found tuple variant } } } diff --git a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-Self-issue-58006.stderr b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-Self-issue-58006.stderr index 357b33de51b84..cfe273b9dd255 100644 --- a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-Self-issue-58006.stderr +++ b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-Self-issue-58006.stderr @@ -1,4 +1,4 @@ -error[E0533]: expected unit struct/variant or constant, found tuple variant `::A` +error[E0533]: expected unit struct, unit variant or constant, found tuple variant `::A` --> $DIR/incorrect-variant-form-through-Self-issue-58006.rs:8:13 | LL | Self::A => (), diff --git a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.rs b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.rs index ce45d59198af8..efdbebf266219 100644 --- a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.rs +++ b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.rs @@ -8,14 +8,14 @@ type Alias = Enum; fn main() { Alias::Braced; - //~^ ERROR expected unit struct/variant or constant, found struct variant `::Braced` [E0533] + //~^ ERROR expected unit struct, unit variant or constant, found struct variant `::Braced` [E0533] let Alias::Braced = panic!(); - //~^ ERROR expected unit struct/variant or constant, found struct variant `::Braced` [E0533] + //~^ ERROR expected unit struct, unit variant or constant, found struct variant `::Braced` [E0533] let Alias::Braced(..) = panic!(); - //~^ ERROR expected tuple struct/variant, found struct variant `::Braced` [E0164] + //~^ ERROR expected tuple struct or tuple variant, found struct variant `::Braced` [E0164] Alias::Unit(); //~^ ERROR expected function, found enum variant `::Unit` let Alias::Unit() = panic!(); - //~^ ERROR expected tuple struct/variant, found unit variant `::Unit` [E0164] + //~^ ERROR expected tuple struct or tuple variant, found unit variant `::Unit` [E0164] } diff --git a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr index 801ca5f013b3e..17efc08c6327f 100644 --- a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr +++ b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr @@ -1,16 +1,16 @@ -error[E0533]: expected unit struct/variant or constant, found struct variant `::Braced` +error[E0533]: expected unit struct, unit variant or constant, found struct variant `::Braced` --> $DIR/incorrect-variant-form-through-alias-caught.rs:10:5 | LL | Alias::Braced; | ^^^^^^^^^^^^^ -error[E0533]: expected unit struct/variant or constant, found struct variant `::Braced` +error[E0533]: expected unit struct, unit variant or constant, found struct variant `::Braced` --> $DIR/incorrect-variant-form-through-alias-caught.rs:12:9 | LL | let Alias::Braced = panic!(); | ^^^^^^^^^^^^^ -error[E0164]: expected tuple struct/variant, found struct variant `::Braced` +error[E0164]: expected tuple struct or tuple variant, found struct variant `::Braced` --> $DIR/incorrect-variant-form-through-alias-caught.rs:14:9 | LL | let Alias::Braced(..) = panic!(); @@ -32,7 +32,7 @@ help: `::Unit` is a unit variant, you need to write it without the parent LL | ::Unit; | ^^^^^^^^^^^^^ -error[E0164]: expected tuple struct/variant, found unit variant `::Unit` +error[E0164]: expected tuple struct or tuple variant, found unit variant `::Unit` --> $DIR/incorrect-variant-form-through-alias-caught.rs:19:9 | LL | let Alias::Unit() = panic!(); diff --git a/src/test/ui/ufcs/ufcs-partially-resolved.stderr b/src/test/ui/ufcs/ufcs-partially-resolved.stderr index dee990ec3d1cb..dbd41da6daf0b 100644 --- a/src/test/ui/ufcs/ufcs-partially-resolved.stderr +++ b/src/test/ui/ufcs/ufcs-partially-resolved.stderr @@ -13,6 +13,9 @@ LL | ::NN; error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:19:24 | +LL | type Y = u16; + | ------------- similarly named associated type `Y` defined here +... LL | let _: ::N; | ^ help: an associated type with a similar name exists: `Y` @@ -31,6 +34,9 @@ LL | let _: ::N; error[E0576]: cannot find method or associated constant `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:22:17 | +LL | fn Y() {} + | --------- similarly named method `Y` defined here +... LL | ::N; | ^ help: a method with a similar name exists: `Y` @@ -61,6 +67,9 @@ LL | ::Y; error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:30:24 | +LL | type Y = u16; + | ------------- similarly named associated type `Y` defined here +... LL | let _: ::N::NN; | ^ help: an associated type with a similar name exists: `Y` @@ -79,6 +88,9 @@ LL | let _: ::N::NN; error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:33:17 | +LL | type Y = u16; + | ------------- similarly named associated type `Y` defined here +... LL | ::N::NN; | ^ help: an associated type with a similar name exists: `Y` @@ -157,6 +169,9 @@ LL | ::NN; error[E0575]: expected associated type, found method `Dr::Z` --> $DIR/ufcs-partially-resolved.rs:52:12 | +LL | type X = u16; + | ------------- similarly named associated type `X` defined here +... LL | let _: ::Z; | ^^^^^^^^^^^^- | | @@ -165,6 +180,9 @@ LL | let _: ::Z; error[E0575]: expected method or associated constant, found associated type `Dr::X` --> $DIR/ufcs-partially-resolved.rs:53:5 | +LL | fn Z() {} + | --------- similarly named method `Z` defined here +... LL | ::X; | ^^^^^^^^^^^^- | | @@ -175,6 +193,9 @@ LL | ::X; error[E0575]: expected associated type, found method `Dr::Z` --> $DIR/ufcs-partially-resolved.rs:54:12 | +LL | type X = u16; + | ------------- similarly named associated type `X` defined here +... LL | let _: ::Z::N; | ^^^^^^^^^^^^-^^^ | | diff --git a/src/test/ui/ui-testing-optout.stderr b/src/test/ui/ui-testing-optout.stderr index 313e198e39e36..ff5bf6238e20b 100644 --- a/src/test/ui/ui-testing-optout.stderr +++ b/src/test/ui/ui-testing-optout.stderr @@ -2,17 +2,26 @@ error[E0412]: cannot find type `B` in this scope --> $DIR/ui-testing-optout.rs:4:10 | 4 | type A = B; - | ^ help: a type alias with a similar name exists: `A` + | ---------^- + | | | + | | help: a type alias with a similar name exists: `A` + | similarly named type alias `A` defined here error[E0412]: cannot find type `D` in this scope --> $DIR/ui-testing-optout.rs:10:10 | +4 | type A = B; + | ----------- similarly named type alias `A` defined here +... 10 | type C = D; | ^ help: a type alias with a similar name exists: `A` error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:95:10 | +4 | type A = B; + | ----------- similarly named type alias `A` defined here +... 95 | type E = F; | ^ help: a type alias with a similar name exists: `A`