1
Fork 0

Add expand_abstract_const

Adds the ability to directly expand a const to an expr without having to deal with intermediate
steps.
This commit is contained in:
kadmin 2022-10-25 08:16:43 +00:00
parent f9750c1554
commit 5bb1a9febc
11 changed files with 124 additions and 174 deletions

View file

@ -287,12 +287,8 @@ where
self.visit_ty(c.ty())?;
let tcx = self.def_id_visitor.tcx();
if let ty::ConstKind::Unevaluated(uv) = c.kind() &&
let Ok(Some(ct)) = tcx.expand_bound_abstract_const(tcx.bound_abstract_const(uv.def),
uv.substs) {
ct.visit_with(self)?;
}
if let ty::ConstKind::Expr(e) = c.kind() {
e.visit_with(self)?;
let Ok(Some(ct)) = tcx.expand_unevaluated_abstract_const(uv.def, uv.substs) {
ct.super_visit_with(self)?;
}
ControlFlow::CONTINUE
}