Skip to content

Commit 2d86d04

Browse files
committed
Address comment and formatting nits
1 parent f4f957d commit 2d86d04

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: src/librustc/ty/sty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,7 @@ impl<'tcx> Const<'tcx> {
22982298
ty: Ty<'tcx>,
22992299
) -> Option<u128> {
23002300
assert_eq!(self.ty, ty);
2301+
// if `ty` does not depend on generic parameters, use an empty param_env
23012302
let size = tcx.layout_of(param_env.with_reveal_all().and(ty)).ok()?.size;
23022303
match self.val {
23032304
// FIXME(const_generics): this doesn't work right now,
@@ -2315,8 +2316,7 @@ impl<'tcx> Const<'tcx> {
23152316
let evaluated = tcx.const_eval(param_env.and(gid)).ok()?;
23162317
evaluated.val.try_to_bits(size)
23172318
},
2318-
// FIXME(const_generics): try to evaluate generic consts with a given param env?
2319-
// E.g. when you have an associated constant whose value depends on a generic const
2319+
// otherwise just extract a `ConstValue`'s bits if possible
23202320
_ => self.val.try_to_bits(size),
23212321
}
23222322
}

Diff for: src/test/ui/consts/self_normalization.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// compile-pass
22

3-
fn testfn(_arr: &mut [();0]) {}
3+
fn testfn(_arr: &mut [(); 0]) {}
44

55
trait TestTrait {
66
fn method();

0 commit comments

Comments
 (0)