File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 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> {
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 }
Original file line number Diff line number Diff line change 11// compile-pass
22
3- fn testfn ( _arr : & mut [ ( ) ; 0 ] ) { }
3+ fn testfn ( _arr : & mut [ ( ) ; 0 ] ) { }
44
55trait TestTrait {
66 fn method ( ) ;
You can’t perform that action at this time.
0 commit comments