Skip to content

Commit 4b277c5

Browse files
Revert "delay_span_bug instead of silent ignore"
This reverts commit d01e109.
1 parent c367798 commit 4b277c5

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/librustc_resolve/late.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,22 +1415,16 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
14151415
match pat.kind {
14161416
// In tuple struct patterns ignore the invalid `ident @ ...`.
14171417
// 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-
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-
}
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));
14341428
}
14351429
PatKind::TupleStruct(ref path, ..) => {
14361430
self.smart_resolve_path(pat.id, None, path, PathSource::TupleStruct);

0 commit comments

Comments
 (0)