Remove unstable --pretty
flag
It doesn't do anything `--unpretty` doesn't, and due to a bug, also didn't show up in `--help`. I don't think there's any reason to keep it around, I haven't seen anyone using it.
This commit is contained in:
parent
7f4afdf025
commit
23bbd65d96
8 changed files with 46 additions and 86 deletions
|
@ -1125,15 +1125,6 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
|
||||||
never = never colorize output",
|
never = never colorize output",
|
||||||
"auto|always|never",
|
"auto|always|never",
|
||||||
),
|
),
|
||||||
opt::opt(
|
|
||||||
"",
|
|
||||||
"pretty",
|
|
||||||
"Pretty-print the input instead of compiling;
|
|
||||||
valid types are: `normal` (un-annotated source),
|
|
||||||
`expanded` (crates expanded), or
|
|
||||||
`expanded,identified` (fully parenthesized, AST nodes with IDs).",
|
|
||||||
"TYPE",
|
|
||||||
),
|
|
||||||
opt::multi_s(
|
opt::multi_s(
|
||||||
"",
|
"",
|
||||||
"remap-path-prefix",
|
"remap-path-prefix",
|
||||||
|
@ -1969,7 +1960,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
||||||
|
|
||||||
let remap_path_prefix = parse_remap_path_prefix(matches, error_format);
|
let remap_path_prefix = parse_remap_path_prefix(matches, error_format);
|
||||||
|
|
||||||
let pretty = parse_pretty(matches, &debugging_opts, error_format);
|
let pretty = parse_pretty(&debugging_opts, error_format);
|
||||||
|
|
||||||
if !debugging_opts.unstable_options
|
if !debugging_opts.unstable_options
|
||||||
&& !target_triple.triple().contains("apple")
|
&& !target_triple.triple().contains("apple")
|
||||||
|
@ -2017,32 +2008,26 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_pretty(
|
fn parse_pretty(debugging_opts: &DebuggingOptions, efmt: ErrorOutputType) -> Option<PpMode> {
|
||||||
matches: &getopts::Matches,
|
|
||||||
debugging_opts: &DebuggingOptions,
|
|
||||||
efmt: ErrorOutputType,
|
|
||||||
) -> Option<PpMode> {
|
|
||||||
fn parse_pretty_inner(efmt: ErrorOutputType, name: &str, extended: bool) -> PpMode {
|
|
||||||
use PpMode::*;
|
use PpMode::*;
|
||||||
let first = match (name, extended) {
|
|
||||||
("normal", _) => Source(PpSourceMode::Normal),
|
let first = match debugging_opts.unpretty.as_deref()? {
|
||||||
("identified", _) => Source(PpSourceMode::Identified),
|
"normal" => Source(PpSourceMode::Normal),
|
||||||
("everybody_loops", true) => Source(PpSourceMode::EveryBodyLoops),
|
"identified" => Source(PpSourceMode::Identified),
|
||||||
("expanded", _) => Source(PpSourceMode::Expanded),
|
"everybody_loops" => Source(PpSourceMode::EveryBodyLoops),
|
||||||
("expanded,identified", _) => Source(PpSourceMode::ExpandedIdentified),
|
"expanded" => Source(PpSourceMode::Expanded),
|
||||||
("expanded,hygiene", _) => Source(PpSourceMode::ExpandedHygiene),
|
"expanded,identified" => Source(PpSourceMode::ExpandedIdentified),
|
||||||
("ast-tree", true) => AstTree(PpAstTreeMode::Normal),
|
"expanded,hygiene" => Source(PpSourceMode::ExpandedHygiene),
|
||||||
("ast-tree,expanded", true) => AstTree(PpAstTreeMode::Expanded),
|
"ast-tree" => AstTree(PpAstTreeMode::Normal),
|
||||||
("hir", true) => Hir(PpHirMode::Normal),
|
"ast-tree,expanded" => AstTree(PpAstTreeMode::Expanded),
|
||||||
("hir,identified", true) => Hir(PpHirMode::Identified),
|
"hir" => Hir(PpHirMode::Normal),
|
||||||
("hir,typed", true) => Hir(PpHirMode::Typed),
|
"hir,identified" => Hir(PpHirMode::Identified),
|
||||||
("hir-tree", true) => HirTree,
|
"hir,typed" => Hir(PpHirMode::Typed),
|
||||||
("thir-tree", true) => ThirTree,
|
"hir-tree" => HirTree,
|
||||||
("mir", true) => Mir,
|
"thir-tree" => ThirTree,
|
||||||
("mir-cfg", true) => MirCFG,
|
"mir" => Mir,
|
||||||
_ => {
|
"mir-cfg" => MirCFG,
|
||||||
if extended {
|
name => early_error(
|
||||||
early_error(
|
|
||||||
efmt,
|
efmt,
|
||||||
&format!(
|
&format!(
|
||||||
"argument to `unpretty` must be one of `normal`, \
|
"argument to `unpretty` must be one of `normal`, \
|
||||||
|
@ -2052,34 +2037,10 @@ fn parse_pretty(
|
||||||
`hir,typed`, `hir-tree`, `mir` or `mir-cfg`; got {}",
|
`hir,typed`, `hir-tree`, `mir` or `mir-cfg`; got {}",
|
||||||
name
|
name
|
||||||
),
|
),
|
||||||
);
|
|
||||||
} else {
|
|
||||||
early_error(
|
|
||||||
efmt,
|
|
||||||
&format!(
|
|
||||||
"argument to `pretty` must be one of `normal`, \
|
|
||||||
`expanded`, `identified`, or `expanded,identified`; got {}",
|
|
||||||
name
|
|
||||||
),
|
),
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
tracing::debug!("got unpretty option: {:?}", first);
|
tracing::debug!("got unpretty option: {:?}", first);
|
||||||
first
|
Some(first)
|
||||||
}
|
|
||||||
|
|
||||||
if debugging_opts.unstable_options {
|
|
||||||
if let Some(a) = matches.opt_default("pretty", "normal") {
|
|
||||||
// stable pretty-print variants only
|
|
||||||
return Some(parse_pretty_inner(efmt, &a, false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
debugging_opts.unpretty.as_ref().map(|a| {
|
|
||||||
// extended with unstable pretty-print variants
|
|
||||||
parse_pretty_inner(efmt, &a, true)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn make_crate_type_option() -> RustcOptGroup {
|
pub fn make_crate_type_option() -> RustcOptGroup {
|
||||||
|
@ -2187,17 +2148,17 @@ impl fmt::Display for CrateType {
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||||
pub enum PpSourceMode {
|
pub enum PpSourceMode {
|
||||||
/// `--pretty=normal`
|
/// `-Zunpretty=normal`
|
||||||
Normal,
|
Normal,
|
||||||
/// `-Zunpretty=everybody_loops`
|
/// `-Zunpretty=everybody_loops`
|
||||||
EveryBodyLoops,
|
EveryBodyLoops,
|
||||||
/// `--pretty=expanded`
|
/// `-Zunpretty=expanded`
|
||||||
Expanded,
|
Expanded,
|
||||||
/// `--pretty=identified`
|
/// `-Zunpretty=identified`
|
||||||
Identified,
|
Identified,
|
||||||
/// `--pretty=expanded,identified`
|
/// `-Zunpretty=expanded,identified`
|
||||||
ExpandedIdentified,
|
ExpandedIdentified,
|
||||||
/// `--pretty=expanded,hygiene`
|
/// `-Zunpretty=expanded,hygiene`
|
||||||
ExpandedHygiene,
|
ExpandedHygiene,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2222,7 +2183,7 @@ pub enum PpHirMode {
|
||||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||||
pub enum PpMode {
|
pub enum PpMode {
|
||||||
/// Options that print the source code, i.e.
|
/// Options that print the source code, i.e.
|
||||||
/// `--pretty` and `-Zunpretty=everybody_loops`
|
/// `-Zunpretty=normal` and `-Zunpretty=everybody_loops`
|
||||||
Source(PpSourceMode),
|
Source(PpSourceMode),
|
||||||
AstTree(PpAstTreeMode),
|
AstTree(PpAstTreeMode),
|
||||||
/// Options that print the HIR, i.e. `-Zunpretty=hir`
|
/// Options that print the HIR, i.e. `-Zunpretty=hir`
|
||||||
|
|
|
@ -1189,7 +1189,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
||||||
"take the brakes off const evaluation. NOTE: this is unsound (default: no)"),
|
"take the brakes off const evaluation. NOTE: this is unsound (default: no)"),
|
||||||
unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED],
|
unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED],
|
||||||
"present the input source, unstable (and less-pretty) variants;
|
"present the input source, unstable (and less-pretty) variants;
|
||||||
valid types are any of the types for `--pretty`, as well as:
|
`normal`, `identified`,
|
||||||
`expanded`, `expanded,identified`,
|
`expanded`, `expanded,identified`,
|
||||||
`expanded,hygiene` (with internal representations),
|
`expanded,hygiene` (with internal representations),
|
||||||
`everybody_loops` (all function bodies replaced with `loop {}`),
|
`everybody_loops` (all function bodies replaced with `loop {}`),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// This is meant as a test case for Issue 3961.
|
// This is meant as a test case for Issue 3961.
|
||||||
//
|
//
|
||||||
// Test via: rustc --pretty normal src/test/pretty/block-comment-wchar.rs
|
// Test via: rustc -Zunpretty normal src/test/pretty/block-comment-wchar.rs
|
||||||
// ignore-tidy-cr
|
// ignore-tidy-cr
|
||||||
// ignore-tidy-tab
|
// ignore-tidy-tab
|
||||||
// pp-exact:block-comment-wchar.pp
|
// pp-exact:block-comment-wchar.pp
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// This is meant as a test case for Issue 3961.
|
// This is meant as a test case for Issue 3961.
|
||||||
//
|
//
|
||||||
// Test via: rustc --pretty normal src/test/pretty/block-comment-wchar.rs
|
// Test via: rustc -Zunpretty normal src/test/pretty/block-comment-wchar.rs
|
||||||
// ignore-tidy-cr
|
// ignore-tidy-cr
|
||||||
// ignore-tidy-tab
|
// ignore-tidy-tab
|
||||||
// pp-exact:block-comment-wchar.pp
|
// pp-exact:block-comment-wchar.pp
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
-include ../tools.mk
|
-include ../tools.mk
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(RUSTC) -o $(TMPDIR)/input.expanded.rs -Z unstable-options \
|
$(RUSTC) -o $(TMPDIR)/input.expanded.rs -Zunpretty=expanded input.rs
|
||||||
--pretty=expanded input.rs
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-include ../tools.mk
|
-include ../tools.mk
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(RUSTC) -o $(TMPDIR)/input.out --pretty=normal -Z unstable-options input.rs
|
$(RUSTC) -o $(TMPDIR)/input.out -Zunpretty=normal input.rs
|
||||||
diff -u $(TMPDIR)/input.out input.pp
|
diff -u $(TMPDIR)/input.out input.pp
|
||||||
|
|
|
@ -306,7 +306,7 @@ pub struct TestProps {
|
||||||
// a proc-macro and needs `#![crate_type = "proc-macro"]`. This ensures
|
// a proc-macro and needs `#![crate_type = "proc-macro"]`. This ensures
|
||||||
// that the aux file is compiled as a `proc-macro` and not as a `dylib`.
|
// that the aux file is compiled as a `proc-macro` and not as a `dylib`.
|
||||||
pub no_prefer_dynamic: bool,
|
pub no_prefer_dynamic: bool,
|
||||||
// Run --pretty expanded when running pretty printing tests
|
// Run -Zunpretty expanded when running pretty printing tests
|
||||||
pub pretty_expanded: bool,
|
pub pretty_expanded: bool,
|
||||||
// Which pretty mode are we testing with, default to 'normal'
|
// Which pretty mode are we testing with, default to 'normal'
|
||||||
pub pretty_mode: String,
|
pub pretty_mode: String,
|
||||||
|
|
|
@ -599,7 +599,7 @@ impl<'test> TestCx<'test> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// additionally, run `--pretty expanded` and try to build it.
|
// additionally, run `-Zunpretty=expanded` and try to build it.
|
||||||
let proc_res = self.print_source(ReadFrom::Path, "expanded");
|
let proc_res = self.print_source(ReadFrom::Path, "expanded");
|
||||||
if !proc_res.status.success() {
|
if !proc_res.status.success() {
|
||||||
self.fatal_proc_rec("pretty-printing (expanded) failed", &proc_res);
|
self.fatal_proc_rec("pretty-printing (expanded) failed", &proc_res);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue