]> git.lizzy.rs Git - rust.git/blob - src/test/ui/did_you_mean/issue-38147-1.rs
Test `expect` with `forbid` and fix doc errors (RFC-2383)
[rust.git] / src / test / ui / did_you_mean / issue-38147-1.rs
1 struct Pass<'a> {
2     s: &'a mut String
3 }
4
5 impl<'a> Pass<'a> {
6     fn f(&mut self) {
7         self.s.push('x');
8     }
9 }
10
11 struct Foo<'a> {
12     s: &'a mut String
13 }
14
15 impl<'a> Foo<'a> {
16     fn f(&self) {
17         self.s.push('x'); //~ cannot borrow `*self.s` as mutable, as it is behind a `&` reference
18     }
19 }
20
21 fn main() {}