Skip to content

Commit 8b778a5

Browse files
committed
Revert "Fix an ICE on an invalid binding @ ... in a tuple struct pattern"
This reverts commit f5e5eb6.
1 parent 438c59f commit 8b778a5

File tree

3 files changed

+9
-52
lines changed

3 files changed

+9
-52
lines changed

src/librustc_resolve/late.rs

+9-19
Original file line numberDiff line numberDiff line change
@@ -1510,30 +1510,20 @@ 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(|| {
1524+
self.fresh_binding(ident, pat.id, pat_src, bindings)
1525+
});
1526+
self.r.record_partial_res(pat.id, PartialRes::new(res));
15371527
}
15381528
PatKind::TupleStruct(ref path, ..) => {
15391529
self.smart_resolve_path(pat.id, None, path, PathSource::TupleStruct(pat.span));

src/test/ui/issues/issue-74539.rs

-12
This file was deleted.

src/test/ui/issues/issue-74539.stderr

-21
This file was deleted.

0 commit comments

Comments
 (0)