Skip to content

Commit 30b35c0

Browse files
authored
Unrolled build for #154498
Rollup merge of #154498 - RalfJung:option-deprecations, r=fmease turn some long-deprecated -C options into errors - `-Car` has been documented to do nothing for more than 8 years (691ab6c) and causes a warning for more than a year (#135126). - `-Cno-stack-check` has been made a NOP and deprecated with a warning more than 9 years ago (c670293) - `-Cinline-threshold` has been made a NOP and deprecated with a warning almost 2 years ago (#124712). With them being ignored there's always a risk someone thinks they'll do something and they don't notice the warning. I think these have been deprecated for long enough that we can turn them into hard errors. Also change the type of these fields to `()` so there's no information here that the rest of the compiler could use. This supersedes the `rustc_lint_opt_deny_field_access` trick. MCP: rust-lang/compiler-team#978
2 parents 3e353d7 + 9af2553 commit 30b35c0

15 files changed

Lines changed: 17 additions & 87 deletions

compiler/rustc_interface/src/tests.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,19 +578,16 @@ fn test_codegen_options_tracking_hash() {
578578

579579
// Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
580580
// tidy-alphabetical-start
581-
untracked!(ar, String::from("abc"));
582581
untracked!(codegen_units, Some(42));
583582
untracked!(default_linker_libraries, true);
584583
untracked!(dlltool, Some(PathBuf::from("custom_dlltool.exe")));
585584
untracked!(extra_filename, String::from("extra-filename"));
586585
untracked!(incremental, Some(String::from("abc")));
587-
untracked!(inline_threshold, Some(0xf007ba11));
588586
// `link_arg` is omitted because it just forwards to `link_args`.
589587
untracked!(link_args, vec![String::from("abc"), String::from("def")]);
590588
untracked!(link_self_contained, LinkSelfContained::on());
591589
untracked!(linker, Some(PathBuf::from("linker")));
592590
untracked!(linker_flavor, Some(LinkerFlavorCli::Gcc));
593-
untracked!(no_stack_check, true);
594591
untracked!(remark, Passes::Some(vec![String::from("pass1"), String::from("pass2")]));
595592
untracked!(rpath, true);
596593
untracked!(save_temps, true);

compiler/rustc_session/src/options.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ type OptionDescrs<O> = &'static [OptionDesc<O>];
653653

654654
/// Indicates whether a removed option should warn or error.
655655
enum RemovedOption {
656+
#[allow(unused)] // we might want deprecated options that warn again in the future
656657
Warn,
657658
Err,
658659
}
@@ -2038,10 +2039,9 @@ options! {
20382039
// - src/doc/rustc/src/codegen-options/index.md
20392040

20402041
// tidy-alphabetical-start
2041-
#[rustc_lint_opt_deny_field_access("documented to do nothing")]
2042-
ar: String = (String::new(), parse_string, [UNTRACKED],
2043-
"this option is deprecated and does nothing",
2044-
removed: Warn),
2042+
ar: () = ((), parse_ignore, [UNTRACKED],
2043+
"this option has been removed",
2044+
removed: Err),
20452045
#[rustc_lint_opt_deny_field_access("use `Session::code_model` instead of this field")]
20462046
code_model: Option<CodeModel> = (None, parse_code_model, [TRACKED],
20472047
"choose the code model to use (`rustc --print code-models` for details)"),
@@ -2076,11 +2076,10 @@ options! {
20762076
help: bool = (false, parse_no_value, [UNTRACKED], "Print codegen options"),
20772077
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
20782078
"enable incremental compilation"),
2079-
#[rustc_lint_opt_deny_field_access("documented to do nothing")]
2080-
inline_threshold: Option<u32> = (None, parse_opt_number, [UNTRACKED],
2081-
"this option is deprecated and does nothing \
2079+
inline_threshold: () = ((), parse_ignore, [UNTRACKED],
2080+
"this option has been removed \
20822081
(consider using `-Cllvm-args=--inline-threshold=...`)",
2083-
removed: Warn),
2082+
removed: Err),
20842083
#[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")]
20852084
instrument_coverage: InstrumentCoverage = (InstrumentCoverage::No, parse_instrument_coverage, [TRACKED],
20862085
"instrument the generated code to support LLVM source-based code coverage reports \
@@ -2118,10 +2117,9 @@ options! {
21182117
"give an empty list of passes to the pass manager"),
21192118
no_redzone: Option<bool> = (None, parse_opt_bool, [TRACKED],
21202119
"disable the use of the redzone"),
2121-
#[rustc_lint_opt_deny_field_access("documented to do nothing")]
2122-
no_stack_check: bool = (false, parse_no_value, [UNTRACKED],
2123-
"this option is deprecated and does nothing",
2124-
removed: Warn),
2120+
no_stack_check: () = ((), parse_ignore, [UNTRACKED],
2121+
"this option has been removed",
2122+
removed: Err),
21252123
no_vectorize_loops: bool = (false, parse_no_value, [TRACKED],
21262124
"disable loop vectorization optimization passes"),
21272125
no_vectorize_slp: bool = (false, parse_no_value, [TRACKED],
@@ -2155,7 +2153,6 @@ options! {
21552153
"set rpath values in libs/exes (default: no)"),
21562154
save_temps: bool = (false, parse_bool, [UNTRACKED],
21572155
"save all temporary output files during compilation (default: no)"),
2158-
#[rustc_lint_opt_deny_field_access("documented to do nothing")]
21592156
soft_float: () = ((), parse_ignore, [UNTRACKED],
21602157
"this option has been removed \
21612158
(use a corresponding *eabi target instead)",

src/doc/rustc/src/codegen-options/index.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
All of these options are passed to `rustc` via the `-C` flag, short for "codegen." You can see
44
a version of this list for your exact compiler by running `rustc -C help`.
55

6-
## ar
7-
8-
This option is deprecated and does nothing.
9-
106
## code-model
117

128
This option lets you choose which code model to use. \
@@ -194,12 +190,6 @@ incremental files will be stored.
194190

195191
Using incremental compilation inhibits certain optimizations (for example by increasing the amount of codegen units) and is therefore not recommended for release builds.
196192

197-
## inline-threshold
198-
199-
This option is deprecated and does nothing.
200-
201-
Consider using `-Cllvm-args=--inline-threshold=...`.
202-
203193
## instrument-coverage
204194

205195
This option enables instrumentation-based code coverage support. See the
@@ -443,10 +433,6 @@ of the following values:
443433

444434
The default behaviour, if the flag is not specified, depends on the target.
445435

446-
## no-stack-check
447-
448-
This option is deprecated and does nothing.
449-
450436
## no-vectorize-loops
451437

452438
This flag disables [loop
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ compile-flags: -Car=foo
2+
3+
fn main() {}
4+
5+
//~? ERROR `-C ar`: this option has been removed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: `-C ar`: this option has been removed
2+

tests/ui/deprecation/deprecated_ar.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/ui/deprecation/deprecated_ar.stderr

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/ui/deprecation/deprecated_inline_threshold.bad_val.stderr

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/ui/deprecation/deprecated_inline_threshold.good_val.stderr

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/ui/deprecation/deprecated_inline_threshold.no_val.stderr

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)