diff options
Diffstat (limited to 'src/test/ui/json')
-rw-r--r-- | src/test/ui/json/json-and-color.rs | 3 | ||||
-rw-r--r-- | src/test/ui/json/json-and-color.stderr | 2 | ||||
-rw-r--r-- | src/test/ui/json/json-and-error-format.rs | 3 | ||||
-rw-r--r-- | src/test/ui/json/json-and-error-format.stderr | 2 | ||||
-rw-r--r-- | src/test/ui/json/json-bom-plus-crlf-multifile-aux.rs | 27 | ||||
-rw-r--r-- | src/test/ui/json/json-bom-plus-crlf-multifile.rs | 11 | ||||
-rw-r--r-- | src/test/ui/json/json-bom-plus-crlf-multifile.stderr | 114 | ||||
-rw-r--r-- | src/test/ui/json/json-bom-plus-crlf.rs | 26 | ||||
-rw-r--r-- | src/test/ui/json/json-bom-plus-crlf.stderr | 114 | ||||
-rw-r--r-- | src/test/ui/json/json-invalid.rs | 3 | ||||
-rw-r--r-- | src/test/ui/json/json-invalid.stderr | 2 | ||||
-rw-r--r-- | src/test/ui/json/json-multiple.polonius.stderr | 1 | ||||
-rw-r--r-- | src/test/ui/json/json-multiple.rs | 5 | ||||
-rw-r--r-- | src/test/ui/json/json-multiple.stderr | 1 | ||||
-rw-r--r-- | src/test/ui/json/json-options.polonius.stderr | 1 | ||||
-rw-r--r-- | src/test/ui/json/json-options.rs | 5 | ||||
-rw-r--r-- | src/test/ui/json/json-options.stderr | 1 | ||||
-rw-r--r-- | src/test/ui/json/json-short.rs | 1 | ||||
-rw-r--r-- | src/test/ui/json/json-short.stderr | 19 |
19 files changed, 341 insertions, 0 deletions
diff --git a/src/test/ui/json/json-and-color.rs b/src/test/ui/json/json-and-color.rs new file mode 100644 index 000000000..6f8326fe2 --- /dev/null +++ b/src/test/ui/json/json-and-color.rs @@ -0,0 +1,3 @@ +// compile-flags: --json=artifacts --error-format=json --color never + +fn main() {} diff --git a/src/test/ui/json/json-and-color.stderr b/src/test/ui/json/json-and-color.stderr new file mode 100644 index 000000000..1cda6af09 --- /dev/null +++ b/src/test/ui/json/json-and-color.stderr @@ -0,0 +1,2 @@ +error: cannot specify the `--color` option with `--json` + diff --git a/src/test/ui/json/json-and-error-format.rs b/src/test/ui/json/json-and-error-format.rs new file mode 100644 index 000000000..6e2d73c76 --- /dev/null +++ b/src/test/ui/json/json-and-error-format.rs @@ -0,0 +1,3 @@ +// compile-flags: --json=artifacts --error-format=short + +fn main() {} diff --git a/src/test/ui/json/json-and-error-format.stderr b/src/test/ui/json/json-and-error-format.stderr new file mode 100644 index 000000000..80e022137 --- /dev/null +++ b/src/test/ui/json/json-and-error-format.stderr @@ -0,0 +1,2 @@ +error: using `--json` requires also using `--error-format=json` + diff --git a/src/test/ui/json/json-bom-plus-crlf-multifile-aux.rs b/src/test/ui/json/json-bom-plus-crlf-multifile-aux.rs new file mode 100644 index 000000000..991ea1d85 --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf-multifile-aux.rs @@ -0,0 +1,27 @@ +// (This line has BOM so it's ignored by compiletest for directives)
+//
+// ignore-test Not a test. Used by other tests
+// ignore-tidy-cr
+
+// For easier verifying, the byte offsets in this file should match those
+// in the json-bom-plus-crlf.rs - given the actual fn is identical (just with
+// a different, but equally sized name), the easiest way to do this is to
+// ensure the two files are of equal size on disk.
+// Padding............................
+
+// N.B., this file needs CRLF line endings. The .gitattributes file in
+// this directory should enforce it.
+
+pub fn test() {
+
+ let s : String = 1; // Error in the middle of line.
+
+ let s : String = 1
+ ; // Error before the newline.
+
+ let s : String =
+1; // Error after the newline.
+
+ let s : String = (
+ ); // Error spanning the newline.
+}
diff --git a/src/test/ui/json/json-bom-plus-crlf-multifile.rs b/src/test/ui/json/json-bom-plus-crlf-multifile.rs new file mode 100644 index 000000000..9290e0104 --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf-multifile.rs @@ -0,0 +1,11 @@ +// (This line has BOM so it's ignored by compiletest for directives)
+//
+// compile-flags: --json=diagnostic-short --error-format=json
+// ignore-tidy-cr
+
+#[path = "json-bom-plus-crlf-multifile-aux.rs"]
+mod json_bom_plus_crlf_multifile_aux;
+
+fn main() {
+ json_bom_plus_crlf_multifile_aux::test();
+}
diff --git a/src/test/ui/json/json-bom-plus-crlf-multifile.stderr b/src/test/ui/json/json-bom-plus-crlf-multifile.stderr new file mode 100644 index 000000000..02f3bc687 --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf-multifile.stderr @@ -0,0 +1,114 @@ +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +This error occurs when an expression was used in a place where the compiler +expected an expression of a different type. It can occur in several cases, the +most common being when calling a function and passing an argument which has a +different type than the matching type in the function declaration. +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":612,"byte_end":618,"line_start":17,"line_end":17,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":622,"byte_end":622,"line_start":17,"line_end":17,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:17:22: error[E0308]: mismatched types +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +This error occurs when an expression was used in a place where the compiler +expected an expression of a different type. It can occur in several cases, the +most common being when calling a function and passing an argument which has a +different type than the matching type in the function declaration. +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":672,"byte_end":678,"line_start":19,"line_end":19,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":682,"byte_end":682,"line_start":19,"line_end":19,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:19:22: error[E0308]: mismatched types +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +This error occurs when an expression was used in a place where the compiler +expected an expression of a different type. It can occur in several cases, the +most common being when calling a function and passing an argument which has a +different type than the matching type in the function declaration. +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":735,"byte_end":741,"line_start":22,"line_end":22,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":746,"byte_end":746,"line_start":23,"line_end":23,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:23:1: error[E0308]: mismatched types +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +This error occurs when an expression was used in a place where the compiler +expected an expression of a different type. It can occur in several cases, the +most common being when calling a function and passing an argument which has a +different type than the matching type in the function declaration. +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":792,"byte_end":798,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:25:22: error[E0308]: mismatched types +"} +{"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors +"} diff --git a/src/test/ui/json/json-bom-plus-crlf.rs b/src/test/ui/json/json-bom-plus-crlf.rs new file mode 100644 index 000000000..be5b7dd2a --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf.rs @@ -0,0 +1,26 @@ +// (This line has BOM so it's ignored by compiletest for directives)
+//
+// compile-flags: --json=diagnostic-short --error-format=json
+// ignore-tidy-cr
+
+// For easier verifying, the byte offsets in this file should match those
+// in the json_bom_plus_crlf_multifile_aux.rs - given the actual fn is
+// identical (just with a different, but equally sized name), the easiest way
+// to do this is to ensure the two files are of equal size on disk.
+
+// N.B., this file needs CRLF line endings. The .gitattributes file in
+// this directory should enforce it.
+
+fn main() {
+
+ let s : String = 1; // Error in the middle of line.
+
+ let s : String = 1
+ ; // Error before the newline.
+
+ let s : String =
+1; // Error after the newline.
+
+ let s : String = (
+ ); // Error spanning the newline.
+}
diff --git a/src/test/ui/json/json-bom-plus-crlf.stderr b/src/test/ui/json/json-bom-plus-crlf.stderr new file mode 100644 index 000000000..df6bd7286 --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf.stderr @@ -0,0 +1,114 @@ +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +This error occurs when an expression was used in a place where the compiler +expected an expression of a different type. It can occur in several cases, the +most common being when calling a function and passing an argument which has a +different type than the matching type in the function declaration. +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":597,"byte_end":603,"line_start":16,"line_end":16,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":607,"byte_end":607,"line_start":16,"line_end":16,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:16:22: error[E0308]: mismatched types +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +This error occurs when an expression was used in a place where the compiler +expected an expression of a different type. It can occur in several cases, the +most common being when calling a function and passing an argument which has a +different type than the matching type in the function declaration. +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":666,"byte_end":667,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":657,"byte_end":663,"line_start":18,"line_end":18,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":667,"byte_end":667,"line_start":18,"line_end":18,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:18:22: error[E0308]: mismatched types +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +This error occurs when an expression was used in a place where the compiler +expected an expression of a different type. It can occur in several cases, the +most common being when calling a function and passing an argument which has a +different type than the matching type in the function declaration. +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":730,"byte_end":731,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":720,"byte_end":726,"line_start":21,"line_end":21,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":731,"byte_end":731,"line_start":22,"line_end":22,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:22:1: error[E0308]: mismatched types +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +This error occurs when an expression was used in a place where the compiler +expected an expression of a different type. It can occur in several cases, the +most common being when calling a function and passing an argument which has a +different type than the matching type in the function declaration. +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":786,"byte_end":794,"line_start":24,"line_end":25,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":777,"byte_end":783,"line_start":24,"line_end":24,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:24:22: error[E0308]: mismatched types +"} +{"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors +"} diff --git a/src/test/ui/json/json-invalid.rs b/src/test/ui/json/json-invalid.rs new file mode 100644 index 000000000..54d0dd184 --- /dev/null +++ b/src/test/ui/json/json-invalid.rs @@ -0,0 +1,3 @@ +// compile-flags: --json=foo --error-format=json + +fn main() {} diff --git a/src/test/ui/json/json-invalid.stderr b/src/test/ui/json/json-invalid.stderr new file mode 100644 index 000000000..18bc76ab7 --- /dev/null +++ b/src/test/ui/json/json-invalid.stderr @@ -0,0 +1,2 @@ +error: unknown `--json` option `foo` + diff --git a/src/test/ui/json/json-multiple.polonius.stderr b/src/test/ui/json/json-multiple.polonius.stderr new file mode 100644 index 000000000..0e4d442f2 --- /dev/null +++ b/src/test/ui/json/json-multiple.polonius.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/json-multiple.polonius/libjson_multiple.rlib","emit":"link"} diff --git a/src/test/ui/json/json-multiple.rs b/src/test/ui/json/json-multiple.rs new file mode 100644 index 000000000..fb126339d --- /dev/null +++ b/src/test/ui/json/json-multiple.rs @@ -0,0 +1,5 @@ +// build-pass +// ignore-pass (different metadata emitted in different modes) +// compile-flags: --json=diagnostic-short --json artifacts --error-format=json + +#![crate_type = "lib"] diff --git a/src/test/ui/json/json-multiple.stderr b/src/test/ui/json/json-multiple.stderr new file mode 100644 index 000000000..55ccfd5fa --- /dev/null +++ b/src/test/ui/json/json-multiple.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/json/json-multiple/libjson_multiple.rlib","emit":"link"} diff --git a/src/test/ui/json/json-options.polonius.stderr b/src/test/ui/json/json-options.polonius.stderr new file mode 100644 index 000000000..e21f6f85d --- /dev/null +++ b/src/test/ui/json/json-options.polonius.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/json-options.polonius/libjson_options.rlib","emit":"link"} diff --git a/src/test/ui/json/json-options.rs b/src/test/ui/json/json-options.rs new file mode 100644 index 000000000..8b6ba131e --- /dev/null +++ b/src/test/ui/json/json-options.rs @@ -0,0 +1,5 @@ +// build-pass +// ignore-pass (different metadata emitted in different modes) +// compile-flags: --json=diagnostic-short,artifacts --error-format=json + +#![crate_type = "lib"] diff --git a/src/test/ui/json/json-options.stderr b/src/test/ui/json/json-options.stderr new file mode 100644 index 000000000..645a26f5a --- /dev/null +++ b/src/test/ui/json/json-options.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/json/json-options/libjson_options.rlib","emit":"link"} diff --git a/src/test/ui/json/json-short.rs b/src/test/ui/json/json-short.rs new file mode 100644 index 000000000..7414a5586 --- /dev/null +++ b/src/test/ui/json/json-short.rs @@ -0,0 +1 @@ +// compile-flags: --json=diagnostic-short --error-format=json diff --git a/src/test/ui/json/json-short.stderr b/src/test/ui/json/json-short.stderr new file mode 100644 index 000000000..3bd85b083 --- /dev/null +++ b/src/test/ui/json/json-short.stderr @@ -0,0 +1,19 @@ +{"message":"`main` function not found in crate `json_short`","code":{"code":"E0601","explanation":"No `main` function was found in a binary crate. + +To fix this error, add a `main` function: + +``` +fn main() { + // Your program will start here. + println!(\"Hello world!\"); +} +``` + +If you don't know the basics of Rust, you can look at the +[Rust Book][rust-book] to get started. + +[rust-book]: https://doc.rust-lang.org/book/ +"},"level":"error","spans":[{"file_name":"$DIR/json-short.rs","byte_start":62,"byte_end":62,"line_start":1,"line_end":1,"column_start":63,"column_end":63,"is_primary":true,"text":[{"text":"// compile-flags: --json=diagnostic-short --error-format=json","highlight_start":63,"highlight_end":63}],"label":"consider adding a `main` function to `$DIR/json-short.rs`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-short.rs:1:63: error[E0601]: `main` function not found in crate `json_short` +"} +{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error +"} |