@@ -1415,16 +1415,22 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1415
1415
match pat. kind {
1416
1416
// In tuple struct patterns ignore the invalid `ident @ ...`.
1417
1417
// It will be handled as an error by the AST lowering.
1418
- PatKind :: Ident ( bmode, ident, ref sub)
1419
- if !( is_tuple_struct_pat && sub. as_ref ( ) . filter ( |p| p. is_rest ( ) ) . is_some ( ) ) =>
1420
- {
1421
- // First try to resolve the identifier as some existing entity,
1422
- // then fall back to a fresh binding.
1423
- let has_sub = sub. is_some ( ) ;
1424
- let res = self
1425
- . try_resolve_as_non_binding ( pat_src, pat, bmode, ident, has_sub)
1426
- . unwrap_or_else ( || self . fresh_binding ( ident, pat. id , pat_src, bindings) ) ;
1427
- self . r . record_partial_res ( pat. id , PartialRes :: new ( res) ) ;
1418
+ PatKind :: Ident ( bmode, ident, ref sub) => {
1419
+ if is_tuple_struct_pat && sub. as_ref ( ) . filter ( |p| p. is_rest ( ) ) . is_some ( ) {
1420
+ self . r
1421
+ . session
1422
+ . delay_span_bug ( ident. span , "ident in tuple pattern is invalid" ) ;
1423
+ } else {
1424
+ // First try to resolve the identifier as some existing entity,
1425
+ // then fall back to a fresh binding.
1426
+ let has_sub = sub. is_some ( ) ;
1427
+ let res = self
1428
+ . try_resolve_as_non_binding ( pat_src, pat, bmode, ident, has_sub)
1429
+ . unwrap_or_else ( || {
1430
+ self . fresh_binding ( ident, pat. id , pat_src, bindings)
1431
+ } ) ;
1432
+ self . r . record_partial_res ( pat. id , PartialRes :: new ( res) ) ;
1433
+ }
1428
1434
}
1429
1435
PatKind :: TupleStruct ( ref path, ..) => {
1430
1436
self . smart_resolve_path ( pat. id , None , path, PathSource :: TupleStruct ) ;
0 commit comments