Implement TypeFoldable for InferConst
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This commit is contained in:
parent
ad78fcf524
commit
c6197541f7
@ -6,7 +6,7 @@
|
||||
use crate::hir::def::Namespace;
|
||||
use crate::mir::ProjectionKind;
|
||||
use crate::mir::interpret::ConstValue;
|
||||
use crate::ty::{self, Lift, Ty, TyCtxt, ConstVid};
|
||||
use crate::ty::{self, Lift, Ty, TyCtxt, ConstVid, InferConst};
|
||||
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
|
||||
use crate::ty::print::{FmtPrinter, Printer};
|
||||
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
|
||||
@ -1352,8 +1352,7 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
|
||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
||||
match *self {
|
||||
ConstValue::ByRef(ptr, alloc) => ConstValue::ByRef(ptr, alloc),
|
||||
// FIXME(const_generics): implement TypeFoldable for InferConst
|
||||
ConstValue::Infer(ic) => ConstValue::Infer(ic),
|
||||
ConstValue::Infer(ic) => ConstValue::Infer(ic.fold_with(folder)),
|
||||
ConstValue::Param(p) => ConstValue::Param(p.fold_with(folder)),
|
||||
ConstValue::Placeholder(p) => ConstValue::Placeholder(p),
|
||||
ConstValue::Scalar(a) => ConstValue::Scalar(a),
|
||||
@ -1366,8 +1365,7 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
|
||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||
match *self {
|
||||
ConstValue::ByRef(..) => false,
|
||||
// FIXME(const_generics): implement TypeFoldable for InferConst
|
||||
ConstValue::Infer(_) => false,
|
||||
ConstValue::Infer(ic) => ic.visit_with(visitor),
|
||||
ConstValue::Param(p) => p.visit_with(visitor),
|
||||
ConstValue::Placeholder(_) => false,
|
||||
ConstValue::Scalar(_) => false,
|
||||
@ -1376,3 +1374,13 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for InferConst<'tcx> {
|
||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, _folder: &mut F) -> Self {
|
||||
*self
|
||||
}
|
||||
|
||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _visitor: &mut V) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user