From 067405044cb682f1d01c8665e81287c23dd3655f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 20 Jan 2018 12:02:40 -0800 Subject: [PATCH] Fix tests by keepeing needed suggestions --- src/librustc_resolve/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 889b6de7bfa81..dcd9d3e871323 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -2716,12 +2716,20 @@ impl<'a> Resolver<'a> { } return (err, candidates); } + (Def::Union(..), _) | + (Def::Variant(..), _) | + (Def::VariantCtor(_, CtorKind::Fictive), _) if ns == ValueNS => { + err.span_label(span, format!("did you mean `{} {{ /* fields */ }}`?", + path_str)); + return (err, candidates); + } (Def::SelfTy(..), _) if ns == ValueNS => { + err.span_label(span, fallback_label); err.note("can't use `Self` as a constructor, you must use the \ implemented struct"); return (err, candidates); } - (Def::TyAlias(_), _) if ns == ValueNS => { + (Def::TyAlias(_), _) | (Def::AssociatedTy(..), _) if ns == ValueNS => { err.note("can't use a type alias as a constructor"); return (err, candidates); }