|
42 | 42 | //! - ty.super_fold_with(folder)
|
43 | 43 | //! - u.fold_with(folder)
|
44 | 44 | //! ```
|
45 |
| -use crate::mir; |
46 | 45 | use crate::ty::{self, Binder, BoundTy, Ty, TyCtxt, TypeVisitable};
|
47 | 46 | use rustc_data_structures::fx::FxIndexMap;
|
48 | 47 | use rustc_hir::def_id::DefId;
|
@@ -134,20 +133,9 @@ pub trait TypeFolder<'tcx>: FallibleTypeFolder<'tcx, Error = !> {
|
134 | 133 | uv.super_fold_with(self)
|
135 | 134 | }
|
136 | 135 |
|
137 |
| - fn fold_mir_unevaluated( |
138 |
| - &mut self, |
139 |
| - uv: mir::UnevaluatedConst<'tcx>, |
140 |
| - ) -> mir::UnevaluatedConst<'tcx> { |
141 |
| - uv.super_fold_with(self) |
142 |
| - } |
143 |
| - |
144 | 136 | fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
|
145 | 137 | p.super_fold_with(self)
|
146 | 138 | }
|
147 |
| - |
148 |
| - fn fold_mir_const(&mut self, c: mir::ConstantKind<'tcx>) -> mir::ConstantKind<'tcx> { |
149 |
| - bug!("most type folders should not be folding MIR datastructures: {:?}", c) |
150 |
| - } |
151 | 139 | }
|
152 | 140 |
|
153 | 141 | /// This trait is implemented for every folding traversal. There is a fold
|
@@ -188,26 +176,12 @@ pub trait FallibleTypeFolder<'tcx>: Sized {
|
188 | 176 | c.try_super_fold_with(self)
|
189 | 177 | }
|
190 | 178 |
|
191 |
| - fn try_fold_mir_unevaluated( |
192 |
| - &mut self, |
193 |
| - c: mir::UnevaluatedConst<'tcx>, |
194 |
| - ) -> Result<mir::UnevaluatedConst<'tcx>, Self::Error> { |
195 |
| - c.try_super_fold_with(self) |
196 |
| - } |
197 |
| - |
198 | 179 | fn try_fold_predicate(
|
199 | 180 | &mut self,
|
200 | 181 | p: ty::Predicate<'tcx>,
|
201 | 182 | ) -> Result<ty::Predicate<'tcx>, Self::Error> {
|
202 | 183 | p.try_super_fold_with(self)
|
203 | 184 | }
|
204 |
| - |
205 |
| - fn try_fold_mir_const( |
206 |
| - &mut self, |
207 |
| - c: mir::ConstantKind<'tcx>, |
208 |
| - ) -> Result<mir::ConstantKind<'tcx>, Self::Error> { |
209 |
| - bug!("most type folders should not be folding MIR datastructures: {:?}", c) |
210 |
| - } |
211 | 185 | }
|
212 | 186 |
|
213 | 187 | // This blanket implementation of the fallible trait for infallible folders
|
@@ -248,23 +222,9 @@ where
|
248 | 222 | Ok(self.fold_ty_unevaluated(c))
|
249 | 223 | }
|
250 | 224 |
|
251 |
| - fn try_fold_mir_unevaluated( |
252 |
| - &mut self, |
253 |
| - c: mir::UnevaluatedConst<'tcx>, |
254 |
| - ) -> Result<mir::UnevaluatedConst<'tcx>, !> { |
255 |
| - Ok(self.fold_mir_unevaluated(c)) |
256 |
| - } |
257 |
| - |
258 | 225 | fn try_fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> Result<ty::Predicate<'tcx>, !> {
|
259 | 226 | Ok(self.fold_predicate(p))
|
260 | 227 | }
|
261 |
| - |
262 |
| - fn try_fold_mir_const( |
263 |
| - &mut self, |
264 |
| - c: mir::ConstantKind<'tcx>, |
265 |
| - ) -> Result<mir::ConstantKind<'tcx>, !> { |
266 |
| - Ok(self.fold_mir_const(c)) |
267 |
| - } |
268 | 228 | }
|
269 | 229 |
|
270 | 230 | ///////////////////////////////////////////////////////////////////////////
|
|
0 commit comments