From b26ddb8af37362e33c45c78c9c91a3c5cdabfe7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 14 Oct 2019 17:20:50 -0700 Subject: [PATCH] Point at local similarly named element and tweak references to variants Point at the span for the definition of ADTs internal to the current crate. Look at the leading char of the ident to determine whether we're expecting a likely fn or any of a fn, a tuple struct or a tuple variant. Turn fn `add_typo_suggestion` into a `Resolver` method. --- src/librustc_resolve/build_reduced_graph.rs | 20 ++--- src/librustc_resolve/diagnostics.rs | 44 +++++++---- src/librustc_resolve/error_codes.rs | 7 +- src/librustc_resolve/late.rs | 25 ++++-- src/librustc_resolve/late/diagnostics.rs | 21 ++--- src/librustc_typeck/check/mod.rs | 2 +- src/librustc_typeck/check/pat.rs | 8 +- src/librustc_typeck/error_codes.rs | 5 +- .../associated-types-eq-1.stderr | 2 + src/test/ui/class-missing-self.rs | 2 +- .../struct-with-invalid-const-param.stderr | 5 +- .../issue-43871-enum-instead-of-variant.rs | 10 +-- ...issue-43871-enum-instead-of-variant.stderr | 10 +-- src/test/ui/empty/empty-struct-braces-expr.rs | 9 ++- .../ui/empty/empty-struct-braces-expr.stderr | 20 ++--- .../ui/empty/empty-struct-braces-pat-1.rs | 4 +- .../ui/empty/empty-struct-braces-pat-1.stderr | 4 +- .../ui/empty/empty-struct-braces-pat-2.rs | 8 +- .../ui/empty/empty-struct-braces-pat-2.stderr | 8 +- .../ui/empty/empty-struct-braces-pat-3.rs | 8 +- .../ui/empty/empty-struct-braces-pat-3.stderr | 8 +- src/test/ui/empty/empty-struct-tuple-pat.rs | 4 +- .../ui/empty/empty-struct-tuple-pat.stderr | 4 +- src/test/ui/empty/empty-struct-unit-pat.rs | 21 +++-- .../ui/empty/empty-struct-unit-pat.stderr | 32 ++++---- src/test/ui/enums-pats-not-idents.rs | 2 +- src/test/ui/enums-pats-not-idents.stderr | 2 +- src/test/ui/error-codes/E0164.stderr | 2 +- src/test/ui/error-codes/E0423.stderr | 22 ++++-- src/test/ui/error-codes/E0424.stderr | 2 +- src/test/ui/error-codes/E0532.rs | 2 +- src/test/ui/error-codes/E0532.stderr | 4 +- src/test/ui/fn-in-pat.rs | 2 +- src/test/ui/fn-in-pat.stderr | 2 +- src/test/ui/glob-resolve1.stderr | 9 +++ ...elude-extern-crate-restricted-shadowing.rs | 2 + ...e-extern-crate-restricted-shadowing.stderr | 14 ++-- src/test/ui/issues/issue-10200.rs | 2 +- src/test/ui/issues/issue-10200.stderr | 5 +- src/test/ui/issues/issue-12863.rs | 3 +- src/test/ui/issues/issue-12863.stderr | 4 +- src/test/ui/issues/issue-17933.rs | 2 +- src/test/ui/issues/issue-17933.stderr | 4 +- src/test/ui/issues/issue-19086.rs | 2 +- src/test/ui/issues/issue-19086.stderr | 2 +- src/test/ui/issues/issue-27033.rs | 2 + src/test/ui/issues/issue-27033.stderr | 9 ++- src/test/ui/issues/issue-28992-empty.rs | 4 +- src/test/ui/issues/issue-28992-empty.stderr | 6 +- src/test/ui/issues/issue-31845.stderr | 7 +- src/test/ui/issues/issue-32004.rs | 4 +- src/test/ui/issues/issue-32004.stderr | 8 +- src/test/ui/issues/issue-32086.rs | 4 +- src/test/ui/issues/issue-32086.stderr | 10 ++- src/test/ui/issues/issue-35675.rs | 4 +- src/test/ui/issues/issue-35675.stderr | 4 +- src/test/ui/issues/issue-38412.rs | 2 +- src/test/ui/issues/issue-38412.stderr | 2 +- src/test/ui/issues/issue-42944.rs | 6 +- src/test/ui/issues/issue-42944.stderr | 6 +- src/test/ui/issues/issue-46332.stderr | 3 + src/test/ui/issues/issue-55587.rs | 2 +- src/test/ui/issues/issue-55587.stderr | 2 +- src/test/ui/issues/issue-56835.rs | 2 +- src/test/ui/issues/issue-56835.stderr | 2 +- src/test/ui/issues/issue-58022.rs | 3 +- src/test/ui/issues/issue-58022.stderr | 4 +- src/test/ui/issues/issue-5927.rs | 2 +- src/test/ui/issues/issue-5927.stderr | 2 +- src/test/ui/issues/issue-63983.rs | 4 +- src/test/ui/issues/issue-63983.stderr | 4 +- .../ui/issues/issue-64792-bad-unicode-ctor.rs | 2 +- .../issue-64792-bad-unicode-ctor.stderr | 11 +-- src/test/ui/issues/issue-pr29383.rs | 6 +- src/test/ui/issues/issue-pr29383.stderr | 10 +-- .../ui/keyword/keyword-self-as-identifier.rs | 2 +- .../keyword/keyword-self-as-identifier.stderr | 2 +- src/test/ui/macros/macro_undefined.stderr | 9 ++- src/test/ui/match/match-fn-call.rs | 4 +- src/test/ui/match/match-fn-call.stderr | 4 +- .../match/match-pattern-field-mismatch-2.rs | 2 +- .../match-pattern-field-mismatch-2.stderr | 4 +- .../ui/match/match-pattern-field-mismatch.rs | 2 +- src/test/ui/methods/method-path-in-pattern.rs | 12 +-- .../ui/methods/method-path-in-pattern.stderr | 12 +-- .../method-resolvable-path-in-pattern.rs | 2 +- .../method-resolvable-path-in-pattern.stderr | 4 +- src/test/ui/namespace/namespace-mix.stderr | 5 ++ .../ui/parser/recover-from-bad-variant.rs | 2 +- .../ui/parser/recover-from-bad-variant.stderr | 2 +- src/test/ui/pattern/pattern-error-continue.rs | 2 +- .../ui/pattern/pattern-error-continue.stderr | 5 +- src/test/ui/privacy/privacy-ns1.rs | 4 +- src/test/ui/privacy/privacy-ns1.stderr | 16 +++- src/test/ui/privacy/privacy-ns2.rs | 4 +- src/test/ui/privacy/privacy-ns2.stderr | 12 ++- src/test/ui/proc-macro/parent-source-spans.rs | 2 - .../ui/proc-macro/parent-source-spans.stderr | 42 +++++----- src/test/ui/proc-macro/resolve-error.stderr | 18 ++++- .../ui/qualified/qualified-path-params.rs | 2 +- .../ui/qualified/qualified-path-params.stderr | 2 +- .../ui/resolve/enums-are-namespaced-xc.rs | 2 +- .../ui/resolve/enums-are-namespaced-xc.stderr | 2 +- src/test/ui/resolve/issue-18252.rs | 2 +- src/test/ui/resolve/issue-18252.stderr | 2 +- src/test/ui/resolve/issue-5035.stderr | 3 + src/test/ui/resolve/issue-6702.rs | 3 +- src/test/ui/resolve/issue-6702.stderr | 2 +- src/test/ui/resolve/levenshtein.stderr | 15 ++++ src/test/ui/resolve/privacy-enum-ctor.stderr | 76 ++++++++++++++++--- .../ui/resolve/privacy-struct-ctor.stderr | 3 + .../ui/resolve/resolve-assoc-suggestions.rs | 6 +- .../resolve/resolve-assoc-suggestions.stderr | 6 +- ...uggest-path-instead-of-mod-dot-item.stderr | 15 ++++ src/test/ui/resolve/tuple-struct-alias.rs | 2 +- src/test/ui/resolve/tuple-struct-alias.stderr | 10 ++- src/test/ui/rfc-2008-non-exhaustive/struct.rs | 2 +- .../ui/rfc-2008-non-exhaustive/struct.stderr | 2 +- .../keyword-crate-as-identifier.rs | 2 +- .../keyword-crate-as-identifier.stderr | 4 +- src/test/ui/self/self_type_keyword-2.rs | 6 +- src/test/ui/self/self_type_keyword-2.stderr | 6 +- src/test/ui/self/self_type_keyword.rs | 2 +- src/test/ui/self/self_type_keyword.stderr | 2 +- .../fn-or-tuple-struct-without-args.stderr | 2 + .../ui/traits/trait-impl-for-module.stderr | 8 +- ...t-variant-form-through-Self-issue-58006.rs | 2 +- ...riant-form-through-Self-issue-58006.stderr | 2 +- ...rrect-variant-form-through-alias-caught.rs | 8 +- ...t-variant-form-through-alias-caught.stderr | 8 +- .../ui/ufcs/ufcs-partially-resolved.stderr | 21 +++++ src/test/ui/ui-testing-optout.stderr | 11 ++- 132 files changed, 600 insertions(+), 331 deletions(-) diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index c0fb8e33a819..5a885135dfd0 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 7634093fbefb..511221e143b1 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 be2e9f505aa6..9515c87ce4bb 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 136ab1f0444f..faf7696288bd 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 2721df4c6876..71a6f0d464d9 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 96a097695fa1..f7132cd868aa 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 97c30f208f5e..950ae7c1d62e 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 75b508a1bbf0..ae67f54ac122 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 aa987316801a..66c5f34644c0 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 515754e54fe0..8ad347d20e6e 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 b3aa35e079ae..a96b071c05f4 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 7d3aba364897..9602d2746942 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 0a2fbe4918f1..2140fd3a5a03 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 e33fcb70db77..1a38d3d7601b 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 971215755271..f427c1ba0adf 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 81062320fe47..9bed93f9c153 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 271e811a2fd6..9b5f31157d1b 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 187d953d805e..cfe4641f3560 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 335247378889..0b3c9ae51519 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 fad28d78fe55..54d547eefcc9 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 aefdd772b1bf..785396c448bb 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 00a48594e93a..47da8a306a4b 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 4b828c0d942e..cfbb468e5e63 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 8a0e2f505e44..44a1e9e3d93b 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 268fc7a6e0c1..fd41a6ed3828 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 1593f1e1b16e..5b918eef6d65 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 6b1e6046260a..072b88716ad7 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 0a153d85b421..4bbddb1978cc 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 4e016dbd1c02..09792845d162 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 567d1b3cc75f..690a101496d7 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 931ca4628fe1..486da0e029ef 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 887ede0a4124..eeccadccc636 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 ed76b2c5db02..b83252012b8f 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 0bb24365ef42..70f84993acfe 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 ddd1e0954893..3db24431586d 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 6ff3ab73639c..ce8c2d5168fb 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 e8dfd43b6767..8e01fc8df3de 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 12867a878f31..fe36a7e00bff 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 b1057d45869a..e60489f5b82f 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 d7941a70d51f..1ac1c3d818e5 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 bec70a5fb95a..9c29a37cb930 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 c649b64dcd44..6da4e6e15284 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 e48a65087f4a..33534d3f8f6a 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 9802814a87a5..cc83874cb16c 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 e2229cbc2092..27992da0ebd2 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 a23819a20f9a..bcb06d743a05 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 ab9543322803..a4baa7bdf7f8 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 22961fc61d13..f61daa94c5d7 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 9f9f574aa5dd..a4311880bcbe 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 10cb398cb24f..75d8859961a0 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 aeddb00e2b04..b3493508c5a9 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 e9a5e217392a..ab723e26680d 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 3188377584dc..d595d1dd7e6d 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 b5a120c4b9ce..e566dea89088 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 fae5cdc0733f..7876811a9ac3 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 8072141aefd2..a9a27da55b1a 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 a7c818d9bcb7..058e1be75657 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 c44a0bfc8b02..318c92ad35fc 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 9d746673f4da..cc365dc4c938 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 4ab272b9e9b3..c71194f41c11 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 c7e9d71700e6..5d8a859a7379 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 8b78749f6529..d9100cf555b3 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 3928a3cd5320..307227e1c4d1 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 4f976da680e6..7132d15ee5fb 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 f9fdf23af971..c200ba8d52a3 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 c6dd45e6cf3e..30527903ed0f 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 71bad7b81fa8..a3e4cb632024 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 847936cc9540..14f95827be8e 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 3d4550ec8b23..d6cd6853dbdb 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 c1c79091fc80..ab952666fd1d 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 8949c475b6f7..e54466faedde 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 7bce57923a5b..f1427ef46e92 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 ae9025bb041a..44e5d38abbc5 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 334fdacb81ec..2bcc0aa2782d 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 9695e1e3c07f..e92fd6c2fdc5 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 b30002cddafe..72e4f01e21ed 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 be57c6ad26fd..060e7c3eafc2 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 01c8ebea62a2..b2caba893e07 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 d9c50e75c494..99092602c964 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 bd918428351b..611904e6e91a 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 3351c756a314..fa03cdac29fc 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 a42d62e80297..cfffcd13851b 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 1266aec6220f..a4fa97fef38e 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 21a91f3f32b2..49f5e09edf45 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 257fff4c37dc..b290c34d5277 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 1d373cfa6a76..c05160792d36 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 f631c9217202..4b25b694e13a 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 c3f2c79fdd21..0484661a2e15 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 35088fb30688..27b03c0c2db2 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 32bb88d31c4c..375e2d545448 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 7e79868f874d..79cc4b552a71 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 4fbc630644ba..5a7dab30d83b 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 91cf8e816199..3326b12ffa53 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 16da57a78e09..3c766a33baae 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 c4e400f5adbd..788a36fd92ca 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 f0d5da686859..48e06821cd61 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 799f1de586ed..7b2ffefb05b1 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 423122539c80..3e54a71f0e81 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 3dca5cee63ca..02c82c01ed3e 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 ea2ae0e86bf6..b1b60b4b73fb 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 3e8fcdc7ca3e..92792f2e86a8 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 4c660c27e3b1..dfc16d6ce443 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 092051ed874e..61816709ecc5 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 894762115ab1..af0a3cbcb2d8 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 c76e5ef8b361..39b444498102 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 96befdbe0733..1674c166ddac 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 6469c7ec29fa..954dc36f38e3 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 3fdc7acb274e..252d50c70f8c 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 e693a0ef91fc..8d8f3f35211e 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 b7cc79cfed9e..8a450ab85e92 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 51928c32e31f..f1a1de4d9c0f 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 8cdbe64af0d8..ee9bce60ce63 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 f3b8909ab223..a05ac0f85439 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 9a3d5feee042..33080340cb67 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 65977e1110c5..298e7e479983 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 02af357a2c32..5a7873301c8c 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 cf383a260e04..8cff35c4bc5e 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 04cfe51cab02..944965a15e3d 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 ab87ecbde30e..d52ac7ec3c39 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 e07b5d80fb80..acbb4cf1a694 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 dde5762fd780..cfb87f5186d3 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 560c6d2199ca..4e931f91f70c 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 dfb7d6583d9d..b42bf8eea1a1 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 e3b871bd8676..fa603276c8eb 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 1af0f7a191e8..56810a491586 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 c62bcfca94de..4b3c930dccd4 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 c1e56fc4caa9..ab40bf580ea8 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 357b33de51b8..cfe273b9dd25 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 ce45d59198af..efdbebf26621 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 801ca5f013b3..17efc08c6327 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 dee990ec3d1c..dbd41da6daf0 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 313e198e39e3..ff5bf6238e20 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`