|
1 | 1 | use super::{InferCtxt, FixupError, FixupResult, Span, type_variable::TypeVariableOrigin};
|
2 | 2 | use crate::mir::interpret::ConstValue;
|
3 |
| -use crate::ty::{self, Ty, TyCtxt, TypeFoldable, InferConst}; |
| 3 | +use crate::ty::{self, Ty, Const, TyCtxt, TypeFoldable, InferConst, TypeFlags}; |
4 | 4 | use crate::ty::fold::{TypeFolder, TypeVisitor};
|
5 | 5 |
|
6 | 6 | ///////////////////////////////////////////////////////////////////////////
|
@@ -31,8 +31,17 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeResolver<'a, 'g
|
31 | 31 | if !t.has_infer_types() {
|
32 | 32 | t // micro-optimize -- if there is nothing in this type that this fold affects...
|
33 | 33 | } else {
|
34 |
| - let t0 = self.infcx.shallow_resolve(t); |
35 |
| - t0.super_fold_with(self) |
| 34 | + let t = self.infcx.shallow_resolve(t); |
| 35 | + t.super_fold_with(self) |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + fn fold_const(&mut self, ct: &'tcx Const<'tcx>) -> &'tcx Const<'tcx> { |
| 40 | + if !ct.has_type_flags(TypeFlags::HAS_CT_INFER) { |
| 41 | + ct // micro-optimize -- if there is nothing in this const that this fold affects... |
| 42 | + } else { |
| 43 | + let ct = self.infcx.shallow_resolve(ct); |
| 44 | + ct.super_fold_with(self) |
36 | 45 | }
|
37 | 46 | }
|
38 | 47 | }
|
|
0 commit comments