@@ -2709,43 +2709,21 @@ impl<'a> Resolver<'a> {
27092709 if is_expected ( ctor_def) && !accessible_ctor {
27102710 err. span_label ( span, format ! ( "constructor is not visible \
27112711 here due to private fields") ) ;
2712- } else if accessible_ctor {
2713- let block = match ctor_def {
2714- Def :: StructCtor ( _, CtorKind :: Fn ) => "(/* fields */)" ,
2715- Def :: StructCtor ( _, CtorKind :: Const ) => "" ,
2716- Def :: Struct ( ..) => " { /* fields */ }" ,
2717- def => bug ! ( "found def `{:?}` when looking for a ctor" , def) ,
2718- } ;
2719- err. span_label ( span, format ! ( "did you mean `{}{}`?" ,
2720- path_str,
2721- block) ) ;
27222712 }
27232713 } else {
27242714 err. span_label ( span, format ! ( "did you mean `{} {{ /* fields */ }}`?" ,
27252715 path_str) ) ;
27262716 }
27272717 return ( err, candidates) ;
27282718 }
2729- ( Def :: VariantCtor ( _, CtorKind :: Const ) , _) => {
2730- err. span_label ( span, format ! ( "did you mean `{}`?" , path_str) ) ;
2731- return ( err, candidates) ;
2732- }
2733- ( Def :: VariantCtor ( _, CtorKind :: Fn ) , _) => {
2734- err. span_label ( span, format ! ( "did you mean `{}( /* fields */ )`?" ,
2735- path_str) ) ;
2736- return ( err, candidates) ;
2737- }
2738- ( Def :: VariantCtor ( _, CtorKind :: Fictive ) , _) => {
2739- err. span_label ( span, format ! ( "did you mean `{} {{ /* fields */ }}`?" ,
2740- path_str) ) ;
2741- return ( err, candidates) ;
2742- }
27432719 ( Def :: SelfTy ( ..) , _) if ns == ValueNS => {
27442720 err. note ( "can't use `Self` as a constructor, you must use the \
27452721 implemented struct") ;
2722+ return ( err, candidates) ;
27462723 }
2747- ( Def :: TyAlias ( _def_id ) , _) => {
2724+ ( Def :: TyAlias ( _ ) , _) if ns == ValueNS => {
27482725 err. note ( "can't use a type alias as a constructor" ) ;
2726+ return ( err, candidates) ;
27492727 }
27502728 _ => { }
27512729 }
0 commit comments