]> git.lizzy.rs Git - rust.git/blob - tests/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / higher-rank-trait-bounds / hrtb-debruijn-in-receiver.rs
1 // Test the case where the `Self` type has a bound lifetime that must
2 // be adjusted in the fn signature. Issue #19537.
3
4 use std::collections::HashMap;
5
6 struct Foo<'a> {
7     map: HashMap<usize, &'a str>
8 }
9
10 impl<'a> Foo<'a> {
11     fn new() -> Foo<'a> { panic!() }
12     fn insert(&'a mut self) { }
13 }
14 fn main() {
15     let mut foo = Foo::new();
16     foo.insert();
17     foo.insert(); //~ ERROR cannot borrow
18 }