-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
polymorphize: non-promoted unevaluated constants
This commit makes polymorphization visit non-promoted unevaluated constants rather than visit their substs directly. Signed-off-by: David Wood <david@davidtw.co>
- Loading branch information
Showing
3 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// build-fail | ||
// compile-flags:-Zpolymorphize=on | ||
#![crate_type = "lib"] | ||
#![feature(lazy_normalization_consts, rustc_attrs)] | ||
//~^ WARN the feature `lazy_normalization_consts` is incomplete | ||
|
||
#[rustc_polymorphize_error] | ||
fn test<T>() { | ||
//~^ ERROR item has unused generic parameters | ||
let x = [0; 3 + 4]; | ||
} | ||
|
||
pub fn caller() { | ||
test::<String>(); | ||
test::<Vec<String>>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
warning: the feature `lazy_normalization_consts` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/promoted-function-2.rs:4:12 | ||
| | ||
LL | #![feature(lazy_normalization_consts, rustc_attrs)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
= note: see issue #72219 <https://github.com/rust-lang/rust/issues/72219> for more information | ||
|
||
error: item has unused generic parameters | ||
--> $DIR/promoted-function-2.rs:8:4 | ||
| | ||
LL | fn test<T>() { | ||
| ^^^^ - generic parameter `T` is unused | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|