]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-28936.rs
New upstream version 1.33.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-28936.rs
1 // compile-pass
2 pub type Session = i32;
3 pub struct StreamParser<'a, T> {
4 _tokens: T,
5 _session: &'a mut Session,
6 }
7
8 impl<'a, T> StreamParser<'a, T> {
9 pub fn thing(&mut self) -> bool { true }
10 }
11
12 pub fn parse_stream<T: Iterator<Item=i32>, U, F>(
13 _session: &mut Session, _tokens: T, _f: F) -> U
14 where F: Fn(&mut StreamParser<T>) -> U { panic!(); }
15
16 pub fn thing(session: &mut Session) {
17 let mut stream = vec![1, 2, 3].into_iter();
18
19 let _b = parse_stream(session,
20 stream.by_ref(),
21 // replacing the above with the following fixes it
22 //&mut stream,
23 |p| p.thing());
24
25 }
26
27 fn main() {}