Revert "structural_match: non-structural-match ty closures"

Reverts #73353
This commit is contained in:
Santiago Pastorino 2021-07-14 19:00:48 -03:00
parent c34fb5167e
commit ba1e13fa66
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF
2 changed files with 1 additions and 8 deletions

View File

@ -133,9 +133,6 @@ fn search_for_structural_match_violation(&self, ty: Ty<'tcx>) -> Option<String>
traits::NonStructuralMatchTy::Generator => { traits::NonStructuralMatchTy::Generator => {
"generators cannot be used in patterns".to_string() "generators cannot be used in patterns".to_string()
} }
traits::NonStructuralMatchTy::Closure => {
"closures cannot be used in patterns".to_string()
}
traits::NonStructuralMatchTy::Param => { traits::NonStructuralMatchTy::Param => {
bug!("use of a constant whose type is a parameter inside a pattern") bug!("use of a constant whose type is a parameter inside a pattern")
} }

View File

@ -19,7 +19,6 @@ pub enum NonStructuralMatchTy<'tcx> {
Opaque, Opaque,
Generator, Generator,
Projection, Projection,
Closure,
} }
/// This method traverses the structure of `ty`, trying to find an /// This method traverses the structure of `ty`, trying to find an
@ -155,9 +154,6 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
ty::Generator(..) | ty::GeneratorWitness(..) => { ty::Generator(..) | ty::GeneratorWitness(..) => {
return ControlFlow::Break(NonStructuralMatchTy::Generator); return ControlFlow::Break(NonStructuralMatchTy::Generator);
} }
ty::Closure(..) => {
return ControlFlow::Break(NonStructuralMatchTy::Closure);
}
ty::RawPtr(..) => { ty::RawPtr(..) => {
// structural-match ignores substructure of // structural-match ignores substructure of
// `*const _`/`*mut _`, so skip `super_visit_with`. // `*const _`/`*mut _`, so skip `super_visit_with`.
@ -198,7 +194,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
// First check all contained types and then tell the caller to continue searching. // First check all contained types and then tell the caller to continue searching.
return ty.super_visit_with(self); return ty.super_visit_with(self);
} }
ty::Infer(_) | ty::Placeholder(_) | ty::Bound(..) => { ty::Closure(..) | ty::Infer(_) | ty::Placeholder(_) | ty::Bound(..) => {
bug!("unexpected type during structural-match checking: {:?}", ty); bug!("unexpected type during structural-match checking: {:?}", ty);
} }
ty::Error(_) => { ty::Error(_) => {