Skip to content

Commit b5de833

Browse files
committed
rollup merge of rust-lang#21441: alexcrichton/rustc-opts
This is a bit of cleanup work to clean out some old deprecated flags and deprecated lint names from the compiler (they've been deprecated for quite awhile now). This also notably puts `--pretty` behind the `-Z unstable-options` flag (where it was supposed to be previously).
2 parents 2783807 + 64914d9 commit b5de833

File tree

28 files changed

+49
-238
lines changed

28 files changed

+49
-238
lines changed

src/compiletest/runtest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
294294
let aux_dir = aux_output_dir_name(config, testfile);
295295
// FIXME (#9639): This needs to handle non-utf8 paths
296296
let mut args = vec!("-".to_string(),
297+
"-Zunstable-options".to_string(),
297298
"--pretty".to_string(),
298299
pretty_type,
299300
format!("--target={}", config.target),
@@ -340,7 +341,7 @@ actual:\n\
340341
};
341342
// FIXME (#9639): This needs to handle non-utf8 paths
342343
let mut args = vec!("-".to_string(),
343-
"--no-trans".to_string(),
344+
"-Zno-trans".to_string(),
344345
"--crate-type=lib".to_string(),
345346
format!("--target={}", target),
346347
"-L".to_string(),

src/librustc/lint/context.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -231,30 +231,7 @@ impl LintStore {
231231
// We have one lint pass defined in this module.
232232
self.register_pass(sess, false, box GatherNodeLevels as LintPassObject);
233233

234-
// Insert temporary renamings for a one-time deprecation (#16545)
235-
self.register_renamed("unnecessary_typecast", "unused_typecasts");
236-
self.register_renamed("unsigned_negate", "unsigned_negation");
237-
self.register_renamed("type_limits", "unused_comparisons");
238-
self.register_renamed("type_overflow", "overflowing_literals");
239-
self.register_renamed("ctypes", "improper_ctypes");
240-
self.register_renamed("owned_heap_memory", "box_pointers");
241-
self.register_renamed("unused_attribute", "unused_attributes");
242-
self.register_renamed("path_statement", "path_statements");
243-
self.register_renamed("unused_result", "unused_results");
244-
self.register_renamed("non_uppercase_statics", "non_upper_case_globals");
245-
self.register_renamed("unnecessary_parens", "unused_parens");
246-
self.register_renamed("unnecessary_import_braces", "unused_import_braces");
247-
self.register_renamed("unsafe_block", "unsafe_blocks");
248-
self.register_renamed("unnecessary_allocation", "unused_allocation");
249-
self.register_renamed("missing_doc", "missing_docs");
250-
self.register_renamed("unused_extern_crate", "unused_extern_crates");
251-
self.register_renamed("unnecessary_qualification", "unused_qualifications");
252-
self.register_renamed("unrecognized_lint", "unknown_lints");
253-
self.register_renamed("unused_variable", "unused_variables");
254-
self.register_renamed("dead_assignment", "unused_assignments");
255-
self.register_renamed("unknown_crate_type", "unknown_crate_types");
256-
self.register_renamed("variant_size_difference", "variant_size_differences");
257-
self.register_renamed("transmute_fat_ptr", "fat_ptr_transmutes");
234+
// Insert temporary renamings for a one-time deprecation
258235
self.register_renamed("raw_pointer_deriving", "raw_pointer_derive");
259236

260237
}

src/librustc/session/config.rs

Lines changed: 6 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -786,30 +786,14 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
786786
opt::multi("", "extern", "Specify where an external rust library is \
787787
located",
788788
"NAME=PATH"),
789-
opt::opt("", "opt-level", "Optimize with possible levels 0-3", "LEVEL"),
790789
opt::opt("", "sysroot", "Override the system root", "PATH"),
791790
opt::multi("Z", "", "Set internal debugging options", "FLAG"),
792791
opt::opt("", "color", "Configure coloring of output:
793792
auto = colorize, if output goes to a tty (default);
794793
always = always colorize output;
795794
never = never colorize output", "auto|always|never"),
796795

797-
// DEPRECATED
798-
opt::flag("", "print-crate-name", "Output the crate name and exit"),
799-
opt::flag("", "print-file-name", "Output the file(s) that would be \
800-
written if compilation \
801-
continued and exit"),
802-
opt::opt("", "debuginfo", "Emit DWARF debug info to the objects created:
803-
0 = no debug info,
804-
1 = line-tables only (for stacktraces and breakpoints),
805-
2 = full debug info with variable and type information \
806-
(same as -g)", "LEVEL"),
807-
opt::flag("", "no-trans", "Run all passes except translation; no output"),
808-
opt::flag("", "no-analysis", "Parse and expand the source, but run no \
809-
analysis and produce no output"),
810-
opt::flag("", "parse-only", "Parse only; do not compile, assemble, \
811-
or link"),
812-
opt::flagopt("", "pretty",
796+
opt::flagopt_u("", "pretty",
813797
"Pretty-print the input instead of compiling;
814798
valid types are: `normal` (un-annotated source),
815799
`expanded` (crates expanded),
@@ -823,9 +807,6 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
823807
`everybody_loops` (all function bodies replaced with `loop {}`).",
824808
"TYPE"),
825809
opt::opt_u("", "show-span", "Show spans for compiler debugging", "expr|pat|ty"),
826-
opt::flagopt("", "dep-info",
827-
"Output dependency info to <filename> after compiling, \
828-
in a format suitable for use by Makefiles", "FILENAME"),
829810
]);
830811
opts
831812
}
@@ -861,27 +842,9 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
861842

862843
let debugging_opts = build_debugging_options(matches);
863844

864-
let parse_only = if matches.opt_present("parse-only") {
865-
// FIXME(acrichto) remove this eventually
866-
early_warn("--parse-only is deprecated in favor of -Z parse-only");
867-
true
868-
} else {
869-
debugging_opts.parse_only
870-
};
871-
let no_trans = if matches.opt_present("no-trans") {
872-
// FIXME(acrichto) remove this eventually
873-
early_warn("--no-trans is deprecated in favor of -Z no-trans");
874-
true
875-
} else {
876-
debugging_opts.no_trans
877-
};
878-
let no_analysis = if matches.opt_present("no-analysis") {
879-
// FIXME(acrichto) remove this eventually
880-
early_warn("--no-analysis is deprecated in favor of -Z no-analysis");
881-
true
882-
} else {
883-
debugging_opts.no_analysis
884-
};
845+
let parse_only = debugging_opts.parse_only;
846+
let no_trans = debugging_opts.no_trans;
847+
let no_analysis = debugging_opts.no_analysis;
885848

886849
if debugging_opts.debug_llvm {
887850
unsafe { llvm::LLVMSetDebug(1); }
@@ -921,28 +884,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
921884
host_triple().to_string());
922885
let opt_level = {
923886
if matches.opt_present("O") {
924-
if matches.opt_present("opt-level") {
925-
early_error("-O and --opt-level both provided");
926-
}
927887
if cg.opt_level.is_some() {
928888
early_error("-O and -C opt-level both provided");
929889
}
930890
Default
931-
} else if matches.opt_present("opt-level") {
932-
// FIXME(acrichto) remove this eventually
933-
early_warn("--opt-level=N is deprecated in favor of -C opt-level=N");
934-
match matches.opt_str("opt-level").as_ref().map(|s| s.as_slice()) {
935-
None |
936-
Some("0") => No,
937-
Some("1") => Less,
938-
Some("2") => Default,
939-
Some("3") => Aggressive,
940-
Some(arg) => {
941-
early_error(&format!("optimization level needs to be \
942-
between 0-3 (instead was `{}`)",
943-
arg)[]);
944-
}
945-
}
946891
} else {
947892
match cg.opt_level {
948893
None => No,
@@ -960,27 +905,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
960905
};
961906
let gc = debugging_opts.gc;
962907
let debuginfo = if matches.opt_present("g") {
963-
if matches.opt_present("debuginfo") {
964-
early_error("-g and --debuginfo both provided");
965-
}
966908
if cg.debuginfo.is_some() {
967909
early_error("-g and -C debuginfo both provided");
968910
}
969911
FullDebugInfo
970-
} else if matches.opt_present("debuginfo") {
971-
// FIXME(acrichto) remove this eventually
972-
early_warn("--debuginfo=N is deprecated in favor of -C debuginfo=N");
973-
match matches.opt_str("debuginfo").as_ref().map(|s| s.as_slice()) {
974-
Some("0") => NoDebugInfo,
975-
Some("1") => LimitedDebugInfo,
976-
None |
977-
Some("2") => FullDebugInfo,
978-
Some(arg) => {
979-
early_error(&format!("debug info level needs to be between \
980-
0-2 (instead was `{}`)",
981-
arg)[]);
982-
}
983-
}
984912
} else {
985913
match cg.debuginfo {
986914
None | Some(0) => NoDebugInfo,
@@ -1036,15 +964,9 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
1036964

1037965
let cfg = parse_cfgspecs(matches.opt_strs("cfg"));
1038966
let test = matches.opt_present("test");
1039-
let write_dependency_info = if matches.opt_present("dep-info") {
1040-
// FIXME(acrichto) remove this eventually
1041-
early_warn("--dep-info has been deprecated in favor of --emit");
1042-
(true, matches.opt_str("dep-info").map(|p| Path::new(p)))
1043-
} else {
1044-
(output_types.contains(&OutputTypeDepInfo), None)
1045-
};
967+
let write_dependency_info = (output_types.contains(&OutputTypeDepInfo), None);
1046968

1047-
let mut prints = matches.opt_strs("print").into_iter().map(|s| {
969+
let prints = matches.opt_strs("print").into_iter().map(|s| {
1048970
match s.as_slice() {
1049971
"crate-name" => PrintRequest::CrateName,
1050972
"file-names" => PrintRequest::FileNames,
@@ -1054,18 +976,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
1054976
}
1055977
}
1056978
}).collect::<Vec<_>>();
1057-
if matches.opt_present("print-crate-name") {
1058-
// FIXME(acrichto) remove this eventually
1059-
early_warn("--print-crate-name has been deprecated in favor of \
1060-
--print crate-name");
1061-
prints.push(PrintRequest::CrateName);
1062-
}
1063-
if matches.opt_present("print-file-name") {
1064-
// FIXME(acrichto) remove this eventually
1065-
early_warn("--print-file-name has been deprecated in favor of \
1066-
--print file-names");
1067-
prints.push(PrintRequest::FileNames);
1068-
}
1069979

1070980
if !cg.remark.is_empty() && debuginfo == NoDebugInfo {
1071981
early_warn("-C remark will not show source locations without \

src/librustc_driver/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,14 @@ fn run_compiler(args: &[String]) {
153153
return
154154
}
155155

156-
let pretty = matches.opt_default("pretty", "normal").map(|a| {
157-
// stable pretty-print variants only
158-
pretty::parse_pretty(&sess, a.as_slice(), false)
159-
});
156+
let pretty = if sess.opts.debugging_opts.unstable_options {
157+
matches.opt_default("pretty", "normal").map(|a| {
158+
// stable pretty-print variants only
159+
pretty::parse_pretty(&sess, a.as_slice(), false)
160+
})
161+
} else {
162+
None
163+
};
160164
let pretty = if pretty.is_none() &&
161165
sess.unstable_options() {
162166
matches.opt_str("xpretty").map(|a| {

src/test/compile-fail/lint-renaming.rs

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

src/test/compile-fail/lint-type-limits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![allow(dead_code)]
1212

13-
// compile-flags: -D type-limits
13+
// compile-flags: -D unused-comparisons
1414
fn main() { }
1515

1616
fn foo() {

src/test/compile-fail/warn-path-statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -D path-statement
11+
// compile-flags: -D path-statements
1212
fn main() {
1313

1414
let x = 10is;

src/test/debuginfo/issue7712.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags:--debuginfo=1
11+
// compile-flags:-C debuginfo=1
1212
// min-lldb-version: 310
1313

1414
pub trait TraitWithDefaultMethod : Sized {

src/test/debuginfo/lexical-scope-in-parameterless-closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// ignore-android: FIXME(#10381)
1212
// min-lldb-version: 310
1313

14-
// compile-flags:--debuginfo=1
14+
// compile-flags:-C debuginfo=1
1515

1616
// gdb-command:run
1717
// lldb-command:run

src/test/debuginfo/limited-debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// ignore-lldb
1414

15-
// compile-flags:--debuginfo=1
15+
// compile-flags:-C debuginfo=1
1616

1717
// Make sure functions have proper names
1818
// gdb-command:info functions
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
-include ../tools.mk
22

33
all:
4-
[ `$(RUSTC) --print-crate-name crate.rs` = "foo" ]
5-
[ `$(RUSTC) --print-file-name crate.rs` = "$(call BIN,foo)" ]
6-
[ `$(RUSTC) --print-file-name --crate-type=lib \
4+
[ `$(RUSTC) --print crate-name crate.rs` = "foo" ]
5+
[ `$(RUSTC) --print file-names crate.rs` = "$(call BIN,foo)" ]
6+
[ `$(RUSTC) --print file-names --crate-type=lib \
77
--test crate.rs` = "$(call BIN,foo)" ]
8-
[ `$(RUSTC) --print-file-name --test lib.rs` = "$(call BIN,mylib)" ]
9-
$(RUSTC) --print-file-name lib.rs
10-
$(RUSTC) --print-file-name rlib.rs
8+
[ `$(RUSTC) --print file-names --test lib.rs` = "$(call BIN,mylib)" ]
9+
$(RUSTC) --print file-names lib.rs
10+
$(RUSTC) --print file-names rlib.rs

src/test/run-make/dep-info-custom/Makefile

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

src/test/run-make/dep-info-custom/Makefile.foo

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

src/test/run-make/dep-info-custom/bar.rs

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

src/test/run-make/dep-info-custom/foo.rs

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

src/test/run-make/dep-info-custom/lib.rs

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

src/test/run-make/dep-info-spaces/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
ifneq ($(shell uname),FreeBSD)
66
ifndef IS_WINDOWS
77
all:
8-
$(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs
8+
$(RUSTC) --emit link,dep-info --crate-type=lib lib.rs
99
sleep 1
1010
touch 'foo foo.rs'
1111
-rm -f $(TMPDIR)/done

0 commit comments

Comments
 (0)