From 062abf3d217788682aefdd2343eafa694af971bb Mon Sep 17 00:00:00 2001 From: Caio Date: Fri, 19 Nov 2021 07:18:00 -0300 Subject: Move some tests to more reasonable directories --- src/test/ui/lexer/lex-bad-binary-literal.rs | 11 ++ src/test/ui/lexer/lex-bad-binary-literal.stderr | 56 ++++++++ src/test/ui/lexer/lex-bad-char-literals-1.rs | 17 +++ src/test/ui/lexer/lex-bad-char-literals-1.stderr | 30 +++++ src/test/ui/lexer/lex-bad-char-literals-2.rs | 6 + src/test/ui/lexer/lex-bad-char-literals-2.stderr | 13 ++ src/test/ui/lexer/lex-bad-char-literals-3.rs | 7 + src/test/ui/lexer/lex-bad-char-literals-3.stderr | 24 ++++ src/test/ui/lexer/lex-bad-char-literals-4.rs | 5 + src/test/ui/lexer/lex-bad-char-literals-4.stderr | 9 ++ src/test/ui/lexer/lex-bad-char-literals-5.rs | 7 + src/test/ui/lexer/lex-bad-char-literals-5.stderr | 24 ++++ src/test/ui/lexer/lex-bad-char-literals-6.rs | 17 +++ src/test/ui/lexer/lex-bad-char-literals-6.stderr | 61 +++++++++ src/test/ui/lexer/lex-bad-char-literals-7.rs | 13 ++ src/test/ui/lexer/lex-bad-char-literals-7.stderr | 21 +++ src/test/ui/lexer/lex-bad-numeric-literals.rs | 27 ++++ src/test/ui/lexer/lex-bad-numeric-literals.stderr | 141 +++++++++++++++++++++ src/test/ui/lexer/lex-bad-octal-literal.rs | 4 + src/test/ui/lexer/lex-bad-octal-literal.stderr | 14 ++ src/test/ui/lexer/lex-bad-token.rs | 3 + src/test/ui/lexer/lex-bad-token.stderr | 8 ++ src/test/ui/lexer/lex-bare-cr-nondoc-comment.rs | 9 ++ .../lex-bare-cr-string-literal-doc-comment.rs | 26 ++++ .../lex-bare-cr-string-literal-doc-comment.stderr | 46 +++++++ src/test/ui/lexer/lex-stray-backslash.rs | 3 + src/test/ui/lexer/lex-stray-backslash.stderr | 8 ++ ...crlf-line-endings-string-literal-doc-comment.rs | 38 ++++++ src/test/ui/parser/lex-bad-binary-literal.rs | 11 -- src/test/ui/parser/lex-bad-binary-literal.stderr | 56 -------- src/test/ui/parser/lex-bad-char-literals-1.rs | 17 --- src/test/ui/parser/lex-bad-char-literals-1.stderr | 30 ----- src/test/ui/parser/lex-bad-char-literals-2.rs | 6 - src/test/ui/parser/lex-bad-char-literals-2.stderr | 13 -- src/test/ui/parser/lex-bad-char-literals-3.rs | 7 - src/test/ui/parser/lex-bad-char-literals-3.stderr | 24 ---- src/test/ui/parser/lex-bad-char-literals-4.rs | 5 - src/test/ui/parser/lex-bad-char-literals-4.stderr | 9 -- src/test/ui/parser/lex-bad-char-literals-5.rs | 7 - src/test/ui/parser/lex-bad-char-literals-5.stderr | 24 ---- src/test/ui/parser/lex-bad-char-literals-6.rs | 17 --- src/test/ui/parser/lex-bad-char-literals-6.stderr | 61 --------- src/test/ui/parser/lex-bad-char-literals-7.rs | 13 -- src/test/ui/parser/lex-bad-char-literals-7.stderr | 21 --- src/test/ui/parser/lex-bad-numeric-literals.rs | 27 ---- src/test/ui/parser/lex-bad-numeric-literals.stderr | 141 --------------------- src/test/ui/parser/lex-bad-octal-literal.rs | 4 - src/test/ui/parser/lex-bad-octal-literal.stderr | 14 -- src/test/ui/parser/lex-bad-token.rs | 3 - src/test/ui/parser/lex-bad-token.stderr | 8 -- src/test/ui/parser/lex-bare-cr-nondoc-comment.rs | 9 -- .../lex-bare-cr-string-literal-doc-comment.rs | 26 ---- .../lex-bare-cr-string-literal-doc-comment.stderr | 46 ------- src/test/ui/parser/lex-stray-backslash.rs | 3 - src/test/ui/parser/lex-stray-backslash.stderr | 8 -- ...crlf-line-endings-string-literal-doc-comment.rs | 38 ------ src/tools/tidy/src/ui_tests.rs | 6 +- 57 files changed, 649 insertions(+), 653 deletions(-) create mode 100644 src/test/ui/lexer/lex-bad-binary-literal.rs create mode 100644 src/test/ui/lexer/lex-bad-binary-literal.stderr create mode 100644 src/test/ui/lexer/lex-bad-char-literals-1.rs create mode 100644 src/test/ui/lexer/lex-bad-char-literals-1.stderr create mode 100644 src/test/ui/lexer/lex-bad-char-literals-2.rs create mode 100644 src/test/ui/lexer/lex-bad-char-literals-2.stderr create mode 100644 src/test/ui/lexer/lex-bad-char-literals-3.rs create mode 100644 src/test/ui/lexer/lex-bad-char-literals-3.stderr create mode 100644 src/test/ui/lexer/lex-bad-char-literals-4.rs create mode 100644 src/test/ui/lexer/lex-bad-char-literals-4.stderr create mode 100644 src/test/ui/lexer/lex-bad-char-literals-5.rs create mode 100644 src/test/ui/lexer/lex-bad-char-literals-5.stderr create mode 100644 src/test/ui/lexer/lex-bad-char-literals-6.rs create mode 100644 src/test/ui/lexer/lex-bad-char-literals-6.stderr create mode 100644 src/test/ui/lexer/lex-bad-char-literals-7.rs create mode 100644 src/test/ui/lexer/lex-bad-char-literals-7.stderr create mode 100644 src/test/ui/lexer/lex-bad-numeric-literals.rs create mode 100644 src/test/ui/lexer/lex-bad-numeric-literals.stderr create mode 100644 src/test/ui/lexer/lex-bad-octal-literal.rs create mode 100644 src/test/ui/lexer/lex-bad-octal-literal.stderr create mode 100644 src/test/ui/lexer/lex-bad-token.rs create mode 100644 src/test/ui/lexer/lex-bad-token.stderr create mode 100644 src/test/ui/lexer/lex-bare-cr-nondoc-comment.rs create mode 100644 src/test/ui/lexer/lex-bare-cr-string-literal-doc-comment.rs create mode 100644 src/test/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr create mode 100644 src/test/ui/lexer/lex-stray-backslash.rs create mode 100644 src/test/ui/lexer/lex-stray-backslash.stderr create mode 100644 src/test/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs delete mode 100644 src/test/ui/parser/lex-bad-binary-literal.rs delete mode 100644 src/test/ui/parser/lex-bad-binary-literal.stderr delete mode 100644 src/test/ui/parser/lex-bad-char-literals-1.rs delete mode 100644 src/test/ui/parser/lex-bad-char-literals-1.stderr delete mode 100644 src/test/ui/parser/lex-bad-char-literals-2.rs delete mode 100644 src/test/ui/parser/lex-bad-char-literals-2.stderr delete mode 100644 src/test/ui/parser/lex-bad-char-literals-3.rs delete mode 100644 src/test/ui/parser/lex-bad-char-literals-3.stderr delete mode 100644 src/test/ui/parser/lex-bad-char-literals-4.rs delete mode 100644 src/test/ui/parser/lex-bad-char-literals-4.stderr delete mode 100644 src/test/ui/parser/lex-bad-char-literals-5.rs delete mode 100644 src/test/ui/parser/lex-bad-char-literals-5.stderr delete mode 100644 src/test/ui/parser/lex-bad-char-literals-6.rs delete mode 100644 src/test/ui/parser/lex-bad-char-literals-6.stderr delete mode 100644 src/test/ui/parser/lex-bad-char-literals-7.rs delete mode 100644 src/test/ui/parser/lex-bad-char-literals-7.stderr delete mode 100644 src/test/ui/parser/lex-bad-numeric-literals.rs delete mode 100644 src/test/ui/parser/lex-bad-numeric-literals.stderr delete mode 100644 src/test/ui/parser/lex-bad-octal-literal.rs delete mode 100644 src/test/ui/parser/lex-bad-octal-literal.stderr delete mode 100644 src/test/ui/parser/lex-bad-token.rs delete mode 100644 src/test/ui/parser/lex-bad-token.stderr delete mode 100644 src/test/ui/parser/lex-bare-cr-nondoc-comment.rs delete mode 100644 src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.rs delete mode 100644 src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr delete mode 100644 src/test/ui/parser/lex-stray-backslash.rs delete mode 100644 src/test/ui/parser/lex-stray-backslash.stderr delete mode 100644 src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs diff --git a/src/test/ui/lexer/lex-bad-binary-literal.rs b/src/test/ui/lexer/lex-bad-binary-literal.rs new file mode 100644 index 00000000000..7df98073e35 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-binary-literal.rs @@ -0,0 +1,11 @@ +fn main() { + 0b121; //~ ERROR invalid digit for a base 2 literal + 0b10_10301; //~ ERROR invalid digit for a base 2 literal + 0b30; //~ ERROR invalid digit for a base 2 literal + 0b41; //~ ERROR invalid digit for a base 2 literal + 0b5; //~ ERROR invalid digit for a base 2 literal + 0b6; //~ ERROR invalid digit for a base 2 literal + 0b7; //~ ERROR invalid digit for a base 2 literal + 0b8; //~ ERROR invalid digit for a base 2 literal + 0b9; //~ ERROR invalid digit for a base 2 literal +} diff --git a/src/test/ui/lexer/lex-bad-binary-literal.stderr b/src/test/ui/lexer/lex-bad-binary-literal.stderr new file mode 100644 index 00000000000..992b3d2487e --- /dev/null +++ b/src/test/ui/lexer/lex-bad-binary-literal.stderr @@ -0,0 +1,56 @@ +error: invalid digit for a base 2 literal + --> $DIR/lex-bad-binary-literal.rs:2:8 + | +LL | 0b121; + | ^ + +error: invalid digit for a base 2 literal + --> $DIR/lex-bad-binary-literal.rs:3:12 + | +LL | 0b10_10301; + | ^ + +error: invalid digit for a base 2 literal + --> $DIR/lex-bad-binary-literal.rs:4:7 + | +LL | 0b30; + | ^ + +error: invalid digit for a base 2 literal + --> $DIR/lex-bad-binary-literal.rs:5:7 + | +LL | 0b41; + | ^ + +error: invalid digit for a base 2 literal + --> $DIR/lex-bad-binary-literal.rs:6:7 + | +LL | 0b5; + | ^ + +error: invalid digit for a base 2 literal + --> $DIR/lex-bad-binary-literal.rs:7:7 + | +LL | 0b6; + | ^ + +error: invalid digit for a base 2 literal + --> $DIR/lex-bad-binary-literal.rs:8:7 + | +LL | 0b7; + | ^ + +error: invalid digit for a base 2 literal + --> $DIR/lex-bad-binary-literal.rs:9:7 + | +LL | 0b8; + | ^ + +error: invalid digit for a base 2 literal + --> $DIR/lex-bad-binary-literal.rs:10:7 + | +LL | 0b9; + | ^ + +error: aborting due to 9 previous errors + diff --git a/src/test/ui/lexer/lex-bad-char-literals-1.rs b/src/test/ui/lexer/lex-bad-char-literals-1.rs new file mode 100644 index 00000000000..e7951cfd2d2 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-1.rs @@ -0,0 +1,17 @@ +static c3: char = + '\x1' //~ ERROR: numeric character escape is too short +; + +static s3: &'static str = + "\x1" //~ ERROR: numeric character escape is too short +; + +static c: char = + '\●' //~ ERROR: unknown character escape +; + +static s: &'static str = + "\●" //~ ERROR: unknown character escape +; + +fn main() {} diff --git a/src/test/ui/lexer/lex-bad-char-literals-1.stderr b/src/test/ui/lexer/lex-bad-char-literals-1.stderr new file mode 100644 index 00000000000..ed129a1d133 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-1.stderr @@ -0,0 +1,30 @@ +error: numeric character escape is too short + --> $DIR/lex-bad-char-literals-1.rs:2:6 + | +LL | '\x1' + | ^^^ + +error: numeric character escape is too short + --> $DIR/lex-bad-char-literals-1.rs:6:6 + | +LL | "\x1" + | ^^^ + +error: unknown character escape: `\u{25cf}` + --> $DIR/lex-bad-char-literals-1.rs:10:7 + | +LL | '\●' + | ^ unknown character escape + | + = help: for more information, visit + +error: unknown character escape: `\u{25cf}` + --> $DIR/lex-bad-char-literals-1.rs:14:7 + | +LL | "\●" + | ^ unknown character escape + | + = help: for more information, visit + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/lexer/lex-bad-char-literals-2.rs b/src/test/ui/lexer/lex-bad-char-literals-2.rs new file mode 100644 index 00000000000..d35dafd9a34 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-2.rs @@ -0,0 +1,6 @@ +// This test needs to the last one appearing in this file as it kills the parser +static c: char = + 'nope' //~ ERROR: character literal may only contain one codepoint +; + +fn main() {} diff --git a/src/test/ui/lexer/lex-bad-char-literals-2.stderr b/src/test/ui/lexer/lex-bad-char-literals-2.stderr new file mode 100644 index 00000000000..c2b19a7ad5f --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-2.stderr @@ -0,0 +1,13 @@ +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-2.rs:3:5 + | +LL | 'nope' + | ^^^^^^ + | +help: if you meant to write a `str` literal, use double quotes + | +LL | "nope" + | ~~~~~~ + +error: aborting due to previous error + diff --git a/src/test/ui/lexer/lex-bad-char-literals-3.rs b/src/test/ui/lexer/lex-bad-char-literals-3.rs new file mode 100644 index 00000000000..5194ff4d935 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-3.rs @@ -0,0 +1,7 @@ +static c: char = '●●'; +//~^ ERROR: character literal may only contain one codepoint + +fn main() { + let ch: &str = '●●'; + //~^ ERROR: character literal may only contain one codepoint +} diff --git a/src/test/ui/lexer/lex-bad-char-literals-3.stderr b/src/test/ui/lexer/lex-bad-char-literals-3.stderr new file mode 100644 index 00000000000..62a5e424cb4 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-3.stderr @@ -0,0 +1,24 @@ +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-3.rs:1:18 + | +LL | static c: char = '●●'; + | ^^^^ + | +help: if you meant to write a `str` literal, use double quotes + | +LL | static c: char = "●●"; + | ~~~~ + +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-3.rs:5:20 + | +LL | let ch: &str = '●●'; + | ^^^^ + | +help: if you meant to write a `str` literal, use double quotes + | +LL | let ch: &str = "●●"; + | ~~~~ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/lexer/lex-bad-char-literals-4.rs b/src/test/ui/lexer/lex-bad-char-literals-4.rs new file mode 100644 index 00000000000..de0a19df993 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-4.rs @@ -0,0 +1,5 @@ +// +// This test needs to the last one appearing in this file as it kills the parser +static c: char = + '● //~ ERROR: unterminated character literal +; diff --git a/src/test/ui/lexer/lex-bad-char-literals-4.stderr b/src/test/ui/lexer/lex-bad-char-literals-4.stderr new file mode 100644 index 00000000000..fec4421c48a --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-4.stderr @@ -0,0 +1,9 @@ +error[E0762]: unterminated character literal + --> $DIR/lex-bad-char-literals-4.rs:4:5 + | +LL | '● + | ^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0762`. diff --git a/src/test/ui/lexer/lex-bad-char-literals-5.rs b/src/test/ui/lexer/lex-bad-char-literals-5.rs new file mode 100644 index 00000000000..0c4339edc4f --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-5.rs @@ -0,0 +1,7 @@ +static c: char = '\x10\x10'; +//~^ ERROR: character literal may only contain one codepoint + +fn main() { + let ch: &str = '\x10\x10'; + //~^ ERROR: character literal may only contain one codepoint +} diff --git a/src/test/ui/lexer/lex-bad-char-literals-5.stderr b/src/test/ui/lexer/lex-bad-char-literals-5.stderr new file mode 100644 index 00000000000..184817a6579 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-5.stderr @@ -0,0 +1,24 @@ +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-5.rs:1:18 + | +LL | static c: char = '\x10\x10'; + | ^^^^^^^^^^ + | +help: if you meant to write a `str` literal, use double quotes + | +LL | static c: char = "\x10\x10"; + | ~~~~~~~~~~ + +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-5.rs:5:20 + | +LL | let ch: &str = '\x10\x10'; + | ^^^^^^^^^^ + | +help: if you meant to write a `str` literal, use double quotes + | +LL | let ch: &str = "\x10\x10"; + | ~~~~~~~~~~ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/lexer/lex-bad-char-literals-6.rs b/src/test/ui/lexer/lex-bad-char-literals-6.rs new file mode 100644 index 00000000000..4379b4fa6d7 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-6.rs @@ -0,0 +1,17 @@ +fn main() { + let x: &str = 'ab'; + //~^ ERROR: character literal may only contain one codepoint + let y: char = 'cd'; + //~^ ERROR: character literal may only contain one codepoint + let z = 'ef'; + //~^ ERROR: character literal may only contain one codepoint + + if x == y {} + //~^ ERROR: can't compare `&str` with `char` + if y == z {} // no error here + if x == z {} + //~^ ERROR: can't compare `&str` with `char` + + let a: usize = ""; + //~^ ERROR: mismatched types +} diff --git a/src/test/ui/lexer/lex-bad-char-literals-6.stderr b/src/test/ui/lexer/lex-bad-char-literals-6.stderr new file mode 100644 index 00000000000..4332bdefcb2 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-6.stderr @@ -0,0 +1,61 @@ +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-6.rs:2:19 + | +LL | let x: &str = 'ab'; + | ^^^^ + | +help: if you meant to write a `str` literal, use double quotes + | +LL | let x: &str = "ab"; + | ~~~~ + +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-6.rs:4:19 + | +LL | let y: char = 'cd'; + | ^^^^ + | +help: if you meant to write a `str` literal, use double quotes + | +LL | let y: char = "cd"; + | ~~~~ + +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-6.rs:6:13 + | +LL | let z = 'ef'; + | ^^^^ + | +help: if you meant to write a `str` literal, use double quotes + | +LL | let z = "ef"; + | ~~~~ + +error[E0277]: can't compare `&str` with `char` + --> $DIR/lex-bad-char-literals-6.rs:9:10 + | +LL | if x == y {} + | ^^ no implementation for `&str == char` + | + = help: the trait `PartialEq` is not implemented for `&str` + +error[E0308]: mismatched types + --> $DIR/lex-bad-char-literals-6.rs:15:20 + | +LL | let a: usize = ""; + | ----- ^^ expected `usize`, found `&str` + | | + | expected due to this + +error[E0277]: can't compare `&str` with `char` + --> $DIR/lex-bad-char-literals-6.rs:12:10 + | +LL | if x == z {} + | ^^ no implementation for `&str == char` + | + = help: the trait `PartialEq` is not implemented for `&str` + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/lexer/lex-bad-char-literals-7.rs b/src/test/ui/lexer/lex-bad-char-literals-7.rs new file mode 100644 index 00000000000..c675df2f3cc --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-7.rs @@ -0,0 +1,13 @@ +fn main() { + let _: char = ''; + //~^ ERROR: empty character literal + let _: char = '\u{}'; + //~^ ERROR: empty unicode escape + + // Next two are OK, but may befool error recovery + let _ = '/'; + let _ = b'/'; + + let _ = ' hello // here's a comment + //~^ ERROR: unterminated character literal +} diff --git a/src/test/ui/lexer/lex-bad-char-literals-7.stderr b/src/test/ui/lexer/lex-bad-char-literals-7.stderr new file mode 100644 index 00000000000..255b9c68999 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-char-literals-7.stderr @@ -0,0 +1,21 @@ +error: empty character literal + --> $DIR/lex-bad-char-literals-7.rs:2:20 + | +LL | let _: char = ''; + | ^ empty character literal + +error: empty unicode escape + --> $DIR/lex-bad-char-literals-7.rs:4:20 + | +LL | let _: char = '\u{}'; + | ^^^^ this escape must have at least 1 hex digit + +error[E0762]: unterminated character literal + --> $DIR/lex-bad-char-literals-7.rs:11:13 + | +LL | let _ = ' hello // here's a comment + | ^^^^^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0762`. diff --git a/src/test/ui/lexer/lex-bad-numeric-literals.rs b/src/test/ui/lexer/lex-bad-numeric-literals.rs new file mode 100644 index 00000000000..cf8440ca488 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-numeric-literals.rs @@ -0,0 +1,27 @@ +fn main() { + 0o1.0; //~ ERROR: octal float literal is not supported + 0o2f32; //~ ERROR: octal float literal is not supported + 0o3.0f32; //~ ERROR: octal float literal is not supported + 0o4e4; //~ ERROR: octal float literal is not supported + 0o5.0e5; //~ ERROR: octal float literal is not supported + 0o6e6f32; //~ ERROR: octal float literal is not supported + 0o7.0e7f64; //~ ERROR: octal float literal is not supported + 0x8.0e+9; //~ ERROR: hexadecimal float literal is not supported + 0x9.0e-9; //~ ERROR: hexadecimal float literal is not supported + 0o; //~ ERROR: no valid digits + 1e+; //~ ERROR: expected at least one digit in exponent + 0x539.0; //~ ERROR: hexadecimal float literal is not supported + 9900000000000000000000000000999999999999999999999999999999; + //~^ ERROR: integer literal is too large + 9900000000000000000000000000999999999999999999999999999999; + //~^ ERROR: integer literal is too large + 0x; //~ ERROR: no valid digits + 0xu32; //~ ERROR: no valid digits + 0ou32; //~ ERROR: no valid digits + 0bu32; //~ ERROR: no valid digits + 0b; //~ ERROR: no valid digits + 0o123f64; //~ ERROR: octal float literal is not supported + 0o123.456; //~ ERROR: octal float literal is not supported + 0b101f64; //~ ERROR: binary float literal is not supported + 0b111.101; //~ ERROR: binary float literal is not supported +} diff --git a/src/test/ui/lexer/lex-bad-numeric-literals.stderr b/src/test/ui/lexer/lex-bad-numeric-literals.stderr new file mode 100644 index 00000000000..f05d6160302 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-numeric-literals.stderr @@ -0,0 +1,141 @@ +error: octal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:2:5 + | +LL | 0o1.0; + | ^^^^^ + +error: octal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:4:5 + | +LL | 0o3.0f32; + | ^^^^^ + +error: octal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:5:5 + | +LL | 0o4e4; + | ^^^^^ + +error: octal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:6:5 + | +LL | 0o5.0e5; + | ^^^^^^^ + +error: octal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:7:5 + | +LL | 0o6e6f32; + | ^^^^^ + +error: octal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:8:5 + | +LL | 0o7.0e7f64; + | ^^^^^^^ + +error: hexadecimal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:9:5 + | +LL | 0x8.0e+9; + | ^^^^^^^^ + +error: hexadecimal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:10:5 + | +LL | 0x9.0e-9; + | ^^^^^^^^ + +error[E0768]: no valid digits found for number + --> $DIR/lex-bad-numeric-literals.rs:11:5 + | +LL | 0o; + | ^^ + +error: expected at least one digit in exponent + --> $DIR/lex-bad-numeric-literals.rs:12:5 + | +LL | 1e+; + | ^^^ + +error: hexadecimal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:13:5 + | +LL | 0x539.0; + | ^^^^^^^ + +error[E0768]: no valid digits found for number + --> $DIR/lex-bad-numeric-literals.rs:18:5 + | +LL | 0x; + | ^^ + +error[E0768]: no valid digits found for number + --> $DIR/lex-bad-numeric-literals.rs:19:5 + | +LL | 0xu32; + | ^^ + +error[E0768]: no valid digits found for number + --> $DIR/lex-bad-numeric-literals.rs:20:5 + | +LL | 0ou32; + | ^^ + +error[E0768]: no valid digits found for number + --> $DIR/lex-bad-numeric-literals.rs:21:5 + | +LL | 0bu32; + | ^^ + +error[E0768]: no valid digits found for number + --> $DIR/lex-bad-numeric-literals.rs:22:5 + | +LL | 0b; + | ^^ + +error: octal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:24:5 + | +LL | 0o123.456; + | ^^^^^^^^^ + +error: binary float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:26:5 + | +LL | 0b111.101; + | ^^^^^^^^^ + +error: octal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:3:5 + | +LL | 0o2f32; + | ^^^^^^ not supported + +error: integer literal is too large + --> $DIR/lex-bad-numeric-literals.rs:14:5 + | +LL | 9900000000000000000000000000999999999999999999999999999999; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: integer literal is too large + --> $DIR/lex-bad-numeric-literals.rs:16:5 + | +LL | 9900000000000000000000000000999999999999999999999999999999; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: octal float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:23:5 + | +LL | 0o123f64; + | ^^^^^^^^ not supported + +error: binary float literal is not supported + --> $DIR/lex-bad-numeric-literals.rs:25:5 + | +LL | 0b101f64; + | ^^^^^^^^ not supported + +error: aborting due to 23 previous errors + +For more information about this error, try `rustc --explain E0768`. diff --git a/src/test/ui/lexer/lex-bad-octal-literal.rs b/src/test/ui/lexer/lex-bad-octal-literal.rs new file mode 100644 index 00000000000..49631f16bdb --- /dev/null +++ b/src/test/ui/lexer/lex-bad-octal-literal.rs @@ -0,0 +1,4 @@ +fn main() { + 0o18; //~ ERROR invalid digit for a base 8 literal + 0o1234_9_5670; //~ ERROR invalid digit for a base 8 literal +} diff --git a/src/test/ui/lexer/lex-bad-octal-literal.stderr b/src/test/ui/lexer/lex-bad-octal-literal.stderr new file mode 100644 index 00000000000..2cb8ca5ded0 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-octal-literal.stderr @@ -0,0 +1,14 @@ +error: invalid digit for a base 8 literal + --> $DIR/lex-bad-octal-literal.rs:2:8 + | +LL | 0o18; + | ^ + +error: invalid digit for a base 8 literal + --> $DIR/lex-bad-octal-literal.rs:3:12 + | +LL | 0o1234_9_5670; + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/lexer/lex-bad-token.rs b/src/test/ui/lexer/lex-bad-token.rs new file mode 100644 index 00000000000..9e482461112 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-token.rs @@ -0,0 +1,3 @@ +● //~ ERROR: unknown start of token + +fn main() {} diff --git a/src/test/ui/lexer/lex-bad-token.stderr b/src/test/ui/lexer/lex-bad-token.stderr new file mode 100644 index 00000000000..43c43721b19 --- /dev/null +++ b/src/test/ui/lexer/lex-bad-token.stderr @@ -0,0 +1,8 @@ +error: unknown start of token: \u{25cf} + --> $DIR/lex-bad-token.rs:1:1 + | +LL | ● + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/lexer/lex-bare-cr-nondoc-comment.rs b/src/test/ui/lexer/lex-bare-cr-nondoc-comment.rs new file mode 100644 index 00000000000..5b528d6e1e1 --- /dev/null +++ b/src/test/ui/lexer/lex-bare-cr-nondoc-comment.rs @@ -0,0 +1,9 @@ +// run-pass +// ignore-tidy-cr + +// nondoc comment with bare CR: ' ' +//// nondoc comment with bare CR: ' ' +/* block nondoc comment with bare CR: ' ' */ + +fn main() { +} diff --git a/src/test/ui/lexer/lex-bare-cr-string-literal-doc-comment.rs b/src/test/ui/lexer/lex-bare-cr-string-literal-doc-comment.rs new file mode 100644 index 00000000000..b7752e1f0c4 --- /dev/null +++ b/src/test/ui/lexer/lex-bare-cr-string-literal-doc-comment.rs @@ -0,0 +1,26 @@ +// ignore-tidy-cr + +/// doc comment with bare CR: ' ' +pub fn foo() {} +//~^^ ERROR: bare CR not allowed in doc-comment + +/** block doc comment with bare CR: ' ' */ +pub fn bar() {} +//~^^ ERROR: bare CR not allowed in block doc-comment + +fn main() { + //! doc comment with bare CR: ' ' + //~^ ERROR: bare CR not allowed in doc-comment + + /*! block doc comment with bare CR: ' ' */ + //~^ ERROR: bare CR not allowed in block doc-comment + + // the following string literal has a bare CR in it + let _s = "foo bar"; //~ ERROR: bare CR not allowed in string + + // the following string literal has a bare CR in it + let _s = r"bar foo"; //~ ERROR: bare CR not allowed in raw string + + // the following string literal has a bare CR in it + let _s = "foo\ bar"; //~ ERROR: unknown character escape: `\r` +} diff --git a/src/test/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr b/src/test/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr new file mode 100644 index 00000000000..1a21fed63bd --- /dev/null +++ b/src/test/ui/lexer/lex-bare-cr-string-literal-doc-comment.stderr @@ -0,0 +1,46 @@ +error: bare CR not allowed in doc-comment + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 + | +LL | /// doc comment with bare CR: ' ' + | ^ + +error: bare CR not allowed in block doc-comment + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:7:38 + | +LL | /** block doc comment with bare CR: ' ' */ + | ^ + +error: bare CR not allowed in doc-comment + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:12:36 + | +LL | //! doc comment with bare CR: ' ' + | ^ + +error: bare CR not allowed in block doc-comment + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:15:42 + | +LL | /*! block doc comment with bare CR: ' ' */ + | ^ + +error: bare CR not allowed in string, use `\r` instead + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:19:18 + | +LL | let _s = "foo bar"; + | ^ help: escape the character: `\r` + +error: bare CR not allowed in raw string + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:22:19 + | +LL | let _s = r"bar foo"; + | ^ + +error: unknown character escape: `\r` + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:25:19 + | +LL | let _s = "foo\ bar"; + | ^ unknown character escape + | + = help: this is an isolated carriage return; consider checking your editor and version control settings + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/lexer/lex-stray-backslash.rs b/src/test/ui/lexer/lex-stray-backslash.rs new file mode 100644 index 00000000000..bb27f44c279 --- /dev/null +++ b/src/test/ui/lexer/lex-stray-backslash.rs @@ -0,0 +1,3 @@ +\ //~ ERROR: unknown start of token: \ + +fn main() {} diff --git a/src/test/ui/lexer/lex-stray-backslash.stderr b/src/test/ui/lexer/lex-stray-backslash.stderr new file mode 100644 index 00000000000..06dc0f2b537 --- /dev/null +++ b/src/test/ui/lexer/lex-stray-backslash.stderr @@ -0,0 +1,8 @@ +error: unknown start of token: \ + --> $DIR/lex-stray-backslash.rs:1:1 + | +LL | \ + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs b/src/test/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs new file mode 100644 index 00000000000..802be7f5afb --- /dev/null +++ b/src/test/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs @@ -0,0 +1,38 @@ +// run-pass +// ignore-tidy-cr +// ignore-tidy-cr (repeated again because of tidy bug) +// license is ignored because tidy can't handle the CRLF here properly. + +// N.B., this file needs CRLF line endings. The .gitattributes file in +// this directory should enforce it. + +// ignore-pretty issue #37195 + +/// Doc comment that ends in CRLF +pub fn foo() {} + +/** Block doc comment that + * contains CRLF characters + */ +pub fn bar() {} + +fn main() { + let s = "string +literal"; + assert_eq!(s, "string\nliteral"); + + let s = "literal with \ + escaped newline"; + assert_eq!(s, "literal with escaped newline"); + + let s = r"string +literal"; + assert_eq!(s, "string\nliteral"); + let s = br"byte string +literal"; + assert_eq!(s, "byte string\nliteral".as_bytes()); + + // validate that our source file has CRLF endings + let source = include_str!("lexer-crlf-line-endings-string-literal-doc-comment.rs"); + assert!(source.contains("string\r\nliteral")); +} diff --git a/src/test/ui/parser/lex-bad-binary-literal.rs b/src/test/ui/parser/lex-bad-binary-literal.rs deleted file mode 100644 index 7df98073e35..00000000000 --- a/src/test/ui/parser/lex-bad-binary-literal.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn main() { - 0b121; //~ ERROR invalid digit for a base 2 literal - 0b10_10301; //~ ERROR invalid digit for a base 2 literal - 0b30; //~ ERROR invalid digit for a base 2 literal - 0b41; //~ ERROR invalid digit for a base 2 literal - 0b5; //~ ERROR invalid digit for a base 2 literal - 0b6; //~ ERROR invalid digit for a base 2 literal - 0b7; //~ ERROR invalid digit for a base 2 literal - 0b8; //~ ERROR invalid digit for a base 2 literal - 0b9; //~ ERROR invalid digit for a base 2 literal -} diff --git a/src/test/ui/parser/lex-bad-binary-literal.stderr b/src/test/ui/parser/lex-bad-binary-literal.stderr deleted file mode 100644 index 992b3d2487e..00000000000 --- a/src/test/ui/parser/lex-bad-binary-literal.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:2:8 - | -LL | 0b121; - | ^ - -error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:3:12 - | -LL | 0b10_10301; - | ^ - -error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:4:7 - | -LL | 0b30; - | ^ - -error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:5:7 - | -LL | 0b41; - | ^ - -error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:6:7 - | -LL | 0b5; - | ^ - -error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:7:7 - | -LL | 0b6; - | ^ - -error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:8:7 - | -LL | 0b7; - | ^ - -error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:9:7 - | -LL | 0b8; - | ^ - -error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:10:7 - | -LL | 0b9; - | ^ - -error: aborting due to 9 previous errors - diff --git a/src/test/ui/parser/lex-bad-char-literals-1.rs b/src/test/ui/parser/lex-bad-char-literals-1.rs deleted file mode 100644 index e7951cfd2d2..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-1.rs +++ /dev/null @@ -1,17 +0,0 @@ -static c3: char = - '\x1' //~ ERROR: numeric character escape is too short -; - -static s3: &'static str = - "\x1" //~ ERROR: numeric character escape is too short -; - -static c: char = - '\●' //~ ERROR: unknown character escape -; - -static s: &'static str = - "\●" //~ ERROR: unknown character escape -; - -fn main() {} diff --git a/src/test/ui/parser/lex-bad-char-literals-1.stderr b/src/test/ui/parser/lex-bad-char-literals-1.stderr deleted file mode 100644 index ed129a1d133..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-1.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error: numeric character escape is too short - --> $DIR/lex-bad-char-literals-1.rs:2:6 - | -LL | '\x1' - | ^^^ - -error: numeric character escape is too short - --> $DIR/lex-bad-char-literals-1.rs:6:6 - | -LL | "\x1" - | ^^^ - -error: unknown character escape: `\u{25cf}` - --> $DIR/lex-bad-char-literals-1.rs:10:7 - | -LL | '\●' - | ^ unknown character escape - | - = help: for more information, visit - -error: unknown character escape: `\u{25cf}` - --> $DIR/lex-bad-char-literals-1.rs:14:7 - | -LL | "\●" - | ^ unknown character escape - | - = help: for more information, visit - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/parser/lex-bad-char-literals-2.rs b/src/test/ui/parser/lex-bad-char-literals-2.rs deleted file mode 100644 index d35dafd9a34..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-2.rs +++ /dev/null @@ -1,6 +0,0 @@ -// This test needs to the last one appearing in this file as it kills the parser -static c: char = - 'nope' //~ ERROR: character literal may only contain one codepoint -; - -fn main() {} diff --git a/src/test/ui/parser/lex-bad-char-literals-2.stderr b/src/test/ui/parser/lex-bad-char-literals-2.stderr deleted file mode 100644 index c2b19a7ad5f..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-2.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-2.rs:3:5 - | -LL | 'nope' - | ^^^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | "nope" - | ~~~~~~ - -error: aborting due to previous error - diff --git a/src/test/ui/parser/lex-bad-char-literals-3.rs b/src/test/ui/parser/lex-bad-char-literals-3.rs deleted file mode 100644 index 5194ff4d935..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-3.rs +++ /dev/null @@ -1,7 +0,0 @@ -static c: char = '●●'; -//~^ ERROR: character literal may only contain one codepoint - -fn main() { - let ch: &str = '●●'; - //~^ ERROR: character literal may only contain one codepoint -} diff --git a/src/test/ui/parser/lex-bad-char-literals-3.stderr b/src/test/ui/parser/lex-bad-char-literals-3.stderr deleted file mode 100644 index 62a5e424cb4..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-3.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-3.rs:1:18 - | -LL | static c: char = '●●'; - | ^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | static c: char = "●●"; - | ~~~~ - -error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-3.rs:5:20 - | -LL | let ch: &str = '●●'; - | ^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | let ch: &str = "●●"; - | ~~~~ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/parser/lex-bad-char-literals-4.rs b/src/test/ui/parser/lex-bad-char-literals-4.rs deleted file mode 100644 index de0a19df993..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-4.rs +++ /dev/null @@ -1,5 +0,0 @@ -// -// This test needs to the last one appearing in this file as it kills the parser -static c: char = - '● //~ ERROR: unterminated character literal -; diff --git a/src/test/ui/parser/lex-bad-char-literals-4.stderr b/src/test/ui/parser/lex-bad-char-literals-4.stderr deleted file mode 100644 index fec4421c48a..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-4.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0762]: unterminated character literal - --> $DIR/lex-bad-char-literals-4.rs:4:5 - | -LL | '● - | ^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0762`. diff --git a/src/test/ui/parser/lex-bad-char-literals-5.rs b/src/test/ui/parser/lex-bad-char-literals-5.rs deleted file mode 100644 index 0c4339edc4f..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-5.rs +++ /dev/null @@ -1,7 +0,0 @@ -static c: char = '\x10\x10'; -//~^ ERROR: character literal may only contain one codepoint - -fn main() { - let ch: &str = '\x10\x10'; - //~^ ERROR: character literal may only contain one codepoint -} diff --git a/src/test/ui/parser/lex-bad-char-literals-5.stderr b/src/test/ui/parser/lex-bad-char-literals-5.stderr deleted file mode 100644 index 184817a6579..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-5.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-5.rs:1:18 - | -LL | static c: char = '\x10\x10'; - | ^^^^^^^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | static c: char = "\x10\x10"; - | ~~~~~~~~~~ - -error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-5.rs:5:20 - | -LL | let ch: &str = '\x10\x10'; - | ^^^^^^^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | let ch: &str = "\x10\x10"; - | ~~~~~~~~~~ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/parser/lex-bad-char-literals-6.rs b/src/test/ui/parser/lex-bad-char-literals-6.rs deleted file mode 100644 index 4379b4fa6d7..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-6.rs +++ /dev/null @@ -1,17 +0,0 @@ -fn main() { - let x: &str = 'ab'; - //~^ ERROR: character literal may only contain one codepoint - let y: char = 'cd'; - //~^ ERROR: character literal may only contain one codepoint - let z = 'ef'; - //~^ ERROR: character literal may only contain one codepoint - - if x == y {} - //~^ ERROR: can't compare `&str` with `char` - if y == z {} // no error here - if x == z {} - //~^ ERROR: can't compare `&str` with `char` - - let a: usize = ""; - //~^ ERROR: mismatched types -} diff --git a/src/test/ui/parser/lex-bad-char-literals-6.stderr b/src/test/ui/parser/lex-bad-char-literals-6.stderr deleted file mode 100644 index 4332bdefcb2..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-6.stderr +++ /dev/null @@ -1,61 +0,0 @@ -error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-6.rs:2:19 - | -LL | let x: &str = 'ab'; - | ^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | let x: &str = "ab"; - | ~~~~ - -error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-6.rs:4:19 - | -LL | let y: char = 'cd'; - | ^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | let y: char = "cd"; - | ~~~~ - -error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-6.rs:6:13 - | -LL | let z = 'ef'; - | ^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | let z = "ef"; - | ~~~~ - -error[E0277]: can't compare `&str` with `char` - --> $DIR/lex-bad-char-literals-6.rs:9:10 - | -LL | if x == y {} - | ^^ no implementation for `&str == char` - | - = help: the trait `PartialEq` is not implemented for `&str` - -error[E0308]: mismatched types - --> $DIR/lex-bad-char-literals-6.rs:15:20 - | -LL | let a: usize = ""; - | ----- ^^ expected `usize`, found `&str` - | | - | expected due to this - -error[E0277]: can't compare `&str` with `char` - --> $DIR/lex-bad-char-literals-6.rs:12:10 - | -LL | if x == z {} - | ^^ no implementation for `&str == char` - | - = help: the trait `PartialEq` is not implemented for `&str` - -error: aborting due to 6 previous errors - -Some errors have detailed explanations: E0277, E0308. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/parser/lex-bad-char-literals-7.rs b/src/test/ui/parser/lex-bad-char-literals-7.rs deleted file mode 100644 index c675df2f3cc..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-7.rs +++ /dev/null @@ -1,13 +0,0 @@ -fn main() { - let _: char = ''; - //~^ ERROR: empty character literal - let _: char = '\u{}'; - //~^ ERROR: empty unicode escape - - // Next two are OK, but may befool error recovery - let _ = '/'; - let _ = b'/'; - - let _ = ' hello // here's a comment - //~^ ERROR: unterminated character literal -} diff --git a/src/test/ui/parser/lex-bad-char-literals-7.stderr b/src/test/ui/parser/lex-bad-char-literals-7.stderr deleted file mode 100644 index 255b9c68999..00000000000 --- a/src/test/ui/parser/lex-bad-char-literals-7.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: empty character literal - --> $DIR/lex-bad-char-literals-7.rs:2:20 - | -LL | let _: char = ''; - | ^ empty character literal - -error: empty unicode escape - --> $DIR/lex-bad-char-literals-7.rs:4:20 - | -LL | let _: char = '\u{}'; - | ^^^^ this escape must have at least 1 hex digit - -error[E0762]: unterminated character literal - --> $DIR/lex-bad-char-literals-7.rs:11:13 - | -LL | let _ = ' hello // here's a comment - | ^^^^^^^^ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0762`. diff --git a/src/test/ui/parser/lex-bad-numeric-literals.rs b/src/test/ui/parser/lex-bad-numeric-literals.rs deleted file mode 100644 index cf8440ca488..00000000000 --- a/src/test/ui/parser/lex-bad-numeric-literals.rs +++ /dev/null @@ -1,27 +0,0 @@ -fn main() { - 0o1.0; //~ ERROR: octal float literal is not supported - 0o2f32; //~ ERROR: octal float literal is not supported - 0o3.0f32; //~ ERROR: octal float literal is not supported - 0o4e4; //~ ERROR: octal float literal is not supported - 0o5.0e5; //~ ERROR: octal float literal is not supported - 0o6e6f32; //~ ERROR: octal float literal is not supported - 0o7.0e7f64; //~ ERROR: octal float literal is not supported - 0x8.0e+9; //~ ERROR: hexadecimal float literal is not supported - 0x9.0e-9; //~ ERROR: hexadecimal float literal is not supported - 0o; //~ ERROR: no valid digits - 1e+; //~ ERROR: expected at least one digit in exponent - 0x539.0; //~ ERROR: hexadecimal float literal is not supported - 9900000000000000000000000000999999999999999999999999999999; - //~^ ERROR: integer literal is too large - 9900000000000000000000000000999999999999999999999999999999; - //~^ ERROR: integer literal is too large - 0x; //~ ERROR: no valid digits - 0xu32; //~ ERROR: no valid digits - 0ou32; //~ ERROR: no valid digits - 0bu32; //~ ERROR: no valid digits - 0b; //~ ERROR: no valid digits - 0o123f64; //~ ERROR: octal float literal is not supported - 0o123.456; //~ ERROR: octal float literal is not supported - 0b101f64; //~ ERROR: binary float literal is not supported - 0b111.101; //~ ERROR: binary float literal is not supported -} diff --git a/src/test/ui/parser/lex-bad-numeric-literals.stderr b/src/test/ui/parser/lex-bad-numeric-literals.stderr deleted file mode 100644 index f05d6160302..00000000000 --- a/src/test/ui/parser/lex-bad-numeric-literals.stderr +++ /dev/null @@ -1,141 +0,0 @@ -error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:2:5 - | -LL | 0o1.0; - | ^^^^^ - -error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:4:5 - | -LL | 0o3.0f32; - | ^^^^^ - -error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:5:5 - | -LL | 0o4e4; - | ^^^^^ - -error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:6:5 - | -LL | 0o5.0e5; - | ^^^^^^^ - -error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:7:5 - | -LL | 0o6e6f32; - | ^^^^^ - -error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:8:5 - | -LL | 0o7.0e7f64; - | ^^^^^^^ - -error: hexadecimal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:9:5 - | -LL | 0x8.0e+9; - | ^^^^^^^^ - -error: hexadecimal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:10:5 - | -LL | 0x9.0e-9; - | ^^^^^^^^ - -error[E0768]: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:11:5 - | -LL | 0o; - | ^^ - -error: expected at least one digit in exponent - --> $DIR/lex-bad-numeric-literals.rs:12:5 - | -LL | 1e+; - | ^^^ - -error: hexadecimal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:13:5 - | -LL | 0x539.0; - | ^^^^^^^ - -error[E0768]: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:18:5 - | -LL | 0x; - | ^^ - -error[E0768]: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:19:5 - | -LL | 0xu32; - | ^^ - -error[E0768]: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:20:5 - | -LL | 0ou32; - | ^^ - -error[E0768]: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:21:5 - | -LL | 0bu32; - | ^^ - -error[E0768]: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:22:5 - | -LL | 0b; - | ^^ - -error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:24:5 - | -LL | 0o123.456; - | ^^^^^^^^^ - -error: binary float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:26:5 - | -LL | 0b111.101; - | ^^^^^^^^^ - -error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:3:5 - | -LL | 0o2f32; - | ^^^^^^ not supported - -error: integer literal is too large - --> $DIR/lex-bad-numeric-literals.rs:14:5 - | -LL | 9900000000000000000000000000999999999999999999999999999999; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: integer literal is too large - --> $DIR/lex-bad-numeric-literals.rs:16:5 - | -LL | 9900000000000000000000000000999999999999999999999999999999; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:23:5 - | -LL | 0o123f64; - | ^^^^^^^^ not supported - -error: binary float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:25:5 - | -LL | 0b101f64; - | ^^^^^^^^ not supported - -error: aborting due to 23 previous errors - -For more information about this error, try `rustc --explain E0768`. diff --git a/src/test/ui/parser/lex-bad-octal-literal.rs b/src/test/ui/parser/lex-bad-octal-literal.rs deleted file mode 100644 index 49631f16bdb..00000000000 --- a/src/test/ui/parser/lex-bad-octal-literal.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - 0o18; //~ ERROR invalid digit for a base 8 literal - 0o1234_9_5670; //~ ERROR invalid digit for a base 8 literal -} diff --git a/src/test/ui/parser/lex-bad-octal-literal.stderr b/src/test/ui/parser/lex-bad-octal-literal.stderr deleted file mode 100644 index 2cb8ca5ded0..00000000000 --- a/src/test/ui/parser/lex-bad-octal-literal.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: invalid digit for a base 8 literal - --> $DIR/lex-bad-octal-literal.rs:2:8 - | -LL | 0o18; - | ^ - -error: invalid digit for a base 8 literal - --> $DIR/lex-bad-octal-literal.rs:3:12 - | -LL | 0o1234_9_5670; - | ^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/parser/lex-bad-token.rs b/src/test/ui/parser/lex-bad-token.rs deleted file mode 100644 index 9e482461112..00000000000 --- a/src/test/ui/parser/lex-bad-token.rs +++ /dev/null @@ -1,3 +0,0 @@ -● //~ ERROR: unknown start of token - -fn main() {} diff --git a/src/test/ui/parser/lex-bad-token.stderr b/src/test/ui/parser/lex-bad-token.stderr deleted file mode 100644 index 43c43721b19..00000000000 --- a/src/test/ui/parser/lex-bad-token.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: unknown start of token: \u{25cf} - --> $DIR/lex-bad-token.rs:1:1 - | -LL | ● - | ^ - -error: aborting due to previous error - diff --git a/src/test/ui/parser/lex-bare-cr-nondoc-comment.rs b/src/test/ui/parser/lex-bare-cr-nondoc-comment.rs deleted file mode 100644 index 5b528d6e1e1..00000000000 --- a/src/test/ui/parser/lex-bare-cr-nondoc-comment.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -// ignore-tidy-cr - -// nondoc comment with bare CR: ' ' -//// nondoc comment with bare CR: ' ' -/* block nondoc comment with bare CR: ' ' */ - -fn main() { -} diff --git a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.rs b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.rs deleted file mode 100644 index b7752e1f0c4..00000000000 --- a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.rs +++ /dev/null @@ -1,26 +0,0 @@ -// ignore-tidy-cr - -/// doc comment with bare CR: ' ' -pub fn foo() {} -//~^^ ERROR: bare CR not allowed in doc-comment - -/** block doc comment with bare CR: ' ' */ -pub fn bar() {} -//~^^ ERROR: bare CR not allowed in block doc-comment - -fn main() { - //! doc comment with bare CR: ' ' - //~^ ERROR: bare CR not allowed in doc-comment - - /*! block doc comment with bare CR: ' ' */ - //~^ ERROR: bare CR not allowed in block doc-comment - - // the following string literal has a bare CR in it - let _s = "foo bar"; //~ ERROR: bare CR not allowed in string - - // the following string literal has a bare CR in it - let _s = r"bar foo"; //~ ERROR: bare CR not allowed in raw string - - // the following string literal has a bare CR in it - let _s = "foo\ bar"; //~ ERROR: unknown character escape: `\r` -} diff --git a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr deleted file mode 100644 index 1a21fed63bd..00000000000 --- a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr +++ /dev/null @@ -1,46 +0,0 @@ -error: bare CR not allowed in doc-comment - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 - | -LL | /// doc comment with bare CR: ' ' - | ^ - -error: bare CR not allowed in block doc-comment - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:7:38 - | -LL | /** block doc comment with bare CR: ' ' */ - | ^ - -error: bare CR not allowed in doc-comment - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:12:36 - | -LL | //! doc comment with bare CR: ' ' - | ^ - -error: bare CR not allowed in block doc-comment - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:15:42 - | -LL | /*! block doc comment with bare CR: ' ' */ - | ^ - -error: bare CR not allowed in string, use `\r` instead - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:19:18 - | -LL | let _s = "foo bar"; - | ^ help: escape the character: `\r` - -error: bare CR not allowed in raw string - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:22:19 - | -LL | let _s = r"bar foo"; - | ^ - -error: unknown character escape: `\r` - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:25:19 - | -LL | let _s = "foo\ bar"; - | ^ unknown character escape - | - = help: this is an isolated carriage return; consider checking your editor and version control settings - -error: aborting due to 7 previous errors - diff --git a/src/test/ui/parser/lex-stray-backslash.rs b/src/test/ui/parser/lex-stray-backslash.rs deleted file mode 100644 index bb27f44c279..00000000000 --- a/src/test/ui/parser/lex-stray-backslash.rs +++ /dev/null @@ -1,3 +0,0 @@ -\ //~ ERROR: unknown start of token: \ - -fn main() {} diff --git a/src/test/ui/parser/lex-stray-backslash.stderr b/src/test/ui/parser/lex-stray-backslash.stderr deleted file mode 100644 index 06dc0f2b537..00000000000 --- a/src/test/ui/parser/lex-stray-backslash.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: unknown start of token: \ - --> $DIR/lex-stray-backslash.rs:1:1 - | -LL | \ - | ^ - -error: aborting due to previous error - diff --git a/src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs b/src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs deleted file mode 100644 index 802be7f5afb..00000000000 --- a/src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs +++ /dev/null @@ -1,38 +0,0 @@ -// run-pass -// ignore-tidy-cr -// ignore-tidy-cr (repeated again because of tidy bug) -// license is ignored because tidy can't handle the CRLF here properly. - -// N.B., this file needs CRLF line endings. The .gitattributes file in -// this directory should enforce it. - -// ignore-pretty issue #37195 - -/// Doc comment that ends in CRLF -pub fn foo() {} - -/** Block doc comment that - * contains CRLF characters - */ -pub fn bar() {} - -fn main() { - let s = "string -literal"; - assert_eq!(s, "string\nliteral"); - - let s = "literal with \ - escaped newline"; - assert_eq!(s, "literal with escaped newline"); - - let s = r"string -literal"; - assert_eq!(s, "string\nliteral"); - let s = br"byte string -literal"; - assert_eq!(s, "byte string\nliteral".as_bytes()); - - // validate that our source file has CRLF endings - let source = include_str!("lexer-crlf-line-endings-string-literal-doc-comment.rs"); - assert!(source.contains("string\r\nliteral")); -} diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 7fae9bf0f69..203e33e8b1f 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -7,9 +7,8 @@ use std::path::Path; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. -const ROOT_ENTRY_LIMIT: usize = 983; +const ROOT_ENTRY_LIMIT: usize = 982; const ISSUES_ENTRY_LIMIT: usize = 2310; -const PARSER_LIMIT: usize = 1012; fn check_entries(path: &Path, bad: &mut bool) { let dirs = walkdir::WalkDir::new(&path.join("test/ui")) @@ -22,13 +21,10 @@ fn check_entries(path: &Path, bad: &mut bool) { // Use special values for these dirs. let is_root = path.join("test/ui") == dir_path; let is_issues_dir = path.join("test/ui/issues") == dir_path; - let is_parser = path.join("test/ui/parser") == dir_path; let limit = if is_root { ROOT_ENTRY_LIMIT } else if is_issues_dir { ISSUES_ENTRY_LIMIT - } else if is_parser { - PARSER_LIMIT } else { ENTRY_LIMIT }; -- cgit 1.4.1-3-g733a5