Skip to content

Commit 1980655

Browse files
committed
Add test for future-incompat diagnostics with json output
1 parent 537b5b3 commit 1980655

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// compile-flags: -Zfuture-incompat-test --json=future-incompat --error-format=json
2+
// check-pass
3+
4+
// The `-Zfuture-incompat-test flag causes any normal warning to be included
5+
// in the future-incompatible report. The stderr output here should mention
6+
// the future incompatible report (as extracted by compiletest).
7+
8+
fn main() {
9+
let x = 1;
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{"type":"future_incompat","future_incompat_report":[{"diagnostic":{"type":"diagnostic","message":"unused variable: `x`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"$DIR/future-incompat-json-test.rs","byte_start":338,"byte_end":339,"line_start":9,"line_end":9,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" let x = 1;","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`-A unused-variables` implied by `-A unused`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"to override `-A unused` add `#[allow(unused_variables)]`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"$DIR/future-incompat-json-test.rs","byte_start":338,"byte_end":339,"line_start":9,"line_end":9,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" let x = 1;","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":"_x","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"warning: unused variable: `x`
2+
--> $DIR/future-incompat-json-test.rs:9:9
3+
|
4+
LL | let x = 1;
5+
| ^ help: if this is intentional, prefix it with an underscore: `_x`
6+
|
7+
= note: `-A unused-variables` implied by `-A unused`
8+
= help: to override `-A unused` add `#[allow(unused_variables)]`
9+
10+
"}}]}

0 commit comments

Comments
 (0)