Closed
Description
In this code I will get a compiler error:
struct F where i32: Iterator;
error[[E0277]](https://doc.rust-lang.org/stable/error-index.html#E0277): `i32` is not an iterator
--> src/main.rs:2:20
|
2 | struct F where i32: Iterator;
| ^^^^^^^^^^^^^ `i32` is not an iterator
|
= help: the trait `Iterator` is not implemented for `i32`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= help: see issue #48214
But in this code there is no compiler error:
struct F where for<'a> &'a i32: 'static;
But if I use F
, I will get a compiler error:
struct F where for<'a> &'a i32: 'static;
let _x = F;
error: higher-ranked lifetime error
--> src/main.rs:4:14
|
4 | let _x = F;
| ^
|
= note: could not prove `for<'a> &'a i32: 'static`
error: could not compile `playground` due to previous error
Which is inconsistent behavior. I think either both of them should compile, or both of them should not.