File tree 13 files changed +223
-5
lines changed
13 files changed +223
-5
lines changed Original file line number Diff line number Diff line change @@ -121,11 +121,11 @@ All statics and constants need to resolve to a value in an acyclic manner.
121
121
122
122
For example, neither of the following can be sensibly compiled:
123
123
124
- ```compile_fail
124
+ ```compile_fail,E0265
125
125
const X: u32 = X;
126
126
```
127
127
128
- ```compile_fail
128
+ ```compile_fail,E0265
129
129
const X: u32 = Y;
130
130
const Y: u32 = X;
131
131
```
@@ -135,7 +135,7 @@ E0267: r##"
135
135
This error indicates the use of a loop keyword (`break` or `continue`) inside a
136
136
closure but outside of any loop. Erroneous code example:
137
137
138
- ```compile_fail
138
+ ```compile_fail,E0267
139
139
let w = || { break; }; // error: `break` inside of a closure
140
140
```
141
141
@@ -159,7 +159,7 @@ This error indicates the use of a loop keyword (`break` or `continue`) outside
159
159
of a loop. Without a loop to break out of or continue in, no sensible action can
160
160
be taken. Erroneous code example:
161
161
162
- ```compile_fail
162
+ ```compile_fail,E0268
163
163
fn some_func() {
164
164
break; // error: `break` outside of loop
165
165
}
Original file line number Diff line number Diff line change @@ -146,13 +146,53 @@ mod foo {
146
146
}
147
147
148
148
use foo::MyTrait::do_something;
149
+ // error: `do_something` is not directly importable
149
150
150
151
fn main() {}
151
152
```
152
153
153
154
It's invalid to directly import methods belonging to a trait or concrete type.
154
155
"## ,
155
156
157
+ E0254 : r##"
158
+ Attempt was made to import an item whereas an extern crate with this name has
159
+ already been imported.
160
+
161
+ Erroneous code example:
162
+
163
+ ```compile_fail,E0254
164
+ extern crate collections;
165
+
166
+ mod foo {
167
+ pub trait collections {
168
+ fn do_something();
169
+ }
170
+ }
171
+
172
+ use foo::collections; // error: an extern crate named `collections` has already
173
+ // been imported in this module
174
+
175
+ fn main() {}
176
+ ```
177
+
178
+ To fix issue issue, you have to rename at least one of the two imports.
179
+ Example:
180
+
181
+ ```ignore
182
+ extern crate collections as libcollections; // ok!
183
+
184
+ mod foo {
185
+ pub trait collections {
186
+ fn do_something();
187
+ }
188
+ }
189
+
190
+ use foo::collections;
191
+
192
+ fn main() {}
193
+ ```
194
+ "## ,
195
+
156
196
E0255 : r##"
157
197
You can't import a value whose name is the same as another value defined in the
158
198
module.
@@ -1237,7 +1277,6 @@ impl Foo for i32 {}
1237
1277
register_diagnostics ! {
1238
1278
// E0153, unused error code
1239
1279
// E0157, unused error code
1240
- E0254 , // import conflicts with imported crate in this module
1241
1280
// E0257,
1242
1281
// E0258,
1243
1282
E0402 , // cannot use an outer type parameter in this context
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ mod foo {
12
+ pub trait MyTrait {
13
+ fn do_something ( ) ;
14
+ }
15
+ }
16
+
17
+ use foo:: MyTrait :: do_something; //~ ERROR E0253
18
+
19
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ extern crate collections;
12
+
13
+ mod foo {
14
+ pub trait collections {
15
+ fn do_something ( ) ;
16
+ }
17
+ }
18
+
19
+ use foo:: collections; //~ ERROR E0254
20
+
21
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ use bar:: foo;
12
+
13
+ fn foo ( ) { } //~ ERROR E0255
14
+
15
+ mod bar {
16
+ pub fn foo ( ) { }
17
+ }
18
+
19
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ extern crate collections;
12
+ extern crate libc as collections; //~ ERROR E0259
13
+
14
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ extern crate collections;
12
+
13
+ mod collections { //~ ERROR E0260
14
+ pub trait MyTrait {
15
+ fn do_something ( ) ;
16
+ }
17
+ }
18
+
19
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ fn foo ( x : & ' a str ) { } //~ ERROR E0261
12
+
13
+ struct Foo {
14
+ x : & ' a str , //~ ERROR E0261
15
+ }
16
+
17
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ fn foo < ' static > ( x : & ' static str ) { } //~ ERROR E0262
12
+
13
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ fn foo < ' a , ' b , ' a > ( x : & ' a str , y : & ' b str ) { } //~ ERROR E0263
12
+
13
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #![ feature( lang_items) ]
12
+
13
+ extern "C" {
14
+ #[ lang = "cake" ]
15
+ fn cake ( ) ; //~ ERROR E0264
16
+ }
17
+
18
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ fn main ( ) {
12
+ let w = || { break ; } ; //~ ERROR E0267
13
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ fn main ( ) {
12
+ break ; //~ ERROR E0268
13
+ }
You can’t perform that action at this time.
0 commit comments