@@ -1506,18 +1506,24 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1506
1506
pat. walk ( & mut |pat| {
1507
1507
debug ! ( "resolve_pattern pat={:?} node={:?}" , pat, pat. kind) ;
1508
1508
match pat. kind {
1509
- // In tuple struct patterns ignore the invalid `ident @ ...`.
1510
- // It will be handled as an error by the AST lowering.
1511
- PatKind :: Ident ( bmode, ident, ref sub)
1512
- if !( is_tuple_struct_pat && sub. as_ref ( ) . filter ( |p| p. is_rest ( ) ) . is_some ( ) ) =>
1513
- {
1514
- // First try to resolve the identifier as some existing entity,
1515
- // then fall back to a fresh binding.
1516
- let has_sub = sub. is_some ( ) ;
1517
- let res = self
1518
- . try_resolve_as_non_binding ( pat_src, pat, bmode, ident, has_sub)
1519
- . unwrap_or_else ( || self . fresh_binding ( ident, pat. id , pat_src, bindings) ) ;
1520
- self . r . record_partial_res ( pat. id , PartialRes :: new ( res) ) ;
1509
+ PatKind :: Ident ( bmode, ident, ref sub) => {
1510
+ if is_tuple_struct_pat && sub. as_ref ( ) . filter ( |p| p. is_rest ( ) ) . is_some ( ) {
1511
+ // In tuple struct patterns ignore the invalid `ident @ ...`.
1512
+ // It will be handled as an error by the AST lowering.
1513
+ self . r
1514
+ . session
1515
+ . delay_span_bug ( ident. span , "ident in tuple pattern is invalid" ) ;
1516
+ } else {
1517
+ // First try to resolve the identifier as some existing entity,
1518
+ // then fall back to a fresh binding.
1519
+ let has_sub = sub. is_some ( ) ;
1520
+ let res = self
1521
+ . try_resolve_as_non_binding ( pat_src, pat, bmode, ident, has_sub)
1522
+ . unwrap_or_else ( || {
1523
+ self . fresh_binding ( ident, pat. id , pat_src, bindings)
1524
+ } ) ;
1525
+ self . r . record_partial_res ( pat. id , PartialRes :: new ( res) ) ;
1526
+ }
1521
1527
}
1522
1528
PatKind :: TupleStruct ( ref path, ..) => {
1523
1529
self . smart_resolve_path ( pat. id , None , path, PathSource :: TupleStruct ( pat. span ) ) ;
0 commit comments