@@ -188,7 +188,7 @@ crate enum PathSource<'a> {
188
188
// Paths in struct expressions and patterns `Path { .. }`.
189
189
Struct ,
190
190
// Paths in tuple struct patterns `Path(..)`.
191
- TupleStruct ( Span ) ,
191
+ TupleStruct ( Span , & ' a [ Span ] ) ,
192
192
// `m::A::B` in `<T as m::A>::B::C`.
193
193
TraitItem ( Namespace ) ,
194
194
}
@@ -197,7 +197,7 @@ impl<'a> PathSource<'a> {
197
197
fn namespace ( self ) -> Namespace {
198
198
match self {
199
199
PathSource :: Type | PathSource :: Trait ( _) | PathSource :: Struct => TypeNS ,
200
- PathSource :: Expr ( ..) | PathSource :: Pat | PathSource :: TupleStruct ( _ ) => ValueNS ,
200
+ PathSource :: Expr ( ..) | PathSource :: Pat | PathSource :: TupleStruct ( .. ) => ValueNS ,
201
201
PathSource :: TraitItem ( ns) => ns,
202
202
}
203
203
}
@@ -208,7 +208,7 @@ impl<'a> PathSource<'a> {
208
208
| PathSource :: Expr ( ..)
209
209
| PathSource :: Pat
210
210
| PathSource :: Struct
211
- | PathSource :: TupleStruct ( _ ) => true ,
211
+ | PathSource :: TupleStruct ( .. ) => true ,
212
212
PathSource :: Trait ( _) | PathSource :: TraitItem ( ..) => false ,
213
213
}
214
214
}
@@ -219,7 +219,7 @@ impl<'a> PathSource<'a> {
219
219
PathSource :: Trait ( _) => "trait" ,
220
220
PathSource :: Pat => "unit struct, unit variant or constant" ,
221
221
PathSource :: Struct => "struct, variant or union type" ,
222
- PathSource :: TupleStruct ( _ ) => "tuple struct or tuple variant" ,
222
+ PathSource :: TupleStruct ( .. ) => "tuple struct or tuple variant" ,
223
223
PathSource :: TraitItem ( ns) => match ns {
224
224
TypeNS => "associated type" ,
225
225
ValueNS => "method or associated constant" ,
@@ -305,7 +305,7 @@ impl<'a> PathSource<'a> {
305
305
| Res :: SelfCtor ( ..) => true ,
306
306
_ => false ,
307
307
} ,
308
- PathSource :: TupleStruct ( _ ) => match res {
308
+ PathSource :: TupleStruct ( .. ) => match res {
309
309
Res :: Def ( DefKind :: Ctor ( _, CtorKind :: Fn ) , _) | Res :: SelfCtor ( ..) => true ,
310
310
_ => false ,
311
311
} ,
@@ -340,8 +340,8 @@ impl<'a> PathSource<'a> {
340
340
( PathSource :: Struct , false ) => error_code ! ( E0422 ) ,
341
341
( PathSource :: Expr ( ..) , true ) => error_code ! ( E0423 ) ,
342
342
( 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 ) ,
345
345
( PathSource :: TraitItem ( ..) , true ) => error_code ! ( E0575 ) ,
346
346
( PathSource :: TraitItem ( ..) , false ) => error_code ! ( E0576 ) ,
347
347
}
@@ -411,7 +411,7 @@ struct LateResolutionVisitor<'a, 'b, 'ast> {
411
411
}
412
412
413
413
/// 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 > {
415
415
fn visit_item ( & mut self , item : & ' ast Item ) {
416
416
let prev = replace ( & mut self . diagnostic_metadata . current_item , Some ( item) ) ;
417
417
// Always report errors in items we just entered.
@@ -659,7 +659,7 @@ impl<'a, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
659
659
}
660
660
}
661
661
662
- impl < ' a , ' b , ' ast > LateResolutionVisitor < ' a , ' b , ' ast > {
662
+ impl < ' a : ' ast , ' b , ' ast > LateResolutionVisitor < ' a , ' b , ' ast > {
663
663
fn new ( resolver : & ' b mut Resolver < ' a > ) -> LateResolutionVisitor < ' a , ' b , ' ast > {
664
664
// During late resolution we only track the module component of the parent scope,
665
665
// 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> {
1539
1539
. unwrap_or_else ( || self . fresh_binding ( ident, pat. id , pat_src, bindings) ) ;
1540
1540
self . r . record_partial_res ( pat. id , PartialRes :: new ( res) ) ;
1541
1541
}
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
+ ) ;
1544
1552
}
1545
1553
PatKind :: Path ( ref qself, ref path) => {
1546
1554
self . smart_resolve_path ( pat. id , qself. as_ref ( ) , path, PathSource :: Pat ) ;
0 commit comments