summaryrefslogtreecommitdiffstats
path: root/tests/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.rs
blob: 05d3e1a434e69c78d0bf37e837e35251cc037fc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Test the case where the `Self` type has a bound lifetime that must
// be adjusted in the fn signature. Issue #19537.

use std::collections::HashMap;

struct Foo<'a> {
    map: HashMap<usize, &'a str>
}

impl<'a> Foo<'a> {
    fn new() -> Foo<'a> { panic!() }
    fn insert(&'a mut self) { }
}
fn main() {
    let mut foo = Foo::new();
    foo.insert();
    foo.insert(); //~ ERROR cannot borrow
}