blob: 0e1d77ace3f701820f702bce958cecb9d208a201 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Check that the future-compat-lint for the reservation conflict is
// handled like any other lint.
// edition:2018
mod future_compat_allow {
#![allow(mutable_borrow_reservation_conflict)]
fn reservation_conflict() {
let mut v = vec![0, 1, 2];
let shared = &v;
v.push(shared.len());
}
}
mod future_compat_warn {
#![warn(mutable_borrow_reservation_conflict)]
fn reservation_conflict() {
let mut v = vec![0, 1, 2];
let shared = &v;
v.push(shared.len());
//~^ WARNING cannot borrow `v` as mutable
//~| WARNING may become a hard error in the future
}
}
mod future_compat_deny {
#![deny(mutable_borrow_reservation_conflict)]
fn reservation_conflict() {
let mut v = vec![0, 1, 2];
let shared = &v;
v.push(shared.len());
//~^ ERROR cannot borrow `v` as mutable
//~| WARNING may become a hard error in the future
}
}
fn main() {}
|