-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
482 changed files
with
3,026 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: unreachable pattern | ||
--> $DIR/E0001.rs:18:9 | ||
| | ||
18 | _ => {/* ... */} //~ ERROR unreachable pattern | ||
| ^ | ||
| | ||
note: lint level defined here | ||
--> $DIR/E0001.rs:11:9 | ||
| | ||
11 | #![deny(unreachable_patterns)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0004]: non-exhaustive patterns: type std::option::Option<i32> is non-empty | ||
--> $DIR/E0004-2.rs:14:11 | ||
| | ||
14 | match x { } //~ ERROR E0004 | ||
| ^ | ||
| | ||
help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms. | ||
--> $DIR/E0004-2.rs:14:11 | ||
| | ||
14 | match x { } //~ ERROR E0004 | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered | ||
--> $DIR/E0004.rs:19:11 | ||
| | ||
19 | match x { //~ ERROR E0004 | ||
| ^ pattern `HastaLaVistaBaby` not covered | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error[E0005]: refutable pattern in local binding: `None` not covered | ||
--> $DIR/E0005.rs:13:9 | ||
| | ||
13 | let Some(y) = x; //~ ERROR E0005 | ||
| ^^^^^^^ pattern `None` not covered | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0007]: cannot bind by-move with sub-bindings | ||
--> $DIR/E0007.rs:14:9 | ||
| | ||
14 | op_string @ Some(s) => {}, | ||
| ^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it | ||
|
||
error[E0303]: pattern bindings are not allowed after an `@` | ||
--> $DIR/E0007.rs:14:26 | ||
| | ||
14 | op_string @ Some(s) => {}, | ||
| ^ not allowed after `@` | ||
|
||
error: aborting due to 2 previous errors | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error[E0008]: cannot bind by-move into a pattern guard | ||
--> $DIR/E0008.rs:13:14 | ||
| | ||
13 | Some(s) if s.len() == 0 => {}, | ||
| ^ moves value into pattern guard | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error[E0009]: cannot bind by-move and by-ref in the same pattern | ||
--> $DIR/E0009.rs:15:15 | ||
| | ||
15 | Some((y, ref z)) => {}, | ||
| ^ ----- both by-ref and by-move used | ||
| | | ||
| by-move pattern here | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// compile-flags: -Z teach | ||
|
||
#![feature(box_syntax)] | ||
#![allow(warnings)] | ||
|
||
const CON : Box<i32> = box 0; //~ ERROR E0010 | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error[E0010]: allocations are not allowed in constants | ||
--> $DIR/E0010-teach.rs:16:24 | ||
| | ||
16 | const CON : Box<i32> = box 0; //~ ERROR E0010 | ||
| ^^^^^ allocation not allowed in constants | ||
| | ||
= 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. | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error[E0010]: allocations are not allowed in constants | ||
--> $DIR/E0010.rs:14:24 | ||
| | ||
14 | const CON : Box<i32> = box 0; //~ ERROR E0010 | ||
| ^^^^^ allocation not allowed in constants | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
error[E0017]: references in constants may only refer to immutable values | ||
--> $DIR/E0017.rs:14:30 | ||
| | ||
14 | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 | ||
| ^^^^^^ constants require immutable values | ||
|
||
error[E0017]: references in statics may only refer to immutable values | ||
--> $DIR/E0017.rs:15:39 | ||
| | ||
15 | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ||
| ^^^^^^ statics require immutable values | ||
|
||
error[E0596]: cannot borrow immutable static item as mutable | ||
--> $DIR/E0017.rs:15:44 | ||
| | ||
15 | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ||
| ^ | ||
|
||
error[E0017]: references in statics may only refer to immutable values | ||
--> $DIR/E0017.rs:17:38 | ||
| | ||
17 | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 | ||
| ^^^^^^ statics require immutable values | ||
|
||
error: aborting due to 4 previous errors | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields | ||
--> $DIR/E0023.rs:20:9 | ||
| | ||
20 | Fruit::Apple(a) => {}, //~ ERROR E0023 | ||
| ^^^^^^^^^^^^^^^ expected 2 fields, found 1 | ||
|
||
error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields | ||
--> $DIR/E0023.rs:21:9 | ||
| | ||
21 | Fruit::Apple(a, b, c) => {}, //~ ERROR E0023 | ||
| ^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 3 | ||
|
||
error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field | ||
--> $DIR/E0023.rs:22:9 | ||
| | ||
22 | Fruit::Pear(1, 2) => {}, //~ ERROR E0023 | ||
| ^^^^^^^^^^^^^^^^^ expected 1 field, found 2 | ||
|
||
error: aborting due to 3 previous errors | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error[E0025]: field `a` bound multiple times in the pattern | ||
--> $DIR/E0025.rs:18:21 | ||
| | ||
18 | let Foo { a: x, a: y, b: 0 } = x; | ||
| ---- ^^^^ multiple uses of `a` in pattern | ||
| | | ||
| first use of `a` | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// compile-flags: -Z teach | ||
|
||
struct Thing { | ||
x: u32, | ||
y: u32 | ||
} | ||
|
||
fn main() { | ||
let thing = Thing { x: 0, y: 0 }; | ||
match thing { | ||
Thing { x, y, z } => {} | ||
//~^ ERROR struct `Thing` does not have a field named `z` [E0026] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0026]: struct `Thing` does not have a field named `z` | ||
--> $DIR/E0026-teach.rs:21:23 | ||
| | ||
21 | Thing { x, y, z } => {} | ||
| ^ struct `Thing` does not have field `z` | ||
| | ||
= 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. | ||
|
||
If you are using shorthand field patterns but want to refer to the struct field by a different name, you should rename it explicitly. | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error[E0026]: struct `Thing` does not have a field named `z` | ||
--> $DIR/E0026.rs:19:23 | ||
| | ||
19 | Thing { x, y, z } => {} | ||
| ^ struct `Thing` does not have field `z` | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// compile-flags: -Z teach | ||
|
||
struct Dog { | ||
name: String, | ||
age: u32, | ||
} | ||
|
||
fn main() { | ||
let d = Dog { name: "Rusty".to_string(), age: 8 }; | ||
|
||
match d { | ||
Dog { age: x } => {} | ||
//~^ ERROR pattern does not mention field `name` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error[E0027]: pattern does not mention field `name` | ||
--> $DIR/E0027-teach.rs:22:9 | ||
| | ||
22 | Dog { age: x } => {} | ||
| ^^^^^^^^^^^^^^ missing field `name` | ||
| | ||
= 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. | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error[E0027]: pattern does not mention field `name` | ||
--> $DIR/E0027.rs:20:9 | ||
| | ||
20 | Dog { age: x } => {} | ||
| ^^^^^^^^^^^^^^ missing field `name` | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// compile-flags: -Z teach | ||
|
||
fn main() { | ||
let s = "hoho"; | ||
|
||
match s { | ||
"hello" ... "world" => {} | ||
//~^ ERROR only char and numeric types are allowed in range patterns | ||
//~| ERROR non-reference pattern used to match a reference | ||
_ => {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0658]: non-reference pattern used to match a reference (see issue #42640) | ||
--> $DIR/E0029-teach.rs:17:9 | ||
| | ||
17 | "hello" ... "world" => {} | ||
| ^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&"hello" ... "world"` | ||
| | ||
= help: add #![feature(match_default_bindings)] to the crate attributes to enable | ||
|
||
error[E0029]: only char and numeric types are allowed in range patterns | ||
--> $DIR/E0029-teach.rs:17:9 | ||
| | ||
17 | "hello" ... "world" => {} | ||
| ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types | ||
| | ||
= note: start type: &'static str | ||
= note: end type: &'static str | ||
= 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. | ||
|
||
error: aborting due to 2 previous errors | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error[E0658]: non-reference pattern used to match a reference (see issue #42640) | ||
--> $DIR/E0029.rs:15:9 | ||
| | ||
15 | "hello" ... "world" => {} | ||
| ^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&"hello" ... "world"` | ||
| | ||
= help: add #![feature(match_default_bindings)] to the crate attributes to enable | ||
|
||
error[E0029]: only char and numeric types are allowed in range patterns | ||
--> $DIR/E0029.rs:15:9 | ||
| | ||
15 | "hello" ... "world" => {} | ||
| ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types | ||
| | ||
= note: start type: &'static str | ||
= note: end type: &'static str | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// compile-flags: -Z teach | ||
|
||
fn main() { | ||
match 5u32 { | ||
1000 ... 5 => {} | ||
//~^ ERROR lower range bound must be less than or equal to upper | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error[E0030]: lower range bound must be less than or equal to upper | ||
--> $DIR/E0030-teach.rs:15:9 | ||
| | ||
15 | 1000 ... 5 => {} | ||
| ^^^^ lower bound larger than upper bound | ||
| | ||
= 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. | ||
|
||
error: aborting due to previous error | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error[E0030]: lower range bound must be less than or equal to upper | ||
--> $DIR/E0030.rs:14:9 | ||
| | ||
14 | 1000 ... 5 => {} | ||
| ^^^^ lower bound larger than upper bound | ||
|
||
error: aborting due to previous error | ||
|
Oops, something went wrong.