Skip to content

Commit 2308d2d

Browse files
committed
Handle ConstValue::Placeholder in canonicalizer
1 parent e70797b commit 2308d2d

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/librustc/infer/canonical/canonicalizer.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,9 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
454454
}
455455
return self.canonicalize_const_var(
456456
CanonicalVarInfo {
457-
kind: CanonicalVarKind::Const(ui)
457+
kind: CanonicalVarKind::Const(ui),
458458
},
459-
c
459+
c,
460460
);
461461
}
462462
}
@@ -471,6 +471,14 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
471471
return c;
472472
}
473473
}
474+
ConstValue::Placeholder(placeholder) => {
475+
return self.canonicalize_const_var(
476+
CanonicalVarInfo {
477+
kind: CanonicalVarKind::PlaceholderConst(placeholder),
478+
},
479+
c,
480+
);
481+
}
474482
_ => {}
475483
}
476484
}

src/librustc/infer/canonical/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,17 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
414414
CanonicalVarKind::PlaceholderConst(
415415
ty::PlaceholderConst { universe, name },
416416
) => {
417-
let _ = (universe, name);
418-
unimplemented!() // FIXME(const_generics)
417+
let universe_mapped = universe_map(universe);
418+
let placeholder_mapped = ty::PlaceholderConst {
419+
universe: universe_mapped,
420+
name,
421+
};
422+
self.tcx.mk_lazy_const(ty::LazyConst::Evaluated(
423+
ty::Const {
424+
val: ConstValue::Placeholder(placeholder_mapped),
425+
ty: self.tcx.types.err, // FIXME(const_generics)
426+
}
427+
)).into()
419428
}
420429
}
421430
}

0 commit comments

Comments
 (0)