]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/borrowck-call-method-from-mut-aliasable.rs
Sync rustc_codegen_cranelift 'ddd4ce25535cf71203ba3700896131ce55fde795'
[rust.git] / src / test / ui / span / borrowck-call-method-from-mut-aliasable.rs
1 struct Foo {
2     x: isize,
3 }
4
5 impl Foo {
6     pub fn f(&self) {}
7     pub fn h(&mut self) {}
8 }
9
10 fn a(x: &mut Foo) {
11     x.f();
12     x.h();
13 }
14
15 fn b(x: &Foo) {
16     x.f();
17     x.h(); //~ ERROR cannot borrow
18 }
19
20 fn main() {
21 }