Skip to content

Commit 16d6ee3

Browse files
committed
Fold const in writeback
1 parent c7deb5b commit 16d6ee3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/librustc_typeck/check/writeback.rs

+15
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,21 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Resolver<'cx, 'gcx, 'tcx> {
853853
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
854854
self.infcx.fully_resolve(&r).unwrap_or(self.tcx.lifetimes.re_static)
855855
}
856+
857+
fn fold_const(&mut self, ct: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> {
858+
match self.infcx.fully_resolve(&ct) {
859+
Ok(ct) => ct,
860+
Err(_) => {
861+
debug!(
862+
"Resolver::fold_const: input const `{:?}` not fully resolvable",
863+
ct
864+
);
865+
// FIXME: we'd like to use `self.report_error`, but it doesn't yet
866+
// accept a &'tcx ty::Const.
867+
self.tcx().types.ct_err
868+
}
869+
}
870+
}
856871
}
857872

858873
///////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)