]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-13204.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-13204.rs
CommitLineData
b7449926 1// run-pass
0bf4aa26 2#![allow(unused_mut)]
1a4d82fc
JJ
3// Test that when instantiating trait default methods, typeck handles
4// lifetime parameters defined on the method bound correctly.
5
c34b1796 6
1a4d82fc 7pub trait Foo {
c34b1796 8 fn bar<'a, I: Iterator<Item=&'a ()>>(&self, it: I) -> usize {
1a4d82fc
JJ
9 let mut xs = it.filter(|_| true);
10 xs.count()
11 }
12}
13
14pub struct Baz;
15
16impl 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
21fn main() {
22 let x = Baz;
c30ab7b3 23 let y = vec![(), (), ()];
1a4d82fc
JJ
24 assert_eq!(x.bar(y.iter()), 3);
25}