mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
12 lines
294 B
Rust
12 lines
294 B
Rust
//@ run-pass
|
|
|
|
fn main() {
|
|
let v = vec![1, 2, 3];
|
|
let boxed: Box<dyn Iterator<Item=i32>> = Box::new(v.into_iter());
|
|
assert_eq!(boxed.max(), Some(3));
|
|
|
|
let v = vec![1, 2, 3];
|
|
let boxed: &mut dyn Iterator<Item=i32> = &mut v.into_iter();
|
|
assert_eq!(boxed.max(), Some(3));
|
|
}
|