mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
22 lines
310 B
Rust
22 lines
310 B
Rust
struct MyStruct {
|
|
x: isize,
|
|
y: isize,
|
|
}
|
|
|
|
impl MyStruct {
|
|
fn next(&mut self) -> Option<isize> {
|
|
Some(self.x)
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
let mut bogus = MyStruct {
|
|
x: 1,
|
|
y: 2,
|
|
};
|
|
for x in bogus {
|
|
//~^ ERROR `MyStruct` is not an iterator
|
|
drop(x);
|
|
}
|
|
}
|