blob: 0974268734653536555398f0b5d472570b1aaf81 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
error: mutable borrow from immutable input(s)
--> tests/ui/mut_from_ref.rs:13:39
|
LL | fn this_wont_hurt_a_bit(&self) -> &mut Foo {
| ^^^^^^^^
|
note: immutable borrow here
--> tests/ui/mut_from_ref.rs:13:29
|
LL | fn this_wont_hurt_a_bit(&self) -> &mut Foo {
| ^^^^^
= note: `-D clippy::mut-from-ref` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::mut_from_ref)]`
error: mutable borrow from immutable input(s)
--> tests/ui/mut_from_ref.rs:21:25
|
LL | fn ouch(x: &Foo) -> &mut Foo;
| ^^^^^^^^
|
note: immutable borrow here
--> tests/ui/mut_from_ref.rs:21:16
|
LL | fn ouch(x: &Foo) -> &mut Foo;
| ^^^^
error: mutable borrow from immutable input(s)
--> tests/ui/mut_from_ref.rs:31:21
|
LL | fn fail(x: &u32) -> &mut u16 {
| ^^^^^^^^
|
note: immutable borrow here
--> tests/ui/mut_from_ref.rs:31:12
|
LL | fn fail(x: &u32) -> &mut u16 {
| ^^^^
error: mutable borrow from immutable input(s)
--> tests/ui/mut_from_ref.rs:37:50
|
LL | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 {
| ^^^^^^^^^^^
|
note: immutable borrow here
--> tests/ui/mut_from_ref.rs:37:25
|
LL | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 {
| ^^^^^^^
error: mutable borrow from immutable input(s)
--> tests/ui/mut_from_ref.rs:43:67
|
LL | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 {
| ^^^^^^^^^^^
|
note: immutable borrow here
--> tests/ui/mut_from_ref.rs:43:27
|
LL | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 {
| ^^^^^^^ ^^^^^^^
error: mutable borrow from immutable input(s)
--> tests/ui/mut_from_ref.rs:49:46
|
LL | fn fail_tuples<'a>(x: (&'a u32, &'a u32)) -> &'a mut u32 {
| ^^^^^^^^^^^
|
note: immutable borrow here
--> tests/ui/mut_from_ref.rs:49:24
|
LL | fn fail_tuples<'a>(x: (&'a u32, &'a u32)) -> &'a mut u32 {
| ^^^^^^^ ^^^^^^^
error: mutable borrow from immutable input(s)
--> tests/ui/mut_from_ref.rs:55:37
|
LL | fn fail_box<'a>(x: Box<&'a u32>) -> &'a mut u32 {
| ^^^^^^^^^^^
|
note: immutable borrow here
--> tests/ui/mut_from_ref.rs:55:24
|
LL | fn fail_box<'a>(x: Box<&'a u32>) -> &'a mut u32 {
| ^^^^^^^
error: mutable borrow from immutable input(s)
--> tests/ui/mut_from_ref.rs:85:35
|
LL | unsafe fn also_broken(x: &u32) -> &mut u32 {
| ^^^^^^^^
|
note: immutable borrow here
--> tests/ui/mut_from_ref.rs:85:26
|
LL | unsafe fn also_broken(x: &u32) -> &mut u32 {
| ^^^^
error: aborting due to 8 previous errors
|