File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
branches/beta/src/test/compile-fail Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
23
23
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
24
24
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
25
25
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26
- refs/heads/beta: a03222c2b16648c466f836d5eec425fc3c648aa4
26
+ refs/heads/beta: d5b6599ab64b2e44d2fe13eea884e2369ffdaa47
27
27
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28
28
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
Original file line number Diff line number Diff line change 12
12
#![ deny( unused_assignments) ]
13
13
#![ allow( dead_code, non_camel_case_types, trivial_numeric_casts) ]
14
14
15
+ use std:: ops:: AddAssign ;
16
+
15
17
fn f1 ( x : isize ) {
16
18
//~^ ERROR unused variable: `x`
17
19
}
@@ -100,5 +102,30 @@ fn f5c() {
100
102
}
101
103
}
102
104
105
+ struct View < ' a > ( & ' a mut [ i32 ] ) ;
106
+
107
+ impl < ' a > AddAssign < i32 > for View < ' a > {
108
+ fn add_assign ( & mut self , rhs : i32 ) {
109
+ for lhs in self . 0 . iter_mut ( ) {
110
+ * lhs += rhs;
111
+ }
112
+ }
113
+ }
114
+
115
+ fn f6 ( ) {
116
+ let mut array = [ 1 , 2 , 3 ] ;
117
+ let mut v = View ( & mut array) ;
118
+
119
+ // ensure an error shows up for x even if lhs of an overloaded add assign
120
+
121
+ let x;
122
+ //~^ ERROR variable `x` is assigned to, but never used
123
+
124
+ * ( {
125
+ x = 0 ; //~ ERROR value assigned to `x` is never read
126
+ & mut v
127
+ } ) += 1 ;
128
+ }
129
+
103
130
fn main ( ) {
104
131
}
You can’t perform that action at this time.
0 commit comments