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 => {
"generators cannot be used in patterns".to_string()
}
traits::NonStructuralMatchTy::Closure => {
"closures cannot be used in patterns".to_string()
}
traits::NonStructuralMatchTy::Param => {
bug!("use of a constant whose type is a parameter inside a pattern")
}

View File

@ -19,7 +19,6 @@ pub enum NonStructuralMatchTy<'tcx> {
Opaque,
Generator,
Projection,
Closure,
}
/// 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(..) => {
return ControlFlow::Break(NonStructuralMatchTy::Generator);
}
ty::Closure(..) => {
return ControlFlow::Break(NonStructuralMatchTy::Closure);
}
ty::RawPtr(..) => {
// structural-match ignores substructure of
// `*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.
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);
}
ty::Error(_) => {