@@ -1510,30 +1510,20 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1510
1510
pat_src : PatternSource ,
1511
1511
bindings : & mut SmallVec < [ ( PatBoundCtx , FxHashSet < Ident > ) ; 1 ] > ,
1512
1512
) {
1513
- let is_tuple_struct_pat = matches ! ( pat. kind, PatKind :: TupleStruct ( _, _) ) ;
1514
-
1515
1513
// Visit all direct subpatterns of this pattern.
1516
1514
pat. walk ( & mut |pat| {
1517
1515
debug ! ( "resolve_pattern pat={:?} node={:?}" , pat, pat. kind) ;
1518
1516
match pat. kind {
1519
1517
PatKind :: Ident ( bmode, ident, ref sub) => {
1520
- if is_tuple_struct_pat && sub. as_ref ( ) . filter ( |p| p. is_rest ( ) ) . is_some ( ) {
1521
- // In tuple struct patterns ignore the invalid `ident @ ...`.
1522
- // It will be handled as an error by the AST lowering.
1523
- self . r
1524
- . session
1525
- . delay_span_bug ( ident. span , "ident in tuple pattern is invalid" ) ;
1526
- } else {
1527
- // First try to resolve the identifier as some existing entity,
1528
- // then fall back to a fresh binding.
1529
- let has_sub = sub. is_some ( ) ;
1530
- let res = self
1531
- . try_resolve_as_non_binding ( pat_src, pat, bmode, ident, has_sub)
1532
- . unwrap_or_else ( || {
1533
- self . fresh_binding ( ident, pat. id , pat_src, bindings)
1534
- } ) ;
1535
- self . r . record_partial_res ( pat. id , PartialRes :: new ( res) ) ;
1536
- }
1518
+ // First try to resolve the identifier as some existing entity,
1519
+ // then fall back to a fresh binding.
1520
+ let has_sub = sub. is_some ( ) ;
1521
+ let res = self
1522
+ . try_resolve_as_non_binding ( pat_src, pat, bmode, ident, has_sub)
1523
+ . unwrap_or_else ( || {
1524
+ self . fresh_binding ( ident, pat. id , pat_src, bindings)
1525
+ } ) ;
1526
+ self . r . record_partial_res ( pat. id , PartialRes :: new ( res) ) ;
1537
1527
}
1538
1528
PatKind :: TupleStruct ( ref path, ..) => {
1539
1529
self . smart_resolve_path ( pat. id , None , path, PathSource :: TupleStruct ( pat. span ) ) ;
0 commit comments