@@ -188,7 +188,7 @@ crate enum PathSource<'a> {
188188 // Paths in struct expressions and patterns `Path { .. }`.
189189 Struct ,
190190 // Paths in tuple struct patterns `Path(..)`.
191- TupleStruct ( Span ) ,
191+ TupleStruct ( Span , & ' a [ Span ] ) ,
192192 // `m::A::B` in `<T as m::A>::B::C`.
193193 TraitItem ( Namespace ) ,
194194}
@@ -197,7 +197,7 @@ impl<'a> PathSource<'a> {
197197 fn namespace ( self ) -> Namespace {
198198 match self {
199199 PathSource :: Type | PathSource :: Trait ( _) | PathSource :: Struct => TypeNS ,
200- PathSource :: Expr ( ..) | PathSource :: Pat | PathSource :: TupleStruct ( _ ) => ValueNS ,
200+ PathSource :: Expr ( ..) | PathSource :: Pat | PathSource :: TupleStruct ( .. ) => ValueNS ,
201201 PathSource :: TraitItem ( ns) => ns,
202202 }
203203 }
@@ -208,7 +208,7 @@ impl<'a> PathSource<'a> {
208208 | PathSource :: Expr ( ..)
209209 | PathSource :: Pat
210210 | PathSource :: Struct
211- | PathSource :: TupleStruct ( _ ) => true ,
211+ | PathSource :: TupleStruct ( .. ) => true ,
212212 PathSource :: Trait ( _) | PathSource :: TraitItem ( ..) => false ,
213213 }
214214 }
@@ -219,7 +219,7 @@ impl<'a> PathSource<'a> {
219219 PathSource :: Trait ( _) => "trait" ,
220220 PathSource :: Pat => "unit struct, unit variant or constant" ,
221221 PathSource :: Struct => "struct, variant or union type" ,
222- PathSource :: TupleStruct ( _ ) => "tuple struct or tuple variant" ,
222+ PathSource :: TupleStruct ( .. ) => "tuple struct or tuple variant" ,
223223 PathSource :: TraitItem ( ns) => match ns {
224224 TypeNS => "associated type" ,
225225 ValueNS => "method or associated constant" ,
@@ -305,7 +305,7 @@ impl<'a> PathSource<'a> {
305305 | Res :: SelfCtor ( ..) => true ,
306306 _ => false ,
307307 } ,
308- PathSource :: TupleStruct ( _ ) => match res {
308+ PathSource :: TupleStruct ( .. ) => match res {
309309 Res :: Def ( DefKind :: Ctor ( _, CtorKind :: Fn ) , _) | Res :: SelfCtor ( ..) => true ,
310310 _ => false ,
311311 } ,
@@ -340,8 +340,8 @@ impl<'a> PathSource<'a> {
340340 ( PathSource :: Struct , false ) => error_code ! ( E0422 ) ,
341341 ( PathSource :: Expr ( ..) , true ) => error_code ! ( E0423 ) ,
342342 ( PathSource :: Expr ( ..) , false ) => error_code ! ( E0425 ) ,
343- ( PathSource :: Pat | PathSource :: TupleStruct ( _ ) , true ) => error_code ! ( E0532 ) ,
344- ( PathSource :: Pat | PathSource :: TupleStruct ( _ ) , false ) => error_code ! ( E0531 ) ,
343+ ( PathSource :: Pat | PathSource :: TupleStruct ( .. ) , true ) => error_code ! ( E0532 ) ,
344+ ( PathSource :: Pat | PathSource :: TupleStruct ( .. ) , false ) => error_code ! ( E0531 ) ,
345345 ( PathSource :: TraitItem ( ..) , true ) => error_code ! ( E0575 ) ,
346346 ( PathSource :: TraitItem ( ..) , false ) => error_code ! ( E0576 ) ,
347347 }
@@ -411,7 +411,7 @@ struct LateResolutionVisitor<'a, 'b, 'ast> {
411411}
412412
413413/// Walks the whole crate in DFS order, visiting each item, resolving names as it goes.
414- impl < ' a , ' ast > Visitor < ' ast > for LateResolutionVisitor < ' a , ' _ , ' ast > {
414+ impl < ' a : ' ast , ' ast > Visitor < ' ast > for LateResolutionVisitor < ' a , ' _ , ' ast > {
415415 fn visit_item ( & mut self , item : & ' ast Item ) {
416416 let prev = replace ( & mut self . diagnostic_metadata . current_item , Some ( item) ) ;
417417 // Always report errors in items we just entered.
@@ -659,7 +659,7 @@ impl<'a, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
659659 }
660660}
661661
662- impl < ' a , ' b , ' ast > LateResolutionVisitor < ' a , ' b , ' ast > {
662+ impl < ' a : ' ast , ' b , ' ast > LateResolutionVisitor < ' a , ' b , ' ast > {
663663 fn new ( resolver : & ' b mut Resolver < ' a > ) -> LateResolutionVisitor < ' a , ' b , ' ast > {
664664 // During late resolution we only track the module component of the parent scope,
665665 // although it may be useful to track other components as well for diagnostics.
@@ -1539,8 +1539,16 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
15391539 . unwrap_or_else ( || self . fresh_binding ( ident, pat. id , pat_src, bindings) ) ;
15401540 self . r . record_partial_res ( pat. id , PartialRes :: new ( res) ) ;
15411541 }
1542- PatKind :: TupleStruct ( ref path, ..) => {
1543- self . smart_resolve_path ( pat. id , None , path, PathSource :: TupleStruct ( pat. span ) ) ;
1542+ PatKind :: TupleStruct ( ref path, ref sub_patterns) => {
1543+ self . smart_resolve_path (
1544+ pat. id ,
1545+ None ,
1546+ path,
1547+ PathSource :: TupleStruct (
1548+ pat. span ,
1549+ self . r . arenas . alloc_pattern_spans ( sub_patterns. iter ( ) . map ( |p| p. span ) ) ,
1550+ ) ,
1551+ ) ;
15441552 }
15451553 PatKind :: Path ( ref qself, ref path) => {
15461554 self . smart_resolve_path ( pat. id , qself. as_ref ( ) , path, PathSource :: Pat ) ;
0 commit comments