Closed
Description
Testcase:
enum Foo<T> {
F(Option<Box<Foo<Box<T>>>>)
}
fn main() { }
Gives:
<anon>:16:10: 16:11 error: parameter `T` is never used [E0392]
<anon>:16 enum Foo<T> {
^
<anon>:16:10: 16:11 help: consider removing `T` or using a marker such as `core::marker::PhantomData`
Not sure if this is really something rustc should actually support (I imagine trying to prove recursive properties about it is extremely awkward), but the error message makes no sense.
More related testcases:
// Crashes rustc with a stack overflow
use std::marker::PhantomData;
enum Foo<T> {
F(Option<Box<Foo<Box<T>>>>, PhantomData<T>)
}
fn takesfoo<T>(f:&Foo<T>) {
match f {
&Foo::F(Some(ref b), PhantomData) => takesfoo(&**b),
&Foo::F(None, PhantomData) => ()
}
}
fn main() { }
// Gives "error: overflow while adding drop-check rules for Foo<i32>"
use std::marker::PhantomData;
enum Foo<T> {
F(Option<Box<Foo<Box<T>>>>, PhantomData<T>)
}
fn main() { let _f = Foo::F::<i32>(None, PhantomData); }