Fold const in writeback
This commit is contained in:
parent
c7deb5bdc2
commit
16d6ee3952
1 changed files with 15 additions and 0 deletions
|
@ -853,6 +853,21 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Resolver<'cx, 'gcx, 'tcx> {
|
|||
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
|
||||
self.infcx.fully_resolve(&r).unwrap_or(self.tcx.lifetimes.re_static)
|
||||
}
|
||||
|
||||
fn fold_const(&mut self, ct: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> {
|
||||
match self.infcx.fully_resolve(&ct) {
|
||||
Ok(ct) => ct,
|
||||
Err(_) => {
|
||||
debug!(
|
||||
"Resolver::fold_const: input const `{:?}` not fully resolvable",
|
||||
ct
|
||||
);
|
||||
// FIXME: we'd like to use `self.report_error`, but it doesn't yet
|
||||
// accept a &'tcx ty::Const.
|
||||
self.tcx().types.ct_err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue