Skip to content

Commit 51f0c0d

Browse files
committed
Move some E0XXX to ui
1 parent e87e0bc commit 51f0c0d

File tree

482 files changed

+3026
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

482 files changed

+3026
-0
lines changed
File renamed without changes.

src/test/ui/error-codes/E0001.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: unreachable pattern
2+
--> $DIR/E0001.rs:18:9
3+
|
4+
18 | _ => {/* ... */} //~ ERROR unreachable pattern
5+
| ^
6+
|
7+
note: lint level defined here
8+
--> $DIR/E0001.rs:11:9
9+
|
10+
11 | #![deny(unreachable_patterns)]
11+
| ^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+
File renamed without changes.
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0004]: non-exhaustive patterns: type std::option::Option<i32> is non-empty
2+
--> $DIR/E0004-2.rs:14:11
3+
|
4+
14 | match x { } //~ ERROR E0004
5+
| ^
6+
|
7+
help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
8+
--> $DIR/E0004-2.rs:14:11
9+
|
10+
14 | match x { } //~ ERROR E0004
11+
| ^
12+
13+
error: aborting due to previous error
14+
File renamed without changes.

src/test/ui/error-codes/E0004.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered
2+
--> $DIR/E0004.rs:19:11
3+
|
4+
19 | match x { //~ ERROR E0004
5+
| ^ pattern `HastaLaVistaBaby` not covered
6+
7+
error: aborting due to previous error
8+
File renamed without changes.

src/test/ui/error-codes/E0005.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0005]: refutable pattern in local binding: `None` not covered
2+
--> $DIR/E0005.rs:13:9
3+
|
4+
13 | let Some(y) = x; //~ ERROR E0005
5+
| ^^^^^^^ pattern `None` not covered
6+
7+
error: aborting due to previous error
8+
File renamed without changes.

src/test/ui/error-codes/E0007.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0007]: cannot bind by-move with sub-bindings
2+
--> $DIR/E0007.rs:14:9
3+
|
4+
14 | op_string @ Some(s) => {},
5+
| ^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it
6+
7+
error[E0303]: pattern bindings are not allowed after an `@`
8+
--> $DIR/E0007.rs:14:26
9+
|
10+
14 | op_string @ Some(s) => {},
11+
| ^ not allowed after `@`
12+
13+
error: aborting due to 2 previous errors
14+
File renamed without changes.

src/test/ui/error-codes/E0008.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0008]: cannot bind by-move into a pattern guard
2+
--> $DIR/E0008.rs:13:14
3+
|
4+
13 | Some(s) if s.len() == 0 => {},
5+
| ^ moves value into pattern guard
6+
7+
error: aborting due to previous error
8+
File renamed without changes.

src/test/ui/error-codes/E0009.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error[E0009]: cannot bind by-move and by-ref in the same pattern
2+
--> $DIR/E0009.rs:15:15
3+
|
4+
15 | Some((y, ref z)) => {},
5+
| ^ ----- both by-ref and by-move used
6+
| |
7+
| by-move pattern here
8+
9+
error: aborting due to previous error
10+
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
// compile-flags: -Z teach
12+
13+
#![feature(box_syntax)]
14+
#![allow(warnings)]
15+
16+
const CON : Box<i32> = box 0; //~ ERROR E0010
17+
18+
fn main() {}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error[E0010]: allocations are not allowed in constants
2+
--> $DIR/E0010-teach.rs:16:24
3+
|
4+
16 | const CON : Box<i32> = box 0; //~ ERROR E0010
5+
| ^^^^^ allocation not allowed in constants
6+
|
7+
= note: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time.
8+
9+
error: aborting due to previous error
10+
File renamed without changes.

src/test/ui/error-codes/E0010.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0010]: allocations are not allowed in constants
2+
--> $DIR/E0010.rs:14:24
3+
|
4+
14 | const CON : Box<i32> = box 0; //~ ERROR E0010
5+
| ^^^^^ allocation not allowed in constants
6+
7+
error: aborting due to previous error
8+
File renamed without changes.

src/test/ui/error-codes/E0017.stderr

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error[E0017]: references in constants may only refer to immutable values
2+
--> $DIR/E0017.rs:14:30
3+
|
4+
14 | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
5+
| ^^^^^^ constants require immutable values
6+
7+
error[E0017]: references in statics may only refer to immutable values
8+
--> $DIR/E0017.rs:15:39
9+
|
10+
15 | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
11+
| ^^^^^^ statics require immutable values
12+
13+
error[E0596]: cannot borrow immutable static item as mutable
14+
--> $DIR/E0017.rs:15:44
15+
|
16+
15 | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
17+
| ^
18+
19+
error[E0017]: references in statics may only refer to immutable values
20+
--> $DIR/E0017.rs:17:38
21+
|
22+
17 | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
23+
| ^^^^^^ statics require immutable values
24+
25+
error: aborting due to 4 previous errors
26+
File renamed without changes.

src/test/ui/error-codes/E0023.stderr

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
2+
--> $DIR/E0023.rs:20:9
3+
|
4+
20 | Fruit::Apple(a) => {}, //~ ERROR E0023
5+
| ^^^^^^^^^^^^^^^ expected 2 fields, found 1
6+
7+
error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
8+
--> $DIR/E0023.rs:21:9
9+
|
10+
21 | Fruit::Apple(a, b, c) => {}, //~ ERROR E0023
11+
| ^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 3
12+
13+
error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field
14+
--> $DIR/E0023.rs:22:9
15+
|
16+
22 | Fruit::Pear(1, 2) => {}, //~ ERROR E0023
17+
| ^^^^^^^^^^^^^^^^^ expected 1 field, found 2
18+
19+
error: aborting due to 3 previous errors
20+
File renamed without changes.

src/test/ui/error-codes/E0025.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error[E0025]: field `a` bound multiple times in the pattern
2+
--> $DIR/E0025.rs:18:21
3+
|
4+
18 | let Foo { a: x, a: y, b: 0 } = x;
5+
| ---- ^^^^ multiple uses of `a` in pattern
6+
| |
7+
| first use of `a`
8+
9+
error: aborting due to previous error
10+
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
// compile-flags: -Z teach
12+
13+
struct Thing {
14+
x: u32,
15+
y: u32
16+
}
17+
18+
fn main() {
19+
let thing = Thing { x: 0, y: 0 };
20+
match thing {
21+
Thing { x, y, z } => {}
22+
//~^ ERROR struct `Thing` does not have a field named `z` [E0026]
23+
}
24+
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0026]: struct `Thing` does not have a field named `z`
2+
--> $DIR/E0026-teach.rs:21:23
3+
|
4+
21 | Thing { x, y, z } => {}
5+
| ^ struct `Thing` does not have field `z`
6+
|
7+
= note: This error indicates that a struct pattern attempted to extract a non-existent field from a struct. Struct fields are identified by the name used before the colon : so struct patterns should resemble the declaration of the struct type being matched.
8+
9+
If you are using shorthand field patterns but want to refer to the struct field by a different name, you should rename it explicitly.
10+
11+
error: aborting due to previous error
12+
File renamed without changes.

src/test/ui/error-codes/E0026.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0026]: struct `Thing` does not have a field named `z`
2+
--> $DIR/E0026.rs:19:23
3+
|
4+
19 | Thing { x, y, z } => {}
5+
| ^ struct `Thing` does not have field `z`
6+
7+
error: aborting due to previous error
8+
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
// compile-flags: -Z teach
12+
13+
struct Dog {
14+
name: String,
15+
age: u32,
16+
}
17+
18+
fn main() {
19+
let d = Dog { name: "Rusty".to_string(), age: 8 };
20+
21+
match d {
22+
Dog { age: x } => {}
23+
//~^ ERROR pattern does not mention field `name`
24+
}
25+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error[E0027]: pattern does not mention field `name`
2+
--> $DIR/E0027-teach.rs:22:9
3+
|
4+
22 | Dog { age: x } => {}
5+
| ^^^^^^^^^^^^^^ missing field `name`
6+
|
7+
= note: This error indicates that a pattern for a struct fails to specify a sub-pattern for every one of the struct's fields. Ensure that each field from the struct's definition is mentioned in the pattern, or use `..` to ignore unwanted fields.
8+
9+
error: aborting due to previous error
10+
File renamed without changes.

src/test/ui/error-codes/E0027.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0027]: pattern does not mention field `name`
2+
--> $DIR/E0027.rs:20:9
3+
|
4+
20 | Dog { age: x } => {}
5+
| ^^^^^^^^^^^^^^ missing field `name`
6+
7+
error: aborting due to previous error
8+
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
// compile-flags: -Z teach
12+
13+
fn main() {
14+
let s = "hoho";
15+
16+
match s {
17+
"hello" ... "world" => {}
18+
//~^ ERROR only char and numeric types are allowed in range patterns
19+
//~| ERROR non-reference pattern used to match a reference
20+
_ => {}
21+
}
22+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0658]: non-reference pattern used to match a reference (see issue #42640)
2+
--> $DIR/E0029-teach.rs:17:9
3+
|
4+
17 | "hello" ... "world" => {}
5+
| ^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&"hello" ... "world"`
6+
|
7+
= help: add #![feature(match_default_bindings)] to the crate attributes to enable
8+
9+
error[E0029]: only char and numeric types are allowed in range patterns
10+
--> $DIR/E0029-teach.rs:17:9
11+
|
12+
17 | "hello" ... "world" => {}
13+
| ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types
14+
|
15+
= note: start type: &'static str
16+
= note: end type: &'static str
17+
= note: In a match expression, only numbers and characters can be matched against a range. This is because the compiler checks that the range is non-empty at compile-time, and is unable to evaluate arbitrary comparison functions. If you want to capture values of an orderable type between two end-points, you can use a guard.
18+
19+
error: aborting due to 2 previous errors
20+
File renamed without changes.

src/test/ui/error-codes/E0029.stderr

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0658]: non-reference pattern used to match a reference (see issue #42640)
2+
--> $DIR/E0029.rs:15:9
3+
|
4+
15 | "hello" ... "world" => {}
5+
| ^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&"hello" ... "world"`
6+
|
7+
= help: add #![feature(match_default_bindings)] to the crate attributes to enable
8+
9+
error[E0029]: only char and numeric types are allowed in range patterns
10+
--> $DIR/E0029.rs:15:9
11+
|
12+
15 | "hello" ... "world" => {}
13+
| ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types
14+
|
15+
= note: start type: &'static str
16+
= note: end type: &'static str
17+
18+
error: aborting due to 2 previous errors
19+
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
// compile-flags: -Z teach
12+
13+
fn main() {
14+
match 5u32 {
15+
1000 ... 5 => {}
16+
//~^ ERROR lower range bound must be less than or equal to upper
17+
}
18+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error[E0030]: lower range bound must be less than or equal to upper
2+
--> $DIR/E0030-teach.rs:15:9
3+
|
4+
15 | 1000 ... 5 => {}
5+
| ^^^^ lower bound larger than upper bound
6+
|
7+
= note: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
8+
9+
error: aborting due to previous error
10+
File renamed without changes.

src/test/ui/error-codes/E0030.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0030]: lower range bound must be less than or equal to upper
2+
--> $DIR/E0030.rs:14:9
3+
|
4+
14 | 1000 ... 5 => {}
5+
| ^^^^ lower bound larger than upper bound
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)