Skip to content

Commit de92e6c

Browse files
committed
inline_threshold mark deprecated
1 parent 68327f8 commit de92e6c

File tree

7 files changed

+24
-10
lines changed

7 files changed

+24
-10
lines changed

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,10 +1128,6 @@ pub fn describe_flag_categories(early_dcx: &EarlyDiagCtxt, matches: &Matches) ->
11281128
early_dcx.early_warn("the `-Cno-stack-check` flag is deprecated and does nothing");
11291129
}
11301130

1131-
if cg_flags.iter().any(|x| x.starts_with("inline-threshold")) {
1132-
early_dcx.early_warn("the `-Cinline-threshold` flag is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)");
1133-
}
1134-
11351131
if cg_flags.iter().any(|x| *x == "passes=list") {
11361132
let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend="));
11371133

compiler/rustc_session/src/options.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,12 @@ fn build_options<O: Default>(
336336

337337
let option_to_lookup = key.replace('-', "_");
338338
match descrs.iter().find(|(name, ..)| *name == option_to_lookup) {
339-
Some((_, setter, type_desc, _, _)) => {
339+
Some((_, setter, type_desc, opt_desc, deprecated_do_nothing)) => {
340+
if *deprecated_do_nothing {
341+
// deprecation works for prefixed options only
342+
assert!(!prefix.is_empty());
343+
early_dcx.early_warn(format!("`-{prefix} {key}`: {opt_desc}"));
344+
}
340345
if !setter(&mut op, value) {
341346
match value {
342347
None => early_dcx.early_fatal(
@@ -1582,7 +1587,8 @@ options! {
15821587
#[rustc_lint_opt_deny_field_access("documented to do nothing")]
15831588
inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED],
15841589
"this option is deprecated and does nothing \
1585-
(consider using `-Cllvm-args=--inline-threshold=...`)"),
1590+
(consider using `-Cllvm-args=--inline-threshold=...`)",
1591+
deprecated_do_nothing: true),
15861592
#[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")]
15871593
instrument_coverage: InstrumentCoverage = (InstrumentCoverage::No, parse_instrument_coverage, [TRACKED],
15881594
"instrument the generated code to support LLVM source-based code coverage reports \
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
warning: `-C inline-threshold`: this option is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)
2+
3+
error: incorrect value `asd` for codegen option `inline-threshold` - a number was expected
4+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
warning: `-C inline-threshold`: this option is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)
2+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
warning: `-C inline-threshold`: this option is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)
2+
3+
error: codegen option `inline-threshold` requires a number (C inline-threshold=<value>)
4+
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
//@ check-pass
2-
//@ compile-flags: -Cinline-threshold=666
1+
//@ revisions: good_val bad_val no_val
2+
//
3+
//@[good_val] compile-flags: -Cinline-threshold=666
4+
//@[good_val] check-pass
5+
//@[bad_val] compile-flags: -Cinline-threshold=asd
6+
//@[no_val] compile-flags: -Cinline-threshold
37

48
fn main() {}

tests/ui/deprecation/deprecated_inline_threshold.stderr

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

0 commit comments

Comments
 (0)