]> git.lizzy.rs Git - rust.git/commitdiff
Fix tests
authorYuki Okushi <huyuumi.dev@gmail.com>
Thu, 17 Jan 2019 20:24:17 +0000 (05:24 +0900)
committerYuki Okushi <huyuumi.dev@gmail.com>
Thu, 17 Jan 2019 20:24:17 +0000 (05:24 +0900)
src/test/ui/parser/lex-bad-char-literals-3.rs
src/test/ui/parser/lex-bad-char-literals-3.stderr
src/test/ui/parser/lex-bad-char-literals-5.rs
src/test/ui/parser/lex-bad-char-literals-5.stderr
src/test/ui/str/str-as-char.fixed
src/test/ui/str/str-as-char.rs
src/test/ui/str/str-as-char.stderr

index d14ec1cc51560b6b01e26f1ad0648a04e9efd0bf..10a8cd4a53eabc97232cbe4d77b51fc576d32b7c 100644 (file)
@@ -3,4 +3,7 @@
     '●●' //~ ERROR: character literal may only contain one codepoint
 ;
 
-fn main() {}
+fn main() {
+    let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
+    //~^ ERROR: mismatched types
+}
index dde4a7db3aa792b6a4d7896192d60be4c1f7a591..9b4e69870cae88eaaff8b5813dfd7726e9c404b5 100644 (file)
@@ -8,5 +8,25 @@ help: if you meant to write a `str` literal, use double quotes
 LL |     "●●" //~ ERROR: character literal may only contain one codepoint
    |     ^^^^
 
-error: aborting due to previous error
+error: character literal may only contain one codepoint
+  --> $DIR/lex-bad-char-literals-3.rs:7:20
+   |
+LL |     let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
+   |                    ^^^^
+help: if you meant to write a `str` literal, use double quotes
+   |
+LL |     let ch: &str = "●●"; //~ ERROR: character literal may only contain one codepoint
+   |                    ^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/lex-bad-char-literals-3.rs:7:20
+   |
+LL |     let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
+   |                    ^^^^ expected &str, found char
+   |
+   = note: expected type `&str`
+              found type `char`
+
+error: aborting due to 3 previous errors
 
+For more information about this error, try `rustc --explain E0308`.
index 1236e76de420e12e35a6f88dd8f552795aca72d8..964099c3fa98df853039b2439066651069482b38 100644 (file)
@@ -4,4 +4,7 @@
     '\x10\x10'  //~ ERROR: character literal may only contain one codepoint
 ;
 
-fn main() {}
+fn main() {
+    let ch: &str = '\x10\x10'; //~ ERROR: character literal may only contain one codepoint
+    //~^ ERROR: mismatched types
+}
index 4f734eaeff353124db98bbd44dfa67c60169b833..177d8c599a89496bbcbe0b175fb814503d9add27 100644 (file)
@@ -8,5 +8,25 @@ help: if you meant to write a `str` literal, use double quotes
 LL |     "/x10/x10"  //~ ERROR: character literal may only contain one codepoint
    |     ^^^^^^^^^^
 
-error: aborting due to previous error
+error: character literal may only contain one codepoint
+  --> $DIR/lex-bad-char-literals-5.rs:8:20
+   |
+LL |     let ch: &str = '/x10/x10'; //~ ERROR: character literal may only contain one codepoint
+   |                    ^^^^^^^^^^
+help: if you meant to write a `str` literal, use double quotes
+   |
+LL |     let ch: &str = "/x10/x10"; //~ ERROR: character literal may only contain one codepoint
+   |                    ^^^^^^^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/lex-bad-char-literals-5.rs:8:20
+   |
+LL |     let ch: &str = '/x10/x10'; //~ ERROR: character literal may only contain one codepoint
+   |                    ^^^^^^^^^^ expected &str, found char
+   |
+   = note: expected type `&str`
+              found type `char`
+
+error: aborting due to 3 previous errors
 
+For more information about this error, try `rustc --explain E0308`.
index 9d4297b55c81643537d88de6b7fd110343244c0e..accead5c850cca8906988432f19a83c12ceebd2e 100644 (file)
@@ -1,6 +1,6 @@
 // run-rustfix
 
 fn main() {
-    println!("●●");
-    //~^ ERROR character literal may only contain one codepoint
+    println!("{}", "●●"); //~ ERROR character literal may only contain one codepoint
+    //~^ ERROR format argument must be a string literal
 }
index 710fa74a32a1cc46ea9e5bdb6369021025ccd962..fb179ec7245d2db4e48909399b9141c83eb61dca 100644 (file)
@@ -1,6 +1,6 @@
 // run-rustfix
 
 fn main() {
-    println!('●●');
-    //~^ ERROR character literal may only contain one codepoint
+    println!('●●'); //~ ERROR character literal may only contain one codepoint
+    //~^ ERROR format argument must be a string literal
 }
index 540a1b55376ff393a8f298775d433ba393a23ca8..4ca430a4cde9b0ddc15b6f4883e6692875a29f49 100644 (file)
@@ -1,12 +1,22 @@
 error: character literal may only contain one codepoint
   --> $DIR/str-as-char.rs:4:14
    |
-LL |     println!('●●');
+LL |     println!('●●'); //~ ERROR character literal may only contain one codepoint
    |              ^^^^
 help: if you meant to write a `str` literal, use double quotes
    |
-LL |     println!("●●");
+LL |     println!("●●"); //~ ERROR character literal may only contain one codepoint
    |              ^^^^
 
-error: aborting due to previous error
+error: format argument must be a string literal
+  --> $DIR/str-as-char.rs:4:14
+   |
+LL |     println!('●●'); //~ ERROR character literal may only contain one codepoint
+   |              ^^^^
+help: you might be missing a string literal to format with
+   |
+LL |     println!("{}", '●●'); //~ ERROR character literal may only contain one codepoint
+   |              ^^^^^
+
+error: aborting due to 2 previous errors