@@ -164,12 +164,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
164164 } ;
165165
166166 match error {
167- MethodError :: NoMatch ( NoMatchData { static_candidates : static_sources,
168- unsatisfied_predicates,
169- out_of_scope_traits,
170- lev_candidate,
171- mode,
172- .. } ) => {
167+ MethodError :: NoMatch ( NoMatchData {
168+ static_candidates : static_sources,
169+ unsatisfied_predicates,
170+ out_of_scope_traits,
171+ lev_candidate,
172+ mode,
173+ ..
174+ } ) => {
173175 let tcx = self . tcx ;
174176
175177 let actual = self . resolve_type_vars_if_possible ( & rcvr_ty) ;
@@ -179,18 +181,19 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
179181 current scope",
180182 if mode == Mode :: MethodCall {
181183 "method"
184+ } else if actual. is_enum( ) {
185+ "variant"
182186 } else {
183- match item_name. as_str( ) . chars( ) . next( ) {
184- Some ( name) => {
185- if name. is_lowercase( ) {
186- "function or associated item"
187- } else {
188- "associated item"
189- }
190- } ,
191- None => {
192- ""
193- } ,
187+ let fresh_ty = actual. is_fresh_ty( ) ;
188+ match ( item_name. as_str( ) . chars( ) . next( ) , fresh_ty) {
189+ ( Some ( name) , false ) if name. is_lowercase( ) => {
190+ "function or associated item"
191+ }
192+ ( Some ( _) , false ) => "associated item" ,
193+ ( Some ( _) , true ) | ( None , false ) => {
194+ "variant or associated item"
195+ }
196+ ( None , true ) => "variant" ,
194197 }
195198 } ,
196199 item_name,
0 commit comments