]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-13204.rs
Add 'src/tools/clippy/' from commit 'd2708873ef711ec8ab45df1e984ecf24a96cd369'
[rust.git] / src / test / ui / issues / issue-13204.rs
1 // run-pass
2 #![allow(unused_mut)]
3 // Test that when instantiating trait default methods, typeck handles
4 // lifetime parameters defined on the method bound correctly.
5
6
7 pub trait Foo {
8     fn bar<'a, I: Iterator<Item=&'a ()>>(&self, it: I) -> usize {
9         let mut xs = it.filter(|_| true);
10         xs.count()
11     }
12 }
13
14 pub struct Baz;
15
16 impl Foo for Baz {
17     // When instantiating `Foo::bar` for `Baz` here, typeck used to
18     // ICE due to the lifetime parameter of `bar`.
19 }
20
21 fn main() {
22     let x = Baz;
23     let y = vec![(), (), ()];
24     assert_eq!(x.bar(y.iter()), 3);
25 }