]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/mut-arg-hint.rs
Rollup merge of #87922 - Manishearth:c-enum-target-spec, r=nagisa,eddyb
[rust.git] / src / test / ui / span / mut-arg-hint.rs
1 trait B {
2     fn foo(mut a: &String) {
3         a.push_str("bar"); //~ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
4     }
5 }
6
7 pub fn foo<'a>(mut a: &'a String) {
8     a.push_str("foo"); //~ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
9 }
10
11 struct A {}
12
13 impl A {
14     pub fn foo(mut a: &String) {
15         a.push_str("foo"); //~ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
16     }
17 }
18
19 fn main() {
20     foo(&"a".to_string());
21     A::foo(&"a".to_string());
22 }