Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit makes polymorphization visited the MIR of unevaluated constants with available promoted MIR instead of visiting the substitutions of that constant - which will mark all of the generic parameters as used. Signed-off-by: David Wood <david@davidtw.co>
- Loading branch information
Showing
6 changed files
with
46 additions
and
2 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,12 @@ | ||
// build-fail | ||
// compile-flags: -Zpolymorphize=on | ||
#![crate_type = "lib"] | ||
#![feature(rustc_attrs)] | ||
|
||
fn foo<'a>(_: &'a ()) {} | ||
|
||
#[rustc_polymorphize_error] | ||
pub fn test<T>() { | ||
//~^ ERROR item has unused generic parameters | ||
foo(&()); | ||
} |
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,8 @@ | ||
error: item has unused generic parameters | ||
--> $DIR/promoted-function-1.rs:9:8 | ||
| | ||
LL | pub fn test<T>() { | ||
| ^^^^ - generic parameter `T` is unused | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// run-pass | ||
// compile-flags:-Zpolymorphize=on | ||
|
||
fn fop<T>() {} | ||
|
||
fn bar<T>() -> &'static fn() { | ||
|
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