1 // ignore-compare-mode-nll
3 // [nll]compile-flags: -Zborrowck=mir
5 // Check that when making a ref mut binding with type `&mut T`, the
6 // type `T` must match precisely the type `U` of the value being
7 // matched, and in particular cannot be some supertype of `U`. Issue
8 // #23116. This test focuses on a `let`.
11 struct S<'b>(&'b i32);
13 fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
14 let ref mut x = self.0;
16 //[base]~^ ERROR mismatched types
17 //[nll]~^^ ERROR lifetime may not live long enough