Skip to content

Commit ba1e13f

Browse files
committed
Revert "structural_match: non-structural-match ty closures"
Reverts rust-lang#73353
1 parent c34fb51 commit ba1e13f

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
133133
traits::NonStructuralMatchTy::Generator => {
134134
"generators cannot be used in patterns".to_string()
135135
}
136-
traits::NonStructuralMatchTy::Closure => {
137-
"closures cannot be used in patterns".to_string()
138-
}
139136
traits::NonStructuralMatchTy::Param => {
140137
bug!("use of a constant whose type is a parameter inside a pattern")
141138
}

compiler/rustc_trait_selection/src/traits/structural_match.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub enum NonStructuralMatchTy<'tcx> {
1919
Opaque,
2020
Generator,
2121
Projection,
22-
Closure,
2322
}
2423

2524
/// This method traverses the structure of `ty`, trying to find an
@@ -155,9 +154,6 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> {
155154
ty::Generator(..) | ty::GeneratorWitness(..) => {
156155
return ControlFlow::Break(NonStructuralMatchTy::Generator);
157156
}
158-
ty::Closure(..) => {
159-
return ControlFlow::Break(NonStructuralMatchTy::Closure);
160-
}
161157
ty::RawPtr(..) => {
162158
// structural-match ignores substructure of
163159
// `*const _`/`*mut _`, so skip `super_visit_with`.
@@ -198,7 +194,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> {
198194
// First check all contained types and then tell the caller to continue searching.
199195
return ty.super_visit_with(self);
200196
}
201-
ty::Infer(_) | ty::Placeholder(_) | ty::Bound(..) => {
197+
ty::Closure(..) | ty::Infer(_) | ty::Placeholder(_) | ty::Bound(..) => {
202198
bug!("unexpected type during structural-match checking: {:?}", ty);
203199
}
204200
ty::Error(_) => {

0 commit comments

Comments
 (0)