2 // ignore-compare-mode-nll
3 //[nll] compile-flags: -Z borrowck=mir
5 #![allow(non_snake_case)]
12 // Test using `&mut self` sugar:
14 fn ref_self(&mut self, f: &u32) -> &u32 {
16 //[base]~^ ERROR lifetime mismatch
17 //[nll]~^^ ERROR lifetime may not live long enough
20 // Test using `&mut Self` explicitly:
22 fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
24 //[base]~^ ERROR lifetime mismatch
25 //[nll]~^^ ERROR lifetime may not live long enough
28 fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
30 //[base]~^ ERROR lifetime mismatch
31 //[nll]~^^ ERROR lifetime may not live long enough
34 fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
36 //[base]~^ ERROR lifetime mismatch
37 //[nll]~^^ ERROR lifetime may not live long enough
40 fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
42 //[base]~^ ERROR lifetime mismatch
43 //[nll]~^^ ERROR lifetime may not live long enough
46 fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
48 //[base]~^ ERROR lifetime mismatch
49 //[nll]~^^ ERROR lifetime may not live long enough