File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -507,7 +507,7 @@ impl Qualif for IsNotPromotable {
507507 fn in_call (
508508 cx : & ConstCx < ' _ , ' tcx > ,
509509 callee : & Operand < ' tcx > ,
510- _args : & [ Operand < ' tcx > ] ,
510+ args : & [ Operand < ' tcx > ] ,
511511 _return_ty : Ty < ' tcx > ,
512512 ) -> bool {
513513 if cx. mode == Mode :: Fn {
@@ -520,10 +520,7 @@ impl Qualif for IsNotPromotable {
520520 }
521521 }
522522
523- // FIXME(eddyb) do we need "not promotable" in anything
524- // other than `Mode::Fn` by any chance?
525-
526- false
523+ Self :: in_operand ( cx, callee) || args. iter ( ) . any ( |arg| Self :: in_operand ( cx, arg) )
527524 }
528525}
529526
Original file line number Diff line number Diff line change 1+ // compile-pass
2+ // note this was only reproducible with lib crates
3+ // compile-flags: --crate-type=lib
4+
5+ pub struct Hz ;
6+
7+ impl Hz {
8+ pub const fn num ( & self ) -> u32 {
9+ 42
10+ }
11+ pub const fn normalized ( & self ) -> Hz {
12+ Hz
13+ }
14+
15+ pub const fn as_u32 ( & self ) -> u32 {
16+ self . normalized ( ) . num ( ) // this used to promote the `self.normalized()`
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments