@@ -170,8 +170,6 @@ pub enum ResolutionError<'a> {
170
170
NotAnAssociatedConst ( & ' a str ) ,
171
171
/// error E0421: unresolved associated const
172
172
UnresolvedAssociatedConst ( & ' a str ) ,
173
- /// error E0422: does not name a struct
174
- DoesNotNameAStruct ( & ' a str ) ,
175
173
/// error E0423: is a struct variant name, but this expression uses it like a function name
176
174
StructVariantUsedAsFunction ( & ' a str ) ,
177
175
/// error E0424: `self` is not available in a static method
@@ -412,13 +410,6 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
412
410
"unresolved associated const `{}`" ,
413
411
name)
414
412
}
415
- ResolutionError :: DoesNotNameAStruct ( name) => {
416
- struct_span_err ! ( resolver. session,
417
- span,
418
- E0422 ,
419
- "`{}` does not name a structure" ,
420
- name)
421
- }
422
413
ResolutionError :: StructVariantUsedAsFunction ( path_name) => {
423
414
struct_span_err ! ( resolver. session,
424
415
span,
@@ -2862,18 +2853,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2862
2853
}
2863
2854
2864
2855
PatStruct ( ref path, _, _) => {
2865
- match self . resolve_path ( pat_id, path , 0 , TypeNS , false ) {
2866
- Some ( definition) => {
2856
+ match self . resolve_possibly_assoc_item ( pat_id, None , path , TypeNS , false ) {
2857
+ ResolveAttempt ( Some ( definition) ) => {
2867
2858
self . record_def ( pattern. id , definition) ;
2868
2859
}
2869
- result => {
2870
- debug ! ( "(resolving pattern) didn't find struct def: {:?}" , result) ;
2871
- resolve_error (
2872
- self ,
2873
- path. span ,
2874
- ResolutionError :: DoesNotNameAStruct (
2875
- & * path_names_to_string ( path, 0 ) )
2876
- ) ;
2860
+ _ => {
2861
+ self . resolve_path ( pat_id, path, 0 , TypeNS , false ) ;
2877
2862
self . record_def ( pattern. id , err_path_resolution ( ) ) ;
2878
2863
}
2879
2864
}
@@ -3665,16 +3650,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
3665
3650
// Resolve the path to the structure it goes to. We don't
3666
3651
// check to ensure that the path is actually a structure; that
3667
3652
// is checked later during typeck.
3668
- match self . resolve_path ( expr. id , path, 0 , TypeNS , false ) {
3669
- Some ( definition) => self . record_def ( expr. id , definition) ,
3670
- None => {
3671
- debug ! ( "(resolving expression) didn't find struct def" , ) ;
3672
-
3673
- resolve_error ( self ,
3674
- path. span ,
3675
- ResolutionError :: DoesNotNameAStruct (
3676
- & * path_names_to_string ( path, 0 ) )
3677
- ) ;
3653
+ match self . resolve_possibly_assoc_item ( expr. id , None , path, TypeNS , false ) {
3654
+ ResolveAttempt ( Some ( definition) ) => self . record_def ( expr. id , definition) ,
3655
+ _ => {
3656
+ self . resolve_path ( expr. id , path, 0 , TypeNS , false ) ;
3678
3657
self . record_def ( expr. id , err_path_resolution ( ) ) ;
3679
3658
}
3680
3659
}
0 commit comments