Skip to content

Commit f39ed20

Browse files
committed
sess: disable polymorphisation
This commit disables polymorphisation to resolve regressions related to closures which inherit unused generic parameters and are then used in casts or reflection. Signed-off-by: David Wood <david@davidtw.co>
1 parent 90e941a commit f39ed20

23 files changed

+46
-35
lines changed

src/librustc_session/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
949949
(default: PLT is disabled if full relro is enabled)"),
950950
polonius: bool = (false, parse_bool, [UNTRACKED],
951951
"enable polonius-based borrow-checker (default: no)"),
952-
polymorphize: bool = (true, parse_bool, [TRACKED],
952+
polymorphize: bool = (false, parse_bool, [TRACKED],
953953
"perform polymorphization analysis"),
954954
pre_link_arg: (/* redirected to pre_link_args */) = ((), parse_string_push, [UNTRACKED],
955955
"a single extra argument to prepend the linker invocation (can be used several times)"),

src/test/codegen-units/item-collection/static-init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags:-Zprint-mono-items=eager
1+
// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on
22

33
#![feature(start)]
44

src/test/codegen-units/item-collection/trait-method-default-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags:-Zprint-mono-items=eager
1+
// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on
22

33
#![deny(dead_code)]
44
#![feature(start)]

src/test/codegen-units/polymorphization/unused_type_parameters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags:-Zprint-mono-items=lazy -Copt-level=1
1+
// compile-flags:-Zpolymorphize=on -Zprint-mono-items=lazy -Copt-level=1
22
// ignore-tidy-linelength
33

44
#![crate_type = "rlib"]

src/test/ui/polymorphization/const_parameters/closures.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// build-fail
2+
// compile-flags:-Zpolymorphize=on
23
#![feature(const_generics, rustc_attrs)]
34
//~^ WARN the feature `const_generics` is incomplete
45

src/test/ui/polymorphization/const_parameters/closures.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/closures.rs:2:12
2+
--> $DIR/closures.rs:3:12
33
|
44
LL | #![feature(const_generics, rustc_attrs)]
55
| ^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(const_generics, rustc_attrs)]
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
99

1010
error: item has unused generic parameters
11-
--> $DIR/closures.rs:18:19
11+
--> $DIR/closures.rs:19:19
1212
|
1313
LL | pub fn unused<const T: usize>() -> usize {
1414
| - generic parameter `T` is unused
@@ -17,13 +17,13 @@ LL | let add_one = |x: usize| x + 1;
1717
| ^^^^^^^^^^^^^^^^
1818

1919
error: item has unused generic parameters
20-
--> $DIR/closures.rs:16:8
20+
--> $DIR/closures.rs:17:8
2121
|
2222
LL | pub fn unused<const T: usize>() -> usize {
2323
| ^^^^^^ - generic parameter `T` is unused
2424

2525
error: item has unused generic parameters
26-
--> $DIR/closures.rs:27:19
26+
--> $DIR/closures.rs:28:19
2727
|
2828
LL | pub fn used_parent<const T: usize>() -> usize {
2929
| - generic parameter `T` is unused
@@ -32,7 +32,7 @@ LL | let add_one = |x: usize| x + 1;
3232
| ^^^^^^^^^^^^^^^^
3333

3434
error: item has unused generic parameters
35-
--> $DIR/closures.rs:47:13
35+
--> $DIR/closures.rs:48:13
3636
|
3737
LL | pub fn unused_upvar<const T: usize>() -> usize {
3838
| - generic parameter `T` is unused

src/test/ui/polymorphization/const_parameters/functions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// build-fail
2+
// compile-flags:-Zpolymorphize=on
23
#![feature(const_generics, rustc_attrs)]
34
//~^ WARN the feature `const_generics` is incomplete
45

src/test/ui/polymorphization/const_parameters/functions.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/functions.rs:2:12
2+
--> $DIR/functions.rs:3:12
33
|
44
LL | #![feature(const_generics, rustc_attrs)]
55
| ^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(const_generics, rustc_attrs)]
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
99

1010
error: item has unused generic parameters
11-
--> $DIR/functions.rs:14:8
11+
--> $DIR/functions.rs:15:8
1212
|
1313
LL | pub fn unused<const T: usize>() {
1414
| ^^^^^^ - generic parameter `T` is unused

src/test/ui/polymorphization/drop_shims/simple.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// check-pass
2+
// compile-flags:-Zpolymorphize=on
23

34
pub struct OnDrop<F: Fn()>(pub F);
45

src/test/ui/polymorphization/drop_shims/transitive.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// check-pass
2+
// compile-flags:-Zpolymorphize=on
23

34
pub struct OnDrop<F: Fn()>(pub F);
45

0 commit comments

Comments
 (0)