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>
43 lines
1.2 KiB
Text
43 lines
1.2 KiB
Text
error: item has unused generic parameters
|
|
--> $DIR/unsized_cast.rs:11:18
|
|
|
|
|
LL | fn foo<T: Default>() {
|
|
| - generic parameter `T` is unused
|
|
LL | let _: T = Default::default();
|
|
LL | (|| Box::new(|| {}) as Box<dyn Fn()>)();
|
|
| ^^^^^
|
|
|
|
error: item has unused generic parameters
|
|
--> $DIR/unsized_cast.rs:11:5
|
|
|
|
|
LL | fn foo<T: Default>() {
|
|
| - generic parameter `T` is unused
|
|
LL | let _: T = Default::default();
|
|
LL | (|| Box::new(|| {}) as Box<dyn Fn()>)();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: item has unused generic parameters
|
|
--> $DIR/unsized_cast.rs:22:15
|
|
|
|
|
LL | fn foo2<T: Default>() {
|
|
| - generic parameter `T` is unused
|
|
...
|
|
LL | call(&|| {}, ());
|
|
| ^^^^^
|
|
|
|
error: item has unused generic parameters
|
|
--> $DIR/unsized_cast.rs:19:5
|
|
|
|
|
LL | fn foo2<T: Default>() {
|
|
| - generic parameter `T` is unused
|
|
LL | let _: T = Default::default();
|
|
LL | / (|| {
|
|
LL | |
|
|
LL | | let call: extern "rust-call" fn(_, _) = Fn::call;
|
|
LL | | call(&|| {}, ());
|
|
LL | |
|
|
LL | | })();
|
|
| |______^
|
|
|
|
error: aborting due to 4 previous errors
|
|
|