You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #115713 - chenyukang:yukang-fix-115680-rustdoc-arg-check, r=compiler-errors
Abort if check nightly options failed on stable
Fixes#115680
Also, if there are multiple unstable options passing on stable compiler, printing multiple same `note` and `help` seems noisy.
Copy file name to clipboardExpand all lines: compiler/rustc_session/src/config.rs
+13-5
Original file line number
Diff line number
Diff line change
@@ -2982,6 +2982,7 @@ pub mod nightly_options {
2982
2982
){
2983
2983
let has_z_unstable_option = matches.opt_strs("Z").iter().any(|x| *x == "unstable-options");
2984
2984
let really_allows_unstable_options = match_is_nightly_build(matches);
2985
+
letmut nightly_options_on_stable = 0;
2985
2986
2986
2987
for opt in flags.iter(){
2987
2988
if opt.stability == OptionStability::Stable{
@@ -3002,20 +3003,27 @@ pub mod nightly_options {
3002
3003
}
3003
3004
match opt.stability{
3004
3005
OptionStability::Unstable => {
3006
+
nightly_options_on_stable += 1;
3005
3007
let msg = format!(
3006
3008
"the option `{}` is only accepted on the nightly compiler",
3007
3009
opt.name
3008
3010
);
3009
3011
let _ = handler.early_error_no_abort(msg);
3010
-
handler.early_note("selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html>");
3011
-
handler.early_help(
3012
-
"consider switching to a nightly toolchain: `rustup default nightly`",
3013
-
);
3014
-
handler.early_note("for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features>");
3015
3012
}
3016
3013
OptionStability::Stable => {}
3017
3014
}
3018
3015
}
3016
+
if nightly_options_on_stable > 0{
3017
+
handler
3018
+
.early_help("consider switching to a nightly toolchain: `rustup default nightly`");
3019
+
handler.early_note("selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html>");
3020
+
handler.early_note("for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features>");
0 commit comments