From 953f294ea30253bb5578e3c895d17fcc97c20dce Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Tue, 20 Jan 2015 10:57:10 -0800
Subject: [PATCH 1/2] rustc: Remove deprecated flags

This commit removes a number of deprecated flags from the compiler:

* opt-level => -C opt-level
* debuginfo => -C debuginfo
* print-crate-name => --print crate-name
* print-file-name => --print file-names
* no-trans => -Z no-trans
* no-analysis => -Z no-analysis
* parse-only => -Z parse-only
* dep-info => --emit dep-info

This commit also moves the --pretty flag behind `-Z unstable-options` as the
pretty printer will likely not be stable for 1.0

cc #19051
---
 src/compiletest/runtest.rs                    |   3 +-
 src/librustc/session/config.rs                | 102 ++----------------
 src/librustc_driver/lib.rs                    |  12 ++-
 src/test/debuginfo/issue7712.rs               |   2 +-
 .../lexical-scope-in-parameterless-closure.rs |   2 +-
 src/test/debuginfo/limited-debuginfo.rs       |   2 +-
 src/test/run-make/crate-data-smoke/Makefile   |  12 +--
 src/test/run-make/dep-info-custom/Makefile    |  25 -----
 .../run-make/dep-info-custom/Makefile.foo     |   7 --
 src/test/run-make/dep-info-custom/bar.rs      |  11 --
 src/test/run-make/dep-info-custom/foo.rs      |  11 --
 src/test/run-make/dep-info-custom/lib.rs      |  14 ---
 src/test/run-make/dep-info-spaces/Makefile    |   2 +-
 .../run-make/dep-info-spaces/Makefile.foo     |   6 +-
 src/test/run-make/dep-info/Makefile           |   2 +-
 .../error-writing-dependencies/Makefile       |   4 +-
 src/test/run-make/graphviz-flowgraph/Makefile |   2 +-
 .../run-make/pretty-expanded-hygiene/Makefile |   3 +-
 src/test/run-make/pretty-expanded/Makefile    |   3 +-
 .../pretty-print-path-suffix/Makefile         |   6 +-
 .../run-make/pretty-print-to-file/Makefile    |   2 +-
 src/test/run-make/tools.mk                    |   3 +-
 22 files changed, 43 insertions(+), 193 deletions(-)
 delete mode 100644 src/test/run-make/dep-info-custom/Makefile
 delete mode 100644 src/test/run-make/dep-info-custom/Makefile.foo
 delete mode 100644 src/test/run-make/dep-info-custom/bar.rs
 delete mode 100644 src/test/run-make/dep-info-custom/foo.rs
 delete mode 100644 src/test/run-make/dep-info-custom/lib.rs

diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 5579479c5e5..9eac187a8e2 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -294,6 +294,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
         let aux_dir = aux_output_dir_name(config, testfile);
         // FIXME (#9639): This needs to handle non-utf8 paths
         let mut args = vec!("-".to_string(),
+                            "-Zunstable-options".to_string(),
                             "--pretty".to_string(),
                             pretty_type,
                             format!("--target={}", config.target),
@@ -340,7 +341,7 @@ actual:\n\
         };
         // FIXME (#9639): This needs to handle non-utf8 paths
         let mut args = vec!("-".to_string(),
-                            "--no-trans".to_string(),
+                            "-Zno-trans".to_string(),
                             "--crate-type=lib".to_string(),
                             format!("--target={}", target),
                             "-L".to_string(),
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index d9bb1d769bf..1e4babef9f5 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -786,7 +786,6 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
         opt::multi("", "extern", "Specify where an external rust library is \
                                 located",
                  "NAME=PATH"),
-        opt::opt("", "opt-level", "Optimize with possible levels 0-3", "LEVEL"),
         opt::opt("", "sysroot", "Override the system root", "PATH"),
         opt::multi("Z", "", "Set internal debugging options", "FLAG"),
         opt::opt("", "color", "Configure coloring of output:
@@ -794,22 +793,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
             always = always colorize output;
             never  = never colorize output", "auto|always|never"),
 
-        // DEPRECATED
-        opt::flag("", "print-crate-name", "Output the crate name and exit"),
-        opt::flag("", "print-file-name", "Output the file(s) that would be \
-                                        written if compilation \
-                                        continued and exit"),
-        opt::opt("",  "debuginfo",  "Emit DWARF debug info to the objects created:
-             0 = no debug info,
-             1 = line-tables only (for stacktraces and breakpoints),
-             2 = full debug info with variable and type information \
-                    (same as -g)", "LEVEL"),
-        opt::flag("", "no-trans", "Run all passes except translation; no output"),
-        opt::flag("", "no-analysis", "Parse and expand the source, but run no \
-                                    analysis and produce no output"),
-        opt::flag("", "parse-only", "Parse only; do not compile, assemble, \
-                                   or link"),
-        opt::flagopt("", "pretty",
+        opt::flagopt_u("", "pretty",
                    "Pretty-print the input instead of compiling;
                    valid types are: `normal` (un-annotated source),
                    `expanded` (crates expanded),
@@ -823,9 +807,6 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
                       `everybody_loops` (all function bodies replaced with `loop {}`).",
                      "TYPE"),
         opt::opt_u("", "show-span", "Show spans for compiler debugging", "expr|pat|ty"),
-        opt::flagopt("", "dep-info",
-                 "Output dependency info to <filename> after compiling, \
-                  in a format suitable for use by Makefiles", "FILENAME"),
     ]);
     opts
 }
@@ -861,27 +842,9 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
 
     let debugging_opts = build_debugging_options(matches);
 
-    let parse_only = if matches.opt_present("parse-only") {
-        // FIXME(acrichto) remove this eventually
-        early_warn("--parse-only is deprecated in favor of -Z parse-only");
-        true
-    } else {
-        debugging_opts.parse_only
-    };
-    let no_trans = if matches.opt_present("no-trans") {
-        // FIXME(acrichto) remove this eventually
-        early_warn("--no-trans is deprecated in favor of -Z no-trans");
-        true
-    } else {
-        debugging_opts.no_trans
-    };
-    let no_analysis = if matches.opt_present("no-analysis") {
-        // FIXME(acrichto) remove this eventually
-        early_warn("--no-analysis is deprecated in favor of -Z no-analysis");
-        true
-    } else {
-        debugging_opts.no_analysis
-    };
+    let parse_only = debugging_opts.parse_only;
+    let no_trans = debugging_opts.no_trans;
+    let no_analysis = debugging_opts.no_analysis;
 
     if debugging_opts.debug_llvm {
         unsafe { llvm::LLVMSetDebug(1); }
@@ -921,28 +884,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
         host_triple().to_string());
     let opt_level = {
         if matches.opt_present("O") {
-            if matches.opt_present("opt-level") {
-                early_error("-O and --opt-level both provided");
-            }
             if cg.opt_level.is_some() {
                 early_error("-O and -C opt-level both provided");
             }
             Default
-        } else if matches.opt_present("opt-level") {
-            // FIXME(acrichto) remove this eventually
-            early_warn("--opt-level=N is deprecated in favor of -C opt-level=N");
-            match matches.opt_str("opt-level").as_ref().map(|s| s.as_slice()) {
-                None      |
-                Some("0") => No,
-                Some("1") => Less,
-                Some("2") => Default,
-                Some("3") => Aggressive,
-                Some(arg) => {
-                    early_error(&format!("optimization level needs to be \
-                                         between 0-3 (instead was `{}`)",
-                                        arg)[]);
-                }
-            }
         } else {
             match cg.opt_level {
                 None => No,
@@ -960,27 +905,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
     };
     let gc = debugging_opts.gc;
     let debuginfo = if matches.opt_present("g") {
-        if matches.opt_present("debuginfo") {
-            early_error("-g and --debuginfo both provided");
-        }
         if cg.debuginfo.is_some() {
             early_error("-g and -C debuginfo both provided");
         }
         FullDebugInfo
-    } else if matches.opt_present("debuginfo") {
-        // FIXME(acrichto) remove this eventually
-        early_warn("--debuginfo=N is deprecated in favor of -C debuginfo=N");
-        match matches.opt_str("debuginfo").as_ref().map(|s| s.as_slice()) {
-            Some("0") => NoDebugInfo,
-            Some("1") => LimitedDebugInfo,
-            None      |
-            Some("2") => FullDebugInfo,
-            Some(arg) => {
-                early_error(&format!("debug info level needs to be between \
-                                     0-2 (instead was `{}`)",
-                                    arg)[]);
-            }
-        }
     } else {
         match cg.debuginfo {
             None | Some(0) => NoDebugInfo,
@@ -1036,15 +964,9 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
 
     let cfg = parse_cfgspecs(matches.opt_strs("cfg"));
     let test = matches.opt_present("test");
-    let write_dependency_info = if matches.opt_present("dep-info") {
-        // FIXME(acrichto) remove this eventually
-        early_warn("--dep-info has been deprecated in favor of --emit");
-        (true, matches.opt_str("dep-info").map(|p| Path::new(p)))
-    } else {
-        (output_types.contains(&OutputTypeDepInfo), None)
-    };
+    let write_dependency_info = (output_types.contains(&OutputTypeDepInfo), None);
 
-    let mut prints = matches.opt_strs("print").into_iter().map(|s| {
+    let prints = matches.opt_strs("print").into_iter().map(|s| {
         match s.as_slice() {
             "crate-name" => PrintRequest::CrateName,
             "file-names" => PrintRequest::FileNames,
@@ -1054,18 +976,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
             }
         }
     }).collect::<Vec<_>>();
-    if matches.opt_present("print-crate-name") {
-        // FIXME(acrichto) remove this eventually
-        early_warn("--print-crate-name has been deprecated in favor of \
-                    --print crate-name");
-        prints.push(PrintRequest::CrateName);
-    }
-    if matches.opt_present("print-file-name") {
-        // FIXME(acrichto) remove this eventually
-        early_warn("--print-file-name has been deprecated in favor of \
-                    --print file-names");
-        prints.push(PrintRequest::FileNames);
-    }
 
     if !cg.remark.is_empty() && debuginfo == NoDebugInfo {
         early_warn("-C remark will not show source locations without \
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 50ff4546c37..355d8ecf9ff 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -154,10 +154,14 @@ fn run_compiler(args: &[String]) {
         return
     }
 
-    let pretty = matches.opt_default("pretty", "normal").map(|a| {
-        // stable pretty-print variants only
-        pretty::parse_pretty(&sess, a.as_slice(), false)
-    });
+    let pretty = if sess.opts.debugging_opts.unstable_options {
+        matches.opt_default("pretty", "normal").map(|a| {
+            // stable pretty-print variants only
+            pretty::parse_pretty(&sess, a.as_slice(), false)
+        })
+    } else {
+        None
+    };
     let pretty = if pretty.is_none() &&
         sess.unstable_options() {
             matches.opt_str("xpretty").map(|a| {
diff --git a/src/test/debuginfo/issue7712.rs b/src/test/debuginfo/issue7712.rs
index 94458a7fb4b..124cdfb436c 100644
--- a/src/test/debuginfo/issue7712.rs
+++ b/src/test/debuginfo/issue7712.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:--debuginfo=1
+// compile-flags:-C debuginfo=1
 // min-lldb-version: 310
 
 pub trait TraitWithDefaultMethod : Sized {
diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs
index b2617c57742..0050b9273e8 100644
--- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs
+++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs
@@ -11,7 +11,7 @@
 // ignore-android: FIXME(#10381)
 // min-lldb-version: 310
 
-// compile-flags:--debuginfo=1
+// compile-flags:-C debuginfo=1
 
 // gdb-command:run
 // lldb-command:run
diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs
index 00de4497ced..76a0fd58395 100644
--- a/src/test/debuginfo/limited-debuginfo.rs
+++ b/src/test/debuginfo/limited-debuginfo.rs
@@ -12,7 +12,7 @@
 
 // ignore-lldb
 
-// compile-flags:--debuginfo=1
+// compile-flags:-C debuginfo=1
 
 // Make sure functions have proper names
 // gdb-command:info functions
diff --git a/src/test/run-make/crate-data-smoke/Makefile b/src/test/run-make/crate-data-smoke/Makefile
index 093796e1dc2..1afda457411 100644
--- a/src/test/run-make/crate-data-smoke/Makefile
+++ b/src/test/run-make/crate-data-smoke/Makefile
@@ -1,10 +1,10 @@
 -include ../tools.mk
 
 all:
-	[ `$(RUSTC) --print-crate-name crate.rs` = "foo" ]
-	[ `$(RUSTC) --print-file-name crate.rs` = "$(call BIN,foo)" ]
-	[ `$(RUSTC) --print-file-name --crate-type=lib \
+	[ `$(RUSTC) --print crate-name crate.rs` = "foo" ]
+	[ `$(RUSTC) --print file-names crate.rs` = "$(call BIN,foo)" ]
+	[ `$(RUSTC) --print file-names --crate-type=lib \
 		--test crate.rs` = "$(call BIN,foo)" ]
-	[ `$(RUSTC) --print-file-name --test lib.rs` = "$(call BIN,mylib)" ]
-	$(RUSTC) --print-file-name lib.rs
-	$(RUSTC) --print-file-name rlib.rs
+	[ `$(RUSTC) --print file-names --test lib.rs` = "$(call BIN,mylib)" ]
+	$(RUSTC) --print file-names lib.rs
+	$(RUSTC) --print file-names rlib.rs
diff --git a/src/test/run-make/dep-info-custom/Makefile b/src/test/run-make/dep-info-custom/Makefile
deleted file mode 100644
index efa6dfe981b..00000000000
--- a/src/test/run-make/dep-info-custom/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
--include ../tools.mk
-
-# FIXME: ignore freebsd/windows
-# (windows: see `../dep-info/Makefile`)
-ifneq ($(shell uname),FreeBSD)
-ifndef IS_WINDOWS
-all:
-	$(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs
-	sleep 1
-	touch foo.rs
-	-rm -f $(TMPDIR)/done
-	$(MAKE) -drf Makefile.foo
-	rm $(TMPDIR)/done
-	pwd
-	$(MAKE) -drf Makefile.foo
-	rm $(TMPDIR)/done && exit 1 || exit 0
-else
-all:
-
-endif
-
-else
-all:
-
-endif
diff --git a/src/test/run-make/dep-info-custom/Makefile.foo b/src/test/run-make/dep-info-custom/Makefile.foo
deleted file mode 100644
index 88be7630e83..00000000000
--- a/src/test/run-make/dep-info-custom/Makefile.foo
+++ /dev/null
@@ -1,7 +0,0 @@
-LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs)
-
-$(TMPDIR)/$(LIB):
-	$(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs
-	touch $(TMPDIR)/done
-
--include $(TMPDIR)/custom-deps-file.d
diff --git a/src/test/run-make/dep-info-custom/bar.rs b/src/test/run-make/dep-info-custom/bar.rs
deleted file mode 100644
index 4c79f7e2855..00000000000
--- a/src/test/run-make/dep-info-custom/bar.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn bar() {}
diff --git a/src/test/run-make/dep-info-custom/foo.rs b/src/test/run-make/dep-info-custom/foo.rs
deleted file mode 100644
index 2661b1f4eb4..00000000000
--- a/src/test/run-make/dep-info-custom/foo.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn foo() {}
diff --git a/src/test/run-make/dep-info-custom/lib.rs b/src/test/run-make/dep-info-custom/lib.rs
deleted file mode 100644
index 14baa8ca55a..00000000000
--- a/src/test/run-make/dep-info-custom/lib.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![crate_name="foo"]
-
-pub mod foo;
-pub mod bar;
diff --git a/src/test/run-make/dep-info-spaces/Makefile b/src/test/run-make/dep-info-spaces/Makefile
index 72dca3d3c90..eda8cb70081 100644
--- a/src/test/run-make/dep-info-spaces/Makefile
+++ b/src/test/run-make/dep-info-spaces/Makefile
@@ -5,7 +5,7 @@
 ifneq ($(shell uname),FreeBSD)
 ifndef IS_WINDOWS
 all:
-	$(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs
+	$(RUSTC) --emit link,dep-info --crate-type=lib lib.rs
 	sleep 1
 	touch 'foo foo.rs'
 	-rm -f $(TMPDIR)/done
diff --git a/src/test/run-make/dep-info-spaces/Makefile.foo b/src/test/run-make/dep-info-spaces/Makefile.foo
index 0e187565d6d..2f4cc486d86 100644
--- a/src/test/run-make/dep-info-spaces/Makefile.foo
+++ b/src/test/run-make/dep-info-spaces/Makefile.foo
@@ -1,7 +1,7 @@
-LIB := $(shell $(RUSTC) --print-file-name --crate-type=lib lib.rs)
+LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs)
 
 $(TMPDIR)/$(LIB):
-	$(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs
+	$(RUSTC) --emit link,dep-info --crate-type=lib lib.rs
 	touch $(TMPDIR)/done
 
--include $(TMPDIR)/custom-deps-file.d
+-include $(TMPDIR)/lib.d
diff --git a/src/test/run-make/dep-info/Makefile b/src/test/run-make/dep-info/Makefile
index 6835ef34b0b..a1828cd1f5d 100644
--- a/src/test/run-make/dep-info/Makefile
+++ b/src/test/run-make/dep-info/Makefile
@@ -7,7 +7,7 @@
 ifneq ($(shell uname),FreeBSD)
 ifndef IS_WINDOWS
 all:
-	$(RUSTC) --dep-info --crate-type=lib lib.rs
+	$(RUSTC) --emit dep-info,link --crate-type=lib lib.rs
 	sleep 2
 	touch foo.rs
 	-rm -f $(TMPDIR)/done
diff --git a/src/test/run-make/error-writing-dependencies/Makefile b/src/test/run-make/error-writing-dependencies/Makefile
index 9f91618bda4..89fbfa0a1bf 100644
--- a/src/test/run-make/error-writing-dependencies/Makefile
+++ b/src/test/run-make/error-writing-dependencies/Makefile
@@ -2,7 +2,7 @@
 
 all:
 	# Let's get a nice error message
-	$(RUSTC) foo.rs --dep-info foo/bar/baz 2>&1 | \
+	$(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \
 		grep "error writing dependencies"
 	# Make sure the filename shows up
-	$(RUSTC) foo.rs --dep-info foo/bar/baz 2>&1 | grep "baz"
+	$(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | grep "baz"
diff --git a/src/test/run-make/graphviz-flowgraph/Makefile b/src/test/run-make/graphviz-flowgraph/Makefile
index 4ac8cb7ae1d..1533729de94 100644
--- a/src/test/run-make/graphviz-flowgraph/Makefile
+++ b/src/test/run-make/graphviz-flowgraph/Makefile
@@ -13,7 +13,7 @@ all: $(patsubst %.rs,$(TMPDIR)/%.check,$(FILES))
 RUSTC_LIB=$(RUSTC) --crate-type=lib
 
 define FIND_LAST_BLOCK
-LASTBLOCKNUM_$(1) := $(shell $(RUSTC_LIB) --pretty=expanded,identified $(1) \
+LASTBLOCKNUM_$(1) := $(shell $(RUSTC_LIB) -Z unstable-options --pretty=expanded,identified $(1) \
 			 | grep block
 			 | tail -1
 			 | sed -e 's@.*/\* block \([0-9]*\) \*/.*@\1@')
diff --git a/src/test/run-make/pretty-expanded-hygiene/Makefile b/src/test/run-make/pretty-expanded-hygiene/Makefile
index 11763446437..136d7643ade 100644
--- a/src/test/run-make/pretty-expanded-hygiene/Makefile
+++ b/src/test/run-make/pretty-expanded-hygiene/Makefile
@@ -3,7 +3,8 @@
 REPLACEMENT := s/[0-9][0-9]*\#[0-9][0-9]*/$(shell date)/g
 
 all:
-	$(RUSTC) -o $(TMPDIR)/input.out --pretty expanded,hygiene input.rs
+	$(RUSTC) -o $(TMPDIR)/input.out -Z unstable-options \
+		--pretty expanded,hygiene input.rs
 
 	# the name/ctxt numbers are very internals-dependent and thus
 	# change relatively frequently, and testing for their exact values
diff --git a/src/test/run-make/pretty-expanded/Makefile b/src/test/run-make/pretty-expanded/Makefile
index dda441ae3d1..7a8dc8d871c 100644
--- a/src/test/run-make/pretty-expanded/Makefile
+++ b/src/test/run-make/pretty-expanded/Makefile
@@ -1,4 +1,5 @@
 -include ../tools.mk
 
 all:
-	$(RUSTC) -o $(TMPDIR)/input.expanded.rs --pretty=expanded input.rs
+	$(RUSTC) -o $(TMPDIR)/input.expanded.rs -Z unstable-options \
+		--pretty=expanded input.rs
diff --git a/src/test/run-make/pretty-print-path-suffix/Makefile b/src/test/run-make/pretty-print-path-suffix/Makefile
index f58a6527ac6..9f0c3f5120d 100644
--- a/src/test/run-make/pretty-print-path-suffix/Makefile
+++ b/src/test/run-make/pretty-print-path-suffix/Makefile
@@ -1,9 +1,9 @@
 -include ../tools.mk
 
 all:
-	$(RUSTC) -o $(TMPDIR)/foo.out --pretty normal=foo input.rs
-	$(RUSTC) -o $(TMPDIR)/nest_foo.out --pretty normal=nest::foo input.rs
-	$(RUSTC) -o $(TMPDIR)/foo_method.out --pretty normal=foo_method input.rs
+	$(RUSTC) -o $(TMPDIR)/foo.out -Z unstable-options --pretty normal=foo input.rs
+	$(RUSTC) -o $(TMPDIR)/nest_foo.out -Z unstable-options --pretty normal=nest::foo input.rs
+	$(RUSTC) -o $(TMPDIR)/foo_method.out -Z unstable-options --pretty normal=foo_method input.rs
 	diff -u $(TMPDIR)/foo.out foo.pp
 	diff -u $(TMPDIR)/nest_foo.out nest_foo.pp
 	diff -u $(TMPDIR)/foo_method.out foo_method.pp
diff --git a/src/test/run-make/pretty-print-to-file/Makefile b/src/test/run-make/pretty-print-to-file/Makefile
index 1c1242ada8a..8909dee11f0 100644
--- a/src/test/run-make/pretty-print-to-file/Makefile
+++ b/src/test/run-make/pretty-print-to-file/Makefile
@@ -1,5 +1,5 @@
 -include ../tools.mk
 
 all:
-	$(RUSTC) -o $(TMPDIR)/input.out --pretty=normal input.rs
+	$(RUSTC) -o $(TMPDIR)/input.out --pretty=normal -Z unstable-options input.rs
 	diff -u $(TMPDIR)/input.out input.pp
diff --git a/src/test/run-make/tools.mk b/src/test/run-make/tools.mk
index 971295405aa..1c791f0690c 100644
--- a/src/test/run-make/tools.mk
+++ b/src/test/run-make/tools.mk
@@ -5,7 +5,8 @@ HOST_RPATH_ENV = \
 TARGET_RPATH_ENV = \
     $(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(TARGET_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))"
 
-RUSTC := $(HOST_RPATH_ENV) $(RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR)
+BARE_RUSTC := $(HOST_RPATH_ENV) $(RUSTC)
+RUSTC := $(BARE_RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR)
 CC := $(CC) -L $(TMPDIR)
 HTMLDOCCK := $(PYTHON) $(S)/src/etc/htmldocck.py
 

From 64914d9d39aaa06f3796b412e90065d26a704eea Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Tue, 20 Jan 2015 11:20:22 -0800
Subject: [PATCH 2/2] rustc: Remove deprecated lint names

These were all renamed quite some time ago, so remove their old names from the
compiler.
---
 src/librustc/lint/context.rs                 | 25 +-------------------
 src/test/compile-fail/lint-renaming.rs       | 16 -------------
 src/test/compile-fail/lint-type-limits.rs    |  2 +-
 src/test/compile-fail/warn-path-statement.rs |  2 +-
 src/test/run-pass/crate-name-attr-used.rs    |  2 +-
 src/test/run-pass/warn-ctypes-inhibit.rs     |  4 ++--
 6 files changed, 6 insertions(+), 45 deletions(-)
 delete mode 100644 src/test/compile-fail/lint-renaming.rs

diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index de4efe09f27..fcb3200089b 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -231,30 +231,7 @@ impl LintStore {
         // We have one lint pass defined in this module.
         self.register_pass(sess, false, box GatherNodeLevels as LintPassObject);
 
-        // Insert temporary renamings for a one-time deprecation (#16545)
-        self.register_renamed("unnecessary_typecast", "unused_typecasts");
-        self.register_renamed("unsigned_negate", "unsigned_negation");
-        self.register_renamed("type_limits", "unused_comparisons");
-        self.register_renamed("type_overflow", "overflowing_literals");
-        self.register_renamed("ctypes", "improper_ctypes");
-        self.register_renamed("owned_heap_memory", "box_pointers");
-        self.register_renamed("unused_attribute", "unused_attributes");
-        self.register_renamed("path_statement", "path_statements");
-        self.register_renamed("unused_result", "unused_results");
-        self.register_renamed("non_uppercase_statics", "non_upper_case_globals");
-        self.register_renamed("unnecessary_parens", "unused_parens");
-        self.register_renamed("unnecessary_import_braces", "unused_import_braces");
-        self.register_renamed("unsafe_block", "unsafe_blocks");
-        self.register_renamed("unnecessary_allocation", "unused_allocation");
-        self.register_renamed("missing_doc", "missing_docs");
-        self.register_renamed("unused_extern_crate", "unused_extern_crates");
-        self.register_renamed("unnecessary_qualification", "unused_qualifications");
-        self.register_renamed("unrecognized_lint", "unknown_lints");
-        self.register_renamed("unused_variable", "unused_variables");
-        self.register_renamed("dead_assignment", "unused_assignments");
-        self.register_renamed("unknown_crate_type", "unknown_crate_types");
-        self.register_renamed("variant_size_difference", "variant_size_differences");
-        self.register_renamed("transmute_fat_ptr", "fat_ptr_transmutes");
+        // Insert temporary renamings for a one-time deprecation
         self.register_renamed("raw_pointer_deriving", "raw_pointer_derive");
 
     }
diff --git a/src/test/compile-fail/lint-renaming.rs b/src/test/compile-fail/lint-renaming.rs
deleted file mode 100644
index 7ffec37772f..00000000000
--- a/src/test/compile-fail/lint-renaming.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Check that lint deprecation works
-
-#[deny(unused_variable)] //~ warning: lint unused_variable has been renamed to unused_variables
-pub fn main() {
-    let x = 0u8; //~ error: unused variable:
-}
diff --git a/src/test/compile-fail/lint-type-limits.rs b/src/test/compile-fail/lint-type-limits.rs
index a2bc464ac49..3eae12f234f 100644
--- a/src/test/compile-fail/lint-type-limits.rs
+++ b/src/test/compile-fail/lint-type-limits.rs
@@ -10,7 +10,7 @@
 
 #![allow(dead_code)]
 
-// compile-flags: -D type-limits
+// compile-flags: -D unused-comparisons
 fn main() { }
 
 fn foo() {
diff --git a/src/test/compile-fail/warn-path-statement.rs b/src/test/compile-fail/warn-path-statement.rs
index 304900df776..d205e2a2e4e 100644
--- a/src/test/compile-fail/warn-path-statement.rs
+++ b/src/test/compile-fail/warn-path-statement.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -D path-statement
+// compile-flags: -D path-statements
 fn main() {
 
     let x = 10is;
diff --git a/src/test/run-pass/crate-name-attr-used.rs b/src/test/run-pass/crate-name-attr-used.rs
index 95c7d331264..f04a760e5f6 100644
--- a/src/test/run-pass/crate-name-attr-used.rs
+++ b/src/test/run-pass/crate-name-attr-used.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:--crate-name crate-name-attr-used -F unused-attribute
+// compile-flags:--crate-name crate-name-attr-used -F unused-attributes
 
 #![crate_name = "crate-name-attr-used"]
 
diff --git a/src/test/run-pass/warn-ctypes-inhibit.rs b/src/test/run-pass/warn-ctypes-inhibit.rs
index 93112e3e7ec..73121918259 100644
--- a/src/test/run-pass/warn-ctypes-inhibit.rs
+++ b/src/test/run-pass/warn-ctypes-inhibit.rs
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-D ctypes
+// compile-flags:-D improper-ctypes
 
-#![allow(ctypes)]
+#![allow(improper_ctypes)]
 
 mod libc {
     extern {