Handle ConstValue::Placeholder in canonicalizer

This commit is contained in:
varkor 2019-03-12 20:55:19 +00:00
parent e70797b575
commit 2308d2d68a
2 changed files with 21 additions and 4 deletions

View File

@ -454,9 +454,9 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
}
return self.canonicalize_const_var(
CanonicalVarInfo {
kind: CanonicalVarKind::Const(ui)
kind: CanonicalVarKind::Const(ui),
},
c
c,
);
}
}
@ -471,6 +471,14 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
return c;
}
}
ConstValue::Placeholder(placeholder) => {
return self.canonicalize_const_var(
CanonicalVarInfo {
kind: CanonicalVarKind::PlaceholderConst(placeholder),
},
c,
);
}
_ => {}
}
}

View File

@ -414,8 +414,17 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
CanonicalVarKind::PlaceholderConst(
ty::PlaceholderConst { universe, name },
) => {
let _ = (universe, name);
unimplemented!() // FIXME(const_generics)
let universe_mapped = universe_map(universe);
let placeholder_mapped = ty::PlaceholderConst {
universe: universe_mapped,
name,
};
self.tcx.mk_lazy_const(ty::LazyConst::Evaluated(
ty::Const {
val: ConstValue::Placeholder(placeholder_mapped),
ty: self.tcx.types.err, // FIXME(const_generics)
}
)).into()
}
}
}