Add -Zfuture-incompat-test to assist with testing future-incompat reports.
This commit is contained in:
parent
a08f25a7ef
commit
636fcacb44
@ -633,6 +633,7 @@ fn test_debugging_options_tracking_hash() {
|
|||||||
untracked!(dump_mir_graphviz, true);
|
untracked!(dump_mir_graphviz, true);
|
||||||
untracked!(emit_future_incompat_report, true);
|
untracked!(emit_future_incompat_report, true);
|
||||||
untracked!(emit_stack_sizes, true);
|
untracked!(emit_stack_sizes, true);
|
||||||
|
untracked!(future_incompat_test, true);
|
||||||
untracked!(hir_stats, true);
|
untracked!(hir_stats, true);
|
||||||
untracked!(identify_regions, true);
|
untracked!(identify_regions, true);
|
||||||
untracked!(incremental_ignore_spans, true);
|
untracked!(incremental_ignore_spans, true);
|
||||||
|
@ -8,7 +8,7 @@ use rustc_hir::HirId;
|
|||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use rustc_session::lint::{
|
use rustc_session::lint::{
|
||||||
builtin::{self, FORBIDDEN_LINT_GROUPS},
|
builtin::{self, FORBIDDEN_LINT_GROUPS},
|
||||||
FutureIncompatibilityReason, FutureIncompatibleInfo, Level, Lint, LintId,
|
FutureIncompatibilityReason, Level, Lint, LintId,
|
||||||
};
|
};
|
||||||
use rustc_session::{DiagnosticMessageId, Session};
|
use rustc_session::{DiagnosticMessageId, Session};
|
||||||
use rustc_span::hygiene::MacroKind;
|
use rustc_span::hygiene::MacroKind;
|
||||||
@ -223,12 +223,12 @@ pub fn struct_lint_level<'s, 'd>(
|
|||||||
let lint_id = LintId::of(lint);
|
let lint_id = LintId::of(lint);
|
||||||
let future_incompatible = lint.future_incompatible;
|
let future_incompatible = lint.future_incompatible;
|
||||||
|
|
||||||
let has_future_breakage = matches!(
|
let has_future_breakage = future_incompatible.map_or(
|
||||||
future_incompatible,
|
// Default allow lints trigger too often for testing.
|
||||||
Some(FutureIncompatibleInfo {
|
sess.opts.debugging_opts.future_incompat_test && lint.default_level != Level::Allow,
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
|incompat| {
|
||||||
..
|
matches!(incompat.reason, FutureIncompatibilityReason::FutureReleaseErrorReportNow)
|
||||||
})
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut err = match (level, span) {
|
let mut err = match (level, span) {
|
||||||
|
@ -1084,6 +1084,8 @@ options! {
|
|||||||
"set the optimization fuel quota for a crate"),
|
"set the optimization fuel quota for a crate"),
|
||||||
function_sections: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
function_sections: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||||
"whether each function should go in its own section"),
|
"whether each function should go in its own section"),
|
||||||
|
future_incompat_test: bool = (false, parse_bool, [UNTRACKED],
|
||||||
|
"forces all lints to be future incompatible, used for internal testing (default: no)"),
|
||||||
gcc_ld: Option<LdImpl> = (None, parse_gcc_ld, [TRACKED], "implementation of ld used by cc"),
|
gcc_ld: Option<LdImpl> = (None, parse_gcc_ld, [TRACKED], "implementation of ld used by cc"),
|
||||||
graphviz_dark_mode: bool = (false, parse_bool, [UNTRACKED],
|
graphviz_dark_mode: bool = (false, parse_bool, [UNTRACKED],
|
||||||
"use dark-themed colors in graphviz output (default: no)"),
|
"use dark-themed colors in graphviz output (default: no)"),
|
||||||
|
10
src/test/ui/lint/future-incompat-test.rs
Normal file
10
src/test/ui/lint/future-incompat-test.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// compile-flags: -Zfuture-incompat-test -Zemit-future-incompat-report
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
// The `-Zfuture-incompat-test flag causes any normal warning to be included
|
||||||
|
// in the future-incompatible report. The stderr output here should mention
|
||||||
|
// the future incompatible report (as extracted by compiletest).
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let x = 1;
|
||||||
|
}
|
9
src/test/ui/lint/future-incompat-test.stderr
Normal file
9
src/test/ui/lint/future-incompat-test.stderr
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Future incompatibility report: Future breakage diagnostic:
|
||||||
|
warning: unused variable: `x`
|
||||||
|
--> $DIR/future-incompat-test.rs:9:9
|
||||||
|
|
|
||||||
|
LL | let x = 1;
|
||||||
|
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
||||||
|
|
|
||||||
|
= note: `-A unused-variables` implied by `-A unused`
|
||||||
|
|
@ -81,7 +81,7 @@ LL | tuple_from_req!(Foo);
|
|||||||
|
|
||||||
warning: 5 warnings emitted
|
warning: 5 warnings emitted
|
||||||
|
|
||||||
Future incompatibility report: Future breakage date: None, diagnostic:
|
Future incompatibility report: Future breakage diagnostic:
|
||||||
warning: using an old version of `time-macros-impl`
|
warning: using an old version of `time-macros-impl`
|
||||||
--> $DIR/time-macros-impl/src/lib.rs:5:32
|
--> $DIR/time-macros-impl/src/lib.rs:5:32
|
||||||
|
|
|
|
||||||
@ -99,7 +99,7 @@ LL | impl_macros!(Foo);
|
|||||||
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
|
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
|
||||||
= note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
Future breakage date: None, diagnostic:
|
Future breakage diagnostic:
|
||||||
warning: using an old version of `time-macros-impl`
|
warning: using an old version of `time-macros-impl`
|
||||||
--> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32
|
--> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32
|
||||||
|
|
|
|
||||||
@ -116,7 +116,7 @@ LL | impl_macros!(Foo);
|
|||||||
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
|
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
|
||||||
= note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
Future breakage date: None, diagnostic:
|
Future breakage diagnostic:
|
||||||
warning: using an old version of `js-sys`
|
warning: using an old version of `js-sys`
|
||||||
--> $DIR/js-sys-0.3.17/src/lib.rs:5:32
|
--> $DIR/js-sys-0.3.17/src/lib.rs:5:32
|
||||||
|
|
|
|
||||||
@ -133,7 +133,7 @@ LL | arrays!(Foo);
|
|||||||
= note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above
|
= note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above
|
||||||
= note: this warning originates in the macro `arrays` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this warning originates in the macro `arrays` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
Future breakage date: None, diagnostic:
|
Future breakage diagnostic:
|
||||||
warning: using an old version of `actix-web`
|
warning: using an old version of `actix-web`
|
||||||
--> $DIR/actix-web/src/extract.rs:5:34
|
--> $DIR/actix-web/src/extract.rs:5:34
|
||||||
|
|
|
|
||||||
@ -150,7 +150,7 @@ LL | tuple_from_req!(Foo);
|
|||||||
= note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage
|
= note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage
|
||||||
= note: this warning originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this warning originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
Future breakage date: None, diagnostic:
|
Future breakage diagnostic:
|
||||||
warning: using an old version of `actix-web`
|
warning: using an old version of `actix-web`
|
||||||
--> $DIR/actix-web-2.0.0/src/extract.rs:5:34
|
--> $DIR/actix-web-2.0.0/src/extract.rs:5:34
|
||||||
|
|
|
|
||||||
|
@ -11,7 +11,7 @@ LL | enum ProceduralMasqueradeDummyType {
|
|||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
||||||
Future incompatibility report: Future breakage date: None, diagnostic:
|
Future incompatibility report: Future breakage diagnostic:
|
||||||
warning: using `procedural-masquerade` crate
|
warning: using `procedural-masquerade` crate
|
||||||
--> $DIR/issue-73933-procedural-masquerade.rs:8:6
|
--> $DIR/issue-73933-procedural-masquerade.rs:8:6
|
||||||
|
|
|
|
||||||
|
@ -43,7 +43,6 @@ struct FutureIncompatReport {
|
|||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct FutureBreakageItem {
|
struct FutureBreakageItem {
|
||||||
future_breakage_date: Option<String>,
|
|
||||||
diagnostic: Diagnostic,
|
diagnostic: Diagnostic,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,9 +103,7 @@ pub fn extract_rendered(output: &str) -> String {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|item| {
|
.map(|item| {
|
||||||
format!(
|
format!(
|
||||||
"Future breakage date: {}, diagnostic:\n{}",
|
"Future breakage diagnostic:\n{}",
|
||||||
item.future_breakage_date
|
|
||||||
.unwrap_or_else(|| "None".to_string()),
|
|
||||||
item.diagnostic
|
item.diagnostic
|
||||||
.rendered
|
.rendered
|
||||||
.unwrap_or_else(|| "Not rendered".to_string())
|
.unwrap_or_else(|| "Not rendered".to_string())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user