Revert "structural_match: non-structural-match ty closures"
Reverts #73353
This commit is contained in:
parent
c34fb5167e
commit
ba1e13fa66
@ -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")
|
||||
}
|
||||
|
@ -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(_) => {
|
||||
|
Loading…
Reference in New Issue
Block a user