Skip to content

Commit 8c01b85

Browse files
committed
make sure we don't inline these generic fn as that could monomorphize them
1 parent 0cb1065 commit 8c01b85

9 files changed

+12
-6
lines changed

tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | const C: () = panic!();
77
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
88

99
note: erroneous constant encountered
10-
--> $DIR/collect-in-dead-fn-behind-assoc-type.rs:15:17
10+
--> $DIR/collect-in-dead-fn-behind-assoc-type.rs:16:17
1111
|
1212
LL | let _ = Fail::<T>::C;
1313
| ^^^^^^^^^^^^

tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | const C: () = panic!();
77
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
88

99
note: erroneous constant encountered
10-
--> $DIR/collect-in-dead-fn-behind-assoc-type.rs:15:17
10+
--> $DIR/collect-in-dead-fn-behind-assoc-type.rs:16:17
1111
|
1212
LL | let _ = Fail::<T>::C;
1313
| ^^^^^^^^^^^^

tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ impl<T> Fail<T> {
1010
const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
1111
}
1212

13+
#[inline(never)]
1314
fn not_called<T>() {
1415
if false {
1516
let _ = Fail::<T>::C;
1617
}
1718
}
1819

20+
#[inline(never)]
1921
fn callit_not(f: impl Fn()) {
2022
if false {
2123
f();
@@ -33,6 +35,7 @@ impl Hideaway for () {
3335
const C: Self::T = not_called::<i32>;
3436
}
3537

38+
#[inline(never)]
3639
fn reveal<T: Hideaway>() {
3740
if false {
3841
callit_not(T::C);

tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | const C: () = panic!();
77
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
88

99
note: erroneous constant encountered
10-
--> $DIR/collect-in-dead-fn-behind-generic.rs:14:17
10+
--> $DIR/collect-in-dead-fn-behind-generic.rs:15:17
1111
|
1212
LL | let _ = Fail::<T>::C;
1313
| ^^^^^^^^^^^^

tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | const C: () = panic!();
77
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
88

99
note: erroneous constant encountered
10-
--> $DIR/collect-in-dead-fn-behind-generic.rs:14:17
10+
--> $DIR/collect-in-dead-fn-behind-generic.rs:15:17
1111
|
1212
LL | let _ = Fail::<T>::C;
1313
| ^^^^^^^^^^^^

tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ impl<T> Fail<T> {
99
const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
1010
}
1111

12+
#[inline(never)]
1213
fn not_called<T>() {
1314
if false {
1415
let _ = Fail::<T>::C;
1516
}
1617
}
1718

19+
#[inline(never)]
1820
fn callit_not(f: impl Fn()) {
1921
if false {
2022
f();

tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | const C: () = panic!();
77
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
88

99
note: erroneous constant encountered
10-
--> $DIR/collect-in-dead-fn-behind-opaque-type.rs:18:21
10+
--> $DIR/collect-in-dead-fn-behind-opaque-type.rs:19:21
1111
|
1212
LL | let _ = Fail::<T>::C;
1313
| ^^^^^^^^^^^^

tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | const C: () = panic!();
77
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
88

99
note: erroneous constant encountered
10-
--> $DIR/collect-in-dead-fn-behind-opaque-type.rs:18:21
10+
--> $DIR/collect-in-dead-fn-behind-opaque-type.rs:19:21
1111
|
1212
LL | let _ = Fail::<T>::C;
1313
| ^^^^^^^^^^^^

tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ mod m {
1313

1414
pub type NotCalledFn = impl Fn();
1515

16+
#[inline(never)]
1617
fn not_called<T>() {
1718
if false {
1819
let _ = Fail::<T>::C;

0 commit comments

Comments
 (0)