Skip to content

Commit

Permalink
And --bless tests accordingly for those exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Jul 28, 2019
1 parent 18ccd6a commit 8774207
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 534 deletions.
1 change: 0 additions & 1 deletion src/test/ui/associated-path-shl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ fn main() {
let _ = <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
let <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
let 0 ..= <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
//~^ ERROR only char and numeric types are allowed in range patterns
<<A>::B>::C; //~ ERROR cannot find type `A` in this scope
}
16 changes: 3 additions & 13 deletions src/test/ui/associated-path-shl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,11 @@ LL | let 0 ..= <<A>::B>::C;
| ^ not found in this scope

error[E0412]: cannot find type `A` in this scope
--> $DIR/associated-path-shl.rs:9:7
--> $DIR/associated-path-shl.rs:8:7
|
LL | <<A>::B>::C;
| ^ not found in this scope

error[E0029]: only char and numeric types are allowed in range patterns
--> $DIR/associated-path-shl.rs:7:15
|
LL | let 0 ..= <<A>::B>::C;
| ^^^^^^^^^^^ ranges require char or numeric types
|
= note: start type: {integer}
= note: end type: [type error]

error: aborting due to 6 previous errors
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0029, E0412.
For more information about an error, try `rustc --explain E0029`.
For more information about this error, try `rustc --explain E0412`.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ fn main() {
match [5..4, 99..105, 43..44] {
[_, 99.., _] => {},
//~^ ERROR `X..` range patterns are not supported
//~| ERROR arbitrary expressions aren't allowed in patterns
//~| ERROR only char and numeric types are allowed in range patterns
//~| ERROR mismatched types
_ => {},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@ error: `X..` range patterns are not supported
LL | [_, 99.., _] => {},
| ^^^^ help: try using the maximum value for the type: `99..MAX`

error: arbitrary expressions aren't allowed in patterns
error[E0308]: mismatched types
--> $DIR/exclusive_range_pattern_syntax_collision.rs:5:13
|
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this match expression has type `std::ops::Range<{integer}>`
LL | [_, 99.., _] => {},
| ^^^^

error[E0029]: only char and numeric types are allowed in range patterns
--> $DIR/exclusive_range_pattern_syntax_collision.rs:5:13
|
LL | [_, 99.., _] => {},
| ^^^^ ranges require char or numeric types
| ^^^^ expected struct `std::ops::Range`, found integer
|
= note: start type: {integer}
= note: end type: [type error]
= note: expected type `std::ops::Range<{integer}>`
found type `{integer}`

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0029`.
For more information about this error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ fn main() {
match [5..4, 99..105, 43..44] {
[_, 99..] => {},
//~^ ERROR `X..` range patterns are not supported
//~| ERROR arbitrary expressions aren't allowed in patterns
//~| ERROR pattern requires 2 elements but array has 3
//~| ERROR only char and numeric types are allowed in range patterns
//~| ERROR mismatched types
_ => {},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,24 @@ error: `X..` range patterns are not supported
LL | [_, 99..] => {},
| ^^^^ help: try using the maximum value for the type: `99..MAX`

error: arbitrary expressions aren't allowed in patterns
--> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:13
|
LL | [_, 99..] => {},
| ^^^^

error[E0527]: pattern requires 2 elements but array has 3
--> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:9
|
LL | [_, 99..] => {},
| ^^^^^^^^^ expected 3 elements

error[E0029]: only char and numeric types are allowed in range patterns
error[E0308]: mismatched types
--> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:13
|
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this match expression has type `std::ops::Range<{integer}>`
LL | [_, 99..] => {},
| ^^^^ ranges require char or numeric types
| ^^^^ expected struct `std::ops::Range`, found integer
|
= note: start type: {integer}
= note: end type: [type error]
= note: expected type `std::ops::Range<{integer}>`
found type `{integer}`

error: aborting due to 4 previous errors
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0029, E0527.
For more information about an error, try `rustc --explain E0029`.
Some errors have detailed explanations: E0308, E0527.
For more information about an error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ fn main() {
match [5..4, 99..105, 43..44] {
[..9, 99..100, _] => {},
//~^ ERROR `..X` range patterns are not supported
//~| ERROR arbitrary expressions aren't allowed in patterns
//~| ERROR only char and numeric types are allowed in range patterns
//~| ERROR mismatched types
//~| ERROR mismatched types
_ => {},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ error: `..X` range patterns are not supported
LL | [..9, 99..100, _] => {},
| ^^^ help: try using the minimum value for the type: `MIN..9`

error: arbitrary expressions aren't allowed in patterns
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:10
|
LL | [..9, 99..100, _] => {},
| ^^^

error[E0029]: only char and numeric types are allowed in range patterns
error[E0308]: mismatched types
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:10
|
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this match expression has type `std::ops::Range<{integer}>`
LL | [..9, 99..100, _] => {},
| ^^^ ranges require char or numeric types
| ^^^ expected struct `std::ops::Range`, found integer
|
= note: start type: [type error]
= note: end type: {integer}
= note: expected type `std::ops::Range<{integer}>`
found type `{integer}`

error[E0308]: mismatched types
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:15
Expand All @@ -30,7 +26,6 @@ LL | [..9, 99..100, _] => {},
= note: expected type `std::ops::Range<{integer}>`
found type `{integer}`

error: aborting due to 4 previous errors
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0029, E0308.
For more information about an error, try `rustc --explain E0029`.
For more information about this error, try `rustc --explain E0308`.
9 changes: 5 additions & 4 deletions src/test/ui/parser/pat-tuple-4.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
fn main() {
const PAT: u8 = 0;

match 0 {
(.. pat) => {}
(.. PAT) => {}
//~^ ERROR `..X` range patterns are not supported
//~| ERROR arbitrary expressions aren't allowed in patterns
//~| ERROR cannot find value `pat` in this scope
//~| ERROR exclusive range pattern syntax is experimental
//~| ERROR only char and numeric types are allowed in range patterns
}
}

const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types
40 changes: 14 additions & 26 deletions src/test/ui/parser/pat-tuple-4.stderr
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
error: `..X` range patterns are not supported
--> $DIR/pat-tuple-4.rs:3:10
--> $DIR/pat-tuple-4.rs:5:10
|
LL | (.. pat) => {}
| ^^^^^^ help: try using the minimum value for the type: `MIN..pat`

error: arbitrary expressions aren't allowed in patterns
--> $DIR/pat-tuple-4.rs:3:10
|
LL | (.. pat) => {}
| ^^^^^^

error[E0425]: cannot find value `pat` in this scope
--> $DIR/pat-tuple-4.rs:3:13
|
LL | (.. pat) => {}
| ^^^ not found in this scope
LL | (.. PAT) => {}
| ^^^^^^ help: try using the minimum value for the type: `MIN..PAT`

error[E0658]: exclusive range pattern syntax is experimental
--> $DIR/pat-tuple-4.rs:3:10
--> $DIR/pat-tuple-4.rs:5:10
|
LL | (.. pat) => {}
LL | (.. PAT) => {}
| ^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/37854
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable

error[E0029]: only char and numeric types are allowed in range patterns
--> $DIR/pat-tuple-4.rs:3:10
error[E0308]: mismatched types
--> $DIR/pat-tuple-4.rs:11:30
|
LL | (.. pat) => {}
| ^^^^^^ ranges require char or numeric types
LL | const RECOVERY_WITNESS: () = 0;
| ^ expected (), found integer
|
= note: start type: [type error]
= note: end type: [type error]
= note: expected type `()`
found type `{integer}`

error: aborting due to 5 previous errors
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0029, E0425, E0658.
For more information about an error, try `rustc --explain E0029`.
Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.
8 changes: 4 additions & 4 deletions src/test/ui/parser/pat-tuple-5.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
fn main() {
const PAT: u8 = 0;

match (0, 1) {
(pat ..) => {}
(PAT ..) => {}
//~^ ERROR `X..` range patterns are not supported
//~| ERROR arbitrary expressions aren't allowed in patterns
//~| ERROR cannot find value `pat` in this scope
//~| ERROR exclusive range pattern syntax is experimental
//~| ERROR only char and numeric types are allowed in range patterns
//~| ERROR mismatched types
}
}
42 changes: 16 additions & 26 deletions src/test/ui/parser/pat-tuple-5.stderr
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
error: `X..` range patterns are not supported
--> $DIR/pat-tuple-5.rs:3:10
--> $DIR/pat-tuple-5.rs:5:10
|
LL | (pat ..) => {}
| ^^^^^^ help: try using the maximum value for the type: `pat..MAX`

error: arbitrary expressions aren't allowed in patterns
--> $DIR/pat-tuple-5.rs:3:10
|
LL | (pat ..) => {}
| ^^^^^^

error[E0425]: cannot find value `pat` in this scope
--> $DIR/pat-tuple-5.rs:3:10
|
LL | (pat ..) => {}
| ^^^ not found in this scope
LL | (PAT ..) => {}
| ^^^^^^ help: try using the maximum value for the type: `PAT..MAX`

error[E0658]: exclusive range pattern syntax is experimental
--> $DIR/pat-tuple-5.rs:3:10
--> $DIR/pat-tuple-5.rs:5:10
|
LL | (pat ..) => {}
LL | (PAT ..) => {}
| ^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/37854
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable

error[E0029]: only char and numeric types are allowed in range patterns
--> $DIR/pat-tuple-5.rs:3:10
error[E0308]: mismatched types
--> $DIR/pat-tuple-5.rs:5:10
|
LL | (pat ..) => {}
| ^^^^^^ ranges require char or numeric types
LL | match (0, 1) {
| ------ this match expression has type `({integer}, {integer})`
LL | (PAT ..) => {}
| ^^^^^^ expected tuple, found u8
|
= note: start type: [type error]
= note: end type: [type error]
= note: expected type `({integer}, {integer})`
found type `u8`

error: aborting due to 5 previous errors
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0029, E0425, E0658.
For more information about an error, try `rustc --explain E0029`.
Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.
Loading

0 comments on commit 8774207

Please sign in to comment.