diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2021-07-14 19:00:48 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2021-07-18 09:30:10 -0300 |
| commit | ba1e13fa668ee8e634030c90714a091d8dbfc73a (patch) | |
| tree | 5a9765800b5c9980816f006004a430baaa443697 | |
| parent | c34fb5167ed315fc7f4ae3a3311b9b4de9d060ec (diff) | |
| download | rust-ba1e13fa668ee8e634030c90714a091d8dbfc73a.tar.gz rust-ba1e13fa668ee8e634030c90714a091d8dbfc73a.zip | |
Revert "structural_match: non-structural-match ty closures"
Reverts #73353
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/structural_match.rs | 6 |
2 files changed, 1 insertions, 8 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs index 3859b22223c..926bd830da0 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs @@ -133,9 +133,6 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> { 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") } diff --git a/compiler/rustc_trait_selection/src/traits/structural_match.rs b/compiler/rustc_trait_selection/src/traits/structural_match.rs index 3d20a8d5cf3..a6323a65aad 100644 --- a/compiler/rustc_trait_selection/src/traits/structural_match.rs +++ b/compiler/rustc_trait_selection/src/traits/structural_match.rs @@ -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 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> { 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 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> { // 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(_) => { |
