rust/src/test/ui/error-codes/E0311.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
440 B
Rust
Raw Normal View History

use std::borrow::BorrowMut;
trait NestedBorrowMut<U, V> {
fn nested_borrow_mut(&mut self) -> &mut V;
}
impl<T, U, V> NestedBorrowMut<U, V> for T
where
T: BorrowMut<U>,
U: BorrowMut<V>, // Error is caused by missing lifetime here
{
fn nested_borrow_mut(&mut self) -> &mut V {
let u_ref = self.borrow_mut(); //~ ERROR E0311
let v_ref = u_ref.borrow_mut(); //~ ERROR E0311
v_ref
}
}
fn main() {}