Auto merge of #74633 - davidtwco:issue-74614-disable-polymorphisation, r=wesleywiser
Disable polymorphisation Fixes #74614. This PR disables polymorphisation to fix the regression in #74614 after investigation into the issue makes it clear that the fix won't be trivial. ~~I'll file an issue shortly to replace #74614 with the findings so far.~~ #74636 has been filed to track the fix of the underlying regression. r? @eddyb
This commit is contained in:
commit
bbebe7351f
|
@ -627,8 +627,9 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
|
|||
Ok(val) => collect_const_value(self.tcx, val, self.output),
|
||||
Err(ErrorHandled::Reported(ErrorReported) | ErrorHandled::Linted) => {}
|
||||
Err(ErrorHandled::TooGeneric) => span_bug!(
|
||||
self.tcx.def_span(def.did),
|
||||
"collection encountered polymorphic constant",
|
||||
self.body.source_info(location).span,
|
||||
"collection encountered polymorphic constant: {}",
|
||||
substituted_constant
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -949,7 +949,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
|||
(default: PLT is disabled if full relro is enabled)"),
|
||||
polonius: bool = (false, parse_bool, [UNTRACKED],
|
||||
"enable polonius-based borrow-checker (default: no)"),
|
||||
polymorphize: bool = (true, parse_bool, [TRACKED],
|
||||
polymorphize: bool = (false, parse_bool, [TRACKED],
|
||||
"perform polymorphization analysis"),
|
||||
pre_link_arg: (/* redirected to pre_link_args */) = ((), parse_string_push, [UNTRACKED],
|
||||
"a single extra argument to prepend the linker invocation (can be used several times)"),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags:-Zprint-mono-items=eager
|
||||
// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on
|
||||
|
||||
#![feature(start)]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags:-Zprint-mono-items=eager
|
||||
// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on
|
||||
|
||||
#![deny(dead_code)]
|
||||
#![feature(start)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags:-Zprint-mono-items=lazy -Copt-level=1
|
||||
// compile-flags:-Zpolymorphize=on -Zprint-mono-items=lazy -Copt-level=1
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// build-pass
|
||||
|
||||
fn test<T>() {
|
||||
std::mem::size_of::<T>();
|
||||
}
|
||||
|
||||
pub fn foo<T>(_: T) -> &'static fn() {
|
||||
&(test::<T> as fn())
|
||||
}
|
||||
|
||||
fn outer<T>() {
|
||||
foo(|| ());
|
||||
}
|
||||
|
||||
fn main() {
|
||||
outer::<u8>();
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
#![feature(const_generics, rustc_attrs)]
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/closures.rs:2:12
|
||||
--> $DIR/closures.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics, rustc_attrs)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
@ -8,7 +8,7 @@ LL | #![feature(const_generics, rustc_attrs)]
|
|||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:18:19
|
||||
--> $DIR/closures.rs:19:19
|
||||
|
|
||||
LL | pub fn unused<const T: usize>() -> usize {
|
||||
| - generic parameter `T` is unused
|
||||
|
@ -17,13 +17,13 @@ LL | let add_one = |x: usize| x + 1;
|
|||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:16:8
|
||||
--> $DIR/closures.rs:17:8
|
||||
|
|
||||
LL | pub fn unused<const T: usize>() -> usize {
|
||||
| ^^^^^^ - generic parameter `T` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:27:19
|
||||
--> $DIR/closures.rs:28:19
|
||||
|
|
||||
LL | pub fn used_parent<const T: usize>() -> usize {
|
||||
| - generic parameter `T` is unused
|
||||
|
@ -32,7 +32,7 @@ LL | let add_one = |x: usize| x + 1;
|
|||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:47:13
|
||||
--> $DIR/closures.rs:48:13
|
||||
|
|
||||
LL | pub fn unused_upvar<const T: usize>() -> usize {
|
||||
| - generic parameter `T` is unused
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
#![feature(const_generics, rustc_attrs)]
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/functions.rs:2:12
|
||||
--> $DIR/functions.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics, rustc_attrs)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
@ -8,7 +8,7 @@ LL | #![feature(const_generics, rustc_attrs)]
|
|||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/functions.rs:14:8
|
||||
--> $DIR/functions.rs:15:8
|
||||
|
|
||||
LL | pub fn unused<const T: usize>() {
|
||||
| ^^^^^^ - generic parameter `T` is unused
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// check-pass
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
|
||||
pub struct OnDrop<F: Fn()>(pub F);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// check-pass
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
|
||||
pub struct OnDrop<F: Fn()>(pub F);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
#![feature(const_generics, generators, generator_trait, rustc_attrs)]
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/generators.rs:2:12
|
||||
--> $DIR/generators.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics, generators, generator_trait, rustc_attrs)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
@ -8,7 +8,7 @@ LL | #![feature(const_generics, generators, generator_trait, rustc_attrs)]
|
|||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/generators.rs:35:5
|
||||
--> $DIR/generators.rs:36:5
|
||||
|
|
||||
LL | pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
|
||||
| - generic parameter `T` is unused
|
||||
|
@ -21,13 +21,13 @@ LL | | }
|
|||
| |_____^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/generators.rs:33:8
|
||||
--> $DIR/generators.rs:34:8
|
||||
|
|
||||
LL | pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
|
||||
| ^^^^^^^^^^^ - generic parameter `T` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/generators.rs:61:5
|
||||
--> $DIR/generators.rs:62:5
|
||||
|
|
||||
LL | pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
|
||||
| - generic parameter `T` is unused
|
||||
|
@ -40,7 +40,7 @@ LL | | }
|
|||
| |_____^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/generators.rs:59:8
|
||||
--> $DIR/generators.rs:60:8
|
||||
|
|
||||
LL | pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
|
||||
| ^^^^^^^^^^^^ - generic parameter `T` is unused
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
// This test checks that the polymorphization analysis doesn't break when the
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error: item has unused generic parameters
|
||||
--> $DIR/lifetimes.rs:9:8
|
||||
--> $DIR/lifetimes.rs:10:8
|
||||
|
|
||||
LL | pub fn unused<'a, T>(_: &'a u32) {
|
||||
| ^^^^^^ - generic parameter `T` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/lifetimes.rs:16:19
|
||||
--> $DIR/lifetimes.rs:17:19
|
||||
|
|
||||
LL | pub fn used<'a, T: Default>(_: &'a u32) -> u32 {
|
||||
| - generic parameter `T` is unused
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// build-pass
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
|
||||
pub trait ParallelIterator: Sized {
|
||||
fn drive<C: Consumer<()>>(_: C) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
// This test checks that `T` is considered used in `foo`, because it is used in a predicate for
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: item has unused generic parameters
|
||||
--> $DIR/predicates.rs:8:4
|
||||
--> $DIR/predicates.rs:9:4
|
||||
|
|
||||
LL | fn bar<I>() {
|
||||
| ^^^ - generic parameter `I` is unused
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
#![feature(stmt_expr_attributes, rustc_attrs)]
|
||||
|
||||
// This test checks that the polymorphization analysis correctly detects unused type
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:18:19
|
||||
--> $DIR/closures.rs:19:19
|
||||
|
|
||||
LL | pub fn unused<T>() -> u32 {
|
||||
| - generic parameter `T` is unused
|
||||
|
@ -8,13 +8,13 @@ LL | let add_one = |x: u32| x + 1;
|
|||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:15:8
|
||||
--> $DIR/closures.rs:16:8
|
||||
|
|
||||
LL | pub fn unused<T>() -> u32 {
|
||||
| ^^^^^^ - generic parameter `T` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:27:19
|
||||
--> $DIR/closures.rs:28:19
|
||||
|
|
||||
LL | pub fn used_parent<T: Default>() -> u32 {
|
||||
| - generic parameter `T` is unused
|
||||
|
@ -23,7 +23,7 @@ LL | let add_one = |x: u32| x + 1;
|
|||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:93:23
|
||||
--> $DIR/closures.rs:94:23
|
||||
|
|
||||
LL | impl<F: Default> Foo<F> {
|
||||
| - generic parameter `F` is unused
|
||||
|
@ -35,7 +35,7 @@ LL | let add_one = |x: u32| x + 1;
|
|||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:91:12
|
||||
--> $DIR/closures.rs:92:12
|
||||
|
|
||||
LL | impl<F: Default> Foo<F> {
|
||||
| - generic parameter `F` is unused
|
||||
|
@ -44,7 +44,7 @@ LL | pub fn unused_all<G: Default>() -> u32 {
|
|||
| ^^^^^^^^^^ - generic parameter `G` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:127:23
|
||||
--> $DIR/closures.rs:128:23
|
||||
|
|
||||
LL | pub fn used_impl<G: Default>() -> u32 {
|
||||
| - generic parameter `G` is unused
|
||||
|
@ -58,13 +58,13 @@ LL | | };
|
|||
| |_________^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:125:12
|
||||
--> $DIR/closures.rs:126:12
|
||||
|
|
||||
LL | pub fn used_impl<G: Default>() -> u32 {
|
||||
| ^^^^^^^^^ - generic parameter `G` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:114:23
|
||||
--> $DIR/closures.rs:115:23
|
||||
|
|
||||
LL | impl<F: Default> Foo<F> {
|
||||
| - generic parameter `F` is unused
|
||||
|
@ -78,7 +78,7 @@ LL | | };
|
|||
| |_________^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/closures.rs:112:12
|
||||
--> $DIR/closures.rs:113:12
|
||||
|
|
||||
LL | impl<F: Default> Foo<F> {
|
||||
| - generic parameter `F` is unused
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
// This test checks that the polymorphization analysis correctly detects unused type
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error: item has unused generic parameters
|
||||
--> $DIR/functions.rs:13:8
|
||||
--> $DIR/functions.rs:14:8
|
||||
|
|
||||
LL | pub fn unused<T>() {
|
||||
| ^^^^^^ - generic parameter `T` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/functions.rs:44:12
|
||||
--> $DIR/functions.rs:45:12
|
||||
|
|
||||
LL | impl<F: Default> Foo<F> {
|
||||
| - generic parameter `F` is unused
|
||||
|
@ -14,7 +14,7 @@ LL | pub fn unused_impl() {
|
|||
| ^^^^^^^^^^^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/functions.rs:50:12
|
||||
--> $DIR/functions.rs:51:12
|
||||
|
|
||||
LL | impl<F: Default> Foo<F> {
|
||||
| - generic parameter `F` is unused
|
||||
|
@ -23,7 +23,7 @@ LL | pub fn unused_both<G: Default>() {
|
|||
| ^^^^^^^^^^^ - generic parameter `G` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/functions.rs:62:12
|
||||
--> $DIR/functions.rs:63:12
|
||||
|
|
||||
LL | impl<F: Default> Foo<F> {
|
||||
| - generic parameter `F` is unused
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
#![feature(fn_traits, rustc_attrs, unboxed_closures)]
|
||||
|
||||
// This test checks that the polymorphization analysis considers a closure
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: item has unused generic parameters
|
||||
--> $DIR/unsized_cast.rs:10:18
|
||||
--> $DIR/unsized_cast.rs:11:18
|
||||
|
|
||||
LL | fn foo<T: Default>() {
|
||||
| - generic parameter `T` is unused
|
||||
|
@ -8,7 +8,7 @@ LL | (|| Box::new(|| {}) as Box<dyn Fn()>)();
|
|||
| ^^^^^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/unsized_cast.rs:10:5
|
||||
--> $DIR/unsized_cast.rs:11:5
|
||||
|
|
||||
LL | fn foo<T: Default>() {
|
||||
| - generic parameter `T` is unused
|
||||
|
@ -17,7 +17,7 @@ LL | (|| Box::new(|| {}) as Box<dyn Fn()>)();
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/unsized_cast.rs:20:15
|
||||
--> $DIR/unsized_cast.rs:21:15
|
||||
|
|
||||
LL | fn foo2<T: Default>() {
|
||||
| - generic parameter `T` is unused
|
||||
|
|
Loading…
Reference in New Issue