]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/issue-37884.rs
New upstream version 1.19.0+dfsg1
[rustc.git] / src / test / compile-fail / issue-37884.rs
CommitLineData
476ff2be
SL
1// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
11struct RepeatMut<'a, T>(T, &'a ());
12
13impl<'a, T: 'a> Iterator for RepeatMut<'a, T> {
7cac9316
XL
14 //~^ NOTE ...does not necessarily outlive the lifetime 'a as defined on the impl
15
476ff2be
SL
16 type Item = &'a mut T;
17 fn next(&'a mut self) -> Option<Self::Item>
18 //~^ ERROR method not compatible with trait
19 //~| lifetime mismatch
20 //~| NOTE expected type `fn(&mut RepeatMut<'a, T>) -> std::option::Option<&mut T>`
7cac9316 21 //~| NOTE the anonymous lifetime #1 defined on the method body
476ff2be 22 {
476ff2be
SL
23 Some(&mut self.0)
24 }
25}
26
27fn main() {}