summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-24533.rs
blob: 8592bf430721e43886e6e0e9c573939d1c39d167 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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();
}