Remove PpAstTreeMode.
It's simpler to distinguish the two AST modes directly in `PpMode`.
This commit is contained in:
parent
87090a97e3
commit
1467ba06b6
@ -8,7 +8,7 @@
|
|||||||
use rustc_middle::hir::map as hir_map;
|
use rustc_middle::hir::map as hir_map;
|
||||||
use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty};
|
use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty};
|
||||||
use rustc_middle::ty::{self, TyCtxt};
|
use rustc_middle::ty::{self, TyCtxt};
|
||||||
use rustc_session::config::{OutFileName, PpAstTreeMode, PpHirMode, PpMode, PpSourceMode};
|
use rustc_session::config::{OutFileName, PpHirMode, PpMode, PpSourceMode};
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_span::symbol::Ident;
|
use rustc_span::symbol::Ident;
|
||||||
use rustc_span::FileName;
|
use rustc_span::FileName;
|
||||||
@ -382,7 +382,7 @@ pub fn print_after_parsing(sess: &Session, krate: &ast::Crate, ppm: PpMode) {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
AstTree(PpAstTreeMode::Normal) => {
|
AstTree => {
|
||||||
debug!("pretty printing AST tree");
|
debug!("pretty printing AST tree");
|
||||||
format!("{krate:#?}")
|
format!("{krate:#?}")
|
||||||
}
|
}
|
||||||
@ -420,7 +420,7 @@ pub fn print_after_hir_lowering<'tcx>(tcx: TyCtxt<'tcx>, ppm: PpMode) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
AstTree(PpAstTreeMode::Expanded) => {
|
AstTreeExpanded => {
|
||||||
debug!("pretty-printing expanded AST");
|
debug!("pretty-printing expanded AST");
|
||||||
format!("{:#?}", tcx.resolver_for_lowering(()).borrow().1)
|
format!("{:#?}", tcx.resolver_for_lowering(()).borrow().1)
|
||||||
}
|
}
|
||||||
|
@ -2925,8 +2925,8 @@ fn parse_pretty(handler: &EarlyErrorHandler, unstable_opts: &UnstableOptions) ->
|
|||||||
"expanded" => Source(PpSourceMode::Expanded),
|
"expanded" => Source(PpSourceMode::Expanded),
|
||||||
"expanded,identified" => Source(PpSourceMode::ExpandedIdentified),
|
"expanded,identified" => Source(PpSourceMode::ExpandedIdentified),
|
||||||
"expanded,hygiene" => Source(PpSourceMode::ExpandedHygiene),
|
"expanded,hygiene" => Source(PpSourceMode::ExpandedHygiene),
|
||||||
"ast-tree" => AstTree(PpAstTreeMode::Normal),
|
"ast-tree" => AstTree,
|
||||||
"ast-tree,expanded" => AstTree(PpAstTreeMode::Expanded),
|
"ast-tree,expanded" => AstTreeExpanded,
|
||||||
"hir" => Hir(PpHirMode::Normal),
|
"hir" => Hir(PpHirMode::Normal),
|
||||||
"hir,identified" => Hir(PpHirMode::Identified),
|
"hir,identified" => Hir(PpHirMode::Identified),
|
||||||
"hir,typed" => Hir(PpHirMode::Typed),
|
"hir,typed" => Hir(PpHirMode::Typed),
|
||||||
@ -3083,14 +3083,6 @@ pub enum PpSourceMode {
|
|||||||
ExpandedHygiene,
|
ExpandedHygiene,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
|
||||||
pub enum PpAstTreeMode {
|
|
||||||
/// `-Zunpretty=ast`
|
|
||||||
Normal,
|
|
||||||
/// `-Zunpretty=ast,expanded`
|
|
||||||
Expanded,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||||
pub enum PpHirMode {
|
pub enum PpHirMode {
|
||||||
/// `-Zunpretty=hir`
|
/// `-Zunpretty=hir`
|
||||||
@ -3106,7 +3098,10 @@ pub enum PpMode {
|
|||||||
/// Options that print the source code, i.e.
|
/// Options that print the source code, i.e.
|
||||||
/// `-Zunpretty=normal` and `-Zunpretty=expanded`
|
/// `-Zunpretty=normal` and `-Zunpretty=expanded`
|
||||||
Source(PpSourceMode),
|
Source(PpSourceMode),
|
||||||
AstTree(PpAstTreeMode),
|
/// `-Zunpretty=ast-tree`
|
||||||
|
AstTree,
|
||||||
|
/// `-Zunpretty=ast-tree,expanded`
|
||||||
|
AstTreeExpanded,
|
||||||
/// Options that print the HIR, i.e. `-Zunpretty=hir`
|
/// Options that print the HIR, i.e. `-Zunpretty=hir`
|
||||||
Hir(PpHirMode),
|
Hir(PpHirMode),
|
||||||
/// `-Zunpretty=hir-tree`
|
/// `-Zunpretty=hir-tree`
|
||||||
@ -3126,10 +3121,10 @@ pub fn needs_ast_map(&self) -> bool {
|
|||||||
use PpMode::*;
|
use PpMode::*;
|
||||||
use PpSourceMode::*;
|
use PpSourceMode::*;
|
||||||
match *self {
|
match *self {
|
||||||
Source(Normal | Identified) | AstTree(PpAstTreeMode::Normal) => false,
|
Source(Normal | Identified) | AstTree => false,
|
||||||
|
|
||||||
Source(Expanded | ExpandedIdentified | ExpandedHygiene)
|
Source(Expanded | ExpandedIdentified | ExpandedHygiene)
|
||||||
| AstTree(PpAstTreeMode::Expanded)
|
| AstTreeExpanded
|
||||||
| Hir(_)
|
| Hir(_)
|
||||||
| HirTree
|
| HirTree
|
||||||
| ThirTree
|
| ThirTree
|
||||||
@ -3141,7 +3136,7 @@ pub fn needs_ast_map(&self) -> bool {
|
|||||||
pub fn needs_hir(&self) -> bool {
|
pub fn needs_hir(&self) -> bool {
|
||||||
use PpMode::*;
|
use PpMode::*;
|
||||||
match *self {
|
match *self {
|
||||||
Source(_) | AstTree(_) => false,
|
Source(_) | AstTree | AstTreeExpanded => false,
|
||||||
|
|
||||||
Hir(_) | HirTree | ThirTree | ThirFlat | Mir | MirCFG => true,
|
Hir(_) | HirTree | ThirTree | ThirFlat | Mir | MirCFG => true,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user