Ahh… yes it’s possible to make it go into an infinite loop then. In fact, that example just turned up at least three bugs:
This type should be uninhabited but isn’t: FullTree<!> where
enum FullTree<'a, T: 'a> {
Leaf(T),
Node(&'a FullTree<'a, (T, T)>),
}
I’m not even sure why this doesn’t go into an infinite loop, it seems like the inhabitedness here should be (niavely) undecidable.
This type gives a weird, spurious error message:
struct Foo<'a, T: 'a> {
node: &'a Foo<'a, (T, T)>,
}
error[E0392]: parameter `T` is never used
--> smeg.rs:3:18
|
3 | struct Foo<'a, T: 'a> {
| ^ unused type parameter
|
= help: consider removing `T` or using a marker such as `std::marker::PhantomData`
error: aborting due to previous error
And this type causes rustc to stack overflow (in the uninhabitedness check):
struct Foo<'a, T: 'a> {
_ph: PhantomData<T>,
node: &'a Foo<'a, (T, T)>,
}
Damn.
Edit: The first bug isn’t really a problem and the second one is actually expected behaviour. I’ve filed a report for the third one and put it on my list of things to fix.