diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-24533.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-24533.rs b/src/test/ui/issues/issue-24533.rs new file mode 100644 index 000000000..8592bf430 --- /dev/null +++ b/src/test/ui/issues/issue-24533.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(unused_must_use)] +use std::slice::Iter; +use std::io::{Error, ErrorKind, Result}; +use std::vec::*; + +fn foo(it: &mut Iter<u8>) -> Result<u8> { + Ok(*it.next().unwrap()) +} + +fn bar() -> Result<u8> { + let data: Vec<u8> = Vec::new(); + + if true { + return Err(Error::new(ErrorKind::NotFound, "msg")); + } + + let mut it = data.iter(); + foo(&mut it) +} + +fn main() { + bar(); +} |