diff options
Diffstat (limited to 'tests/ui/did_you_mean/issue-38147-1.rs')
-rw-r--r-- | tests/ui/did_you_mean/issue-38147-1.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/did_you_mean/issue-38147-1.rs b/tests/ui/did_you_mean/issue-38147-1.rs new file mode 100644 index 000000000..c068a1834 --- /dev/null +++ b/tests/ui/did_you_mean/issue-38147-1.rs @@ -0,0 +1,21 @@ +struct Pass<'a> { + s: &'a mut String +} + +impl<'a> Pass<'a> { + fn f(&mut self) { + self.s.push('x'); + } +} + +struct Foo<'a> { + s: &'a mut String +} + +impl<'a> Foo<'a> { + fn f(&self) { + self.s.push('x'); //~ cannot borrow `*self.s` as mutable, as it is behind a `&` reference + } +} + +fn main() {} |