File tree 2 files changed +3
-3
lines changed
2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -2298,6 +2298,7 @@ impl<'tcx> Const<'tcx> {
2298
2298
ty : Ty < ' tcx > ,
2299
2299
) -> Option < u128 > {
2300
2300
assert_eq ! ( self . ty, ty) ;
2301
+ // if `ty` does not depend on generic parameters, use an empty param_env
2301
2302
let size = tcx. layout_of ( param_env. with_reveal_all ( ) . and ( ty) ) . ok ( ) ?. size ;
2302
2303
match self . val {
2303
2304
// FIXME(const_generics): this doesn't work right now,
@@ -2315,8 +2316,7 @@ impl<'tcx> Const<'tcx> {
2315
2316
let evaluated = tcx. const_eval ( param_env. and ( gid) ) . ok ( ) ?;
2316
2317
evaluated. val . try_to_bits ( size)
2317
2318
} ,
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
2320
2320
_ => self . val . try_to_bits ( size) ,
2321
2321
}
2322
2322
}
Original file line number Diff line number Diff line change 1
1
// compile-pass
2
2
3
- fn testfn ( _arr : & mut [ ( ) ; 0 ] ) { }
3
+ fn testfn ( _arr : & mut [ ( ) ; 0 ] ) { }
4
4
5
5
trait TestTrait {
6
6
fn method ( ) ;
You can’t perform that action at this time.
0 commit comments