@@ -1510,30 +1510,18 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
15101510 pat_src : PatternSource ,
15111511 bindings : & mut SmallVec < [ ( PatBoundCtx , FxHashSet < Ident > ) ; 1 ] > ,
15121512 ) {
1513- let is_tuple_struct_pat = matches ! ( pat. kind, PatKind :: TupleStruct ( _, _) ) ;
1514-
15151513 // Visit all direct subpatterns of this pattern.
15161514 pat. walk ( & mut |pat| {
15171515 debug ! ( "resolve_pattern pat={:?} node={:?}" , pat, pat. kind) ;
15181516 match pat. kind {
15191517 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 ( || self . fresh_binding ( ident, pat. id , pat_src, bindings) ) ;
1524+ self . r . record_partial_res ( pat. id , PartialRes :: new ( res) ) ;
15371525 }
15381526 PatKind :: TupleStruct ( ref path, ..) => {
15391527 self . smart_resolve_path ( pat. id , None , path, PathSource :: TupleStruct ( pat. span ) ) ;
0 commit comments