Skip to content

Commit

Permalink
Update UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Oct 22, 2022
1 parent ed40d46 commit 8762485
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/test/ui/inference/char-as-str-single.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
fn main() {
let _: char = 'a'; //~ ERROR mismatched types
let _: char = '人'; //~ ERROR mismatched types
let _: char = '\''; //~ ERROR mismatched types
}
1 change: 1 addition & 0 deletions src/test/ui/inference/char-as-str-single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
fn main() {
let _: char = "a"; //~ ERROR mismatched types
let _: char = "人"; //~ ERROR mismatched types
let _: char = "'"; //~ ERROR mismatched types
}
15 changes: 14 additions & 1 deletion src/test/ui/inference/char-as-str-single.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ help: if you meant to write a `char` literal, use single quotes
LL | let _: char = '人';
| ~~~~

error: aborting due to 2 previous errors
error[E0308]: mismatched types
--> $DIR/char-as-str-single.rs:11:19
|
LL | let _: char = "'";
| ---- ^^^ expected `char`, found `&str`
| |
| expected due to this
|
help: if you meant to write a `char` literal, use single quotes
|
LL | let _: char = '\'';
| ~~~~

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
4 changes: 3 additions & 1 deletion src/test/ui/inference/str-as-char.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
// run-rustfix

fn main() {
let _: &str = "a"; //~ ERROR mismatched types
let _: &str = "a"; //~ ERROR mismatched types
let _: &str = "\"\"\""; //~ ERROR character literal may only contain one codepoint
let _: &str = "\"\"\""; //~ ERROR character literal may only contain one codepoint
}
4 changes: 3 additions & 1 deletion src/test/ui/inference/str-as-char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
// run-rustfix

fn main() {
let _: &str = 'a'; //~ ERROR mismatched types
let _: &str = 'a'; //~ ERROR mismatched types
let _: &str = '"""'; //~ ERROR character literal may only contain one codepoint
let _: &str = '\"\"\"'; //~ ERROR character literal may only contain one codepoint
}
24 changes: 23 additions & 1 deletion src/test/ui/inference/str-as-char.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
error: character literal may only contain one codepoint
--> $DIR/str-as-char.rs:8:19
|
LL | let _: &str = '"""';
| ^^^^^
|
help: if you meant to write a `str` literal, use double quotes
|
LL | let _: &str = "\"\"\"";
| ~~~~~~~~

error: character literal may only contain one codepoint
--> $DIR/str-as-char.rs:9:19
|
LL | let _: &str = '\"\"\"';
| ^^^^^^^^
|
help: if you meant to write a `str` literal, use double quotes
|
LL | let _: &str = "\"\"\"";
| ~~~~~~~~

error[E0308]: mismatched types
--> $DIR/str-as-char.rs:7:19
|
Expand All @@ -11,6 +33,6 @@ help: if you meant to write a `str` literal, use double quotes
LL | let _: &str = "a";
| ~~~

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

For more information about this error, try `rustc --explain E0308`.

0 comments on commit 8762485

Please sign in to comment.