rustc: remove a trait that is unnecessary after pretty move.
The type in the `impl` is now in the module with the trait.
This commit is contained in:
parent
149032aff3
commit
ddc8cc92c9
1 changed files with 21 additions and 31 deletions
|
@ -87,15 +87,33 @@ pub fn parse_pretty(sess: &Session, name: &str) -> (PpMode, Option<UserIdentifie
|
||||||
// (The `use_once_payload` is working around the current lack of once
|
// (The `use_once_payload` is working around the current lack of once
|
||||||
// functions in the compiler.)
|
// functions in the compiler.)
|
||||||
|
|
||||||
trait CratePrinter {
|
impl PpSourceMode {
|
||||||
/// Constructs a `PrinterSupport` object and passes it to `f`.
|
/// Constructs a `PrinterSupport` object and passes it to `f`.
|
||||||
fn call_with_pp_support<A,B>(&self,
|
fn call_with_pp_support<A,B>(&self,
|
||||||
sess: Session,
|
sess: Session,
|
||||||
krate: &ast::Crate,
|
krate: &ast::Crate,
|
||||||
ast_map: Option<ast_map::Map>,
|
ast_map: Option<ast_map::Map>,
|
||||||
id: String,
|
id: String,
|
||||||
use_once_payload: B,
|
payload: B,
|
||||||
f: |&PrinterSupport, B| -> A) -> A;
|
f: |&PrinterSupport, B| -> A) -> A {
|
||||||
|
match *self {
|
||||||
|
PpmNormal | PpmExpanded => {
|
||||||
|
let annotation = NoAnn { sess: sess, ast_map: ast_map };
|
||||||
|
f(&annotation, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
PpmIdentified | PpmExpandedIdentified => {
|
||||||
|
let annotation = IdentifiedAnnotation { sess: sess, ast_map: ast_map };
|
||||||
|
f(&annotation, payload)
|
||||||
|
}
|
||||||
|
PpmTyped => {
|
||||||
|
let ast_map = ast_map.expect("--pretty=typed missing ast_map");
|
||||||
|
let analysis = driver::phase_3_run_analysis_passes(sess, krate, ast_map, id);
|
||||||
|
let annotation = TypedAnnotation { analysis: analysis };
|
||||||
|
f(&annotation, payload)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait SessionCarrier {
|
trait SessionCarrier {
|
||||||
|
@ -339,34 +357,6 @@ impl UserIdentifiedItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CratePrinter for PpSourceMode {
|
|
||||||
fn call_with_pp_support<A,B>(&self,
|
|
||||||
sess: Session,
|
|
||||||
krate: &ast::Crate,
|
|
||||||
ast_map: Option<ast_map::Map>,
|
|
||||||
id: String,
|
|
||||||
payload: B,
|
|
||||||
f: |&PrinterSupport, B| -> A) -> A {
|
|
||||||
match *self {
|
|
||||||
PpmNormal | PpmExpanded => {
|
|
||||||
let annotation = NoAnn { sess: sess, ast_map: ast_map };
|
|
||||||
f(&annotation, payload)
|
|
||||||
}
|
|
||||||
|
|
||||||
PpmIdentified | PpmExpandedIdentified => {
|
|
||||||
let annotation = IdentifiedAnnotation { sess: sess, ast_map: ast_map };
|
|
||||||
f(&annotation, payload)
|
|
||||||
}
|
|
||||||
PpmTyped => {
|
|
||||||
let ast_map = ast_map.expect("--pretty=typed missing ast_map");
|
|
||||||
let analysis = driver::phase_3_run_analysis_passes(sess, krate, ast_map, id);
|
|
||||||
let annotation = TypedAnnotation { analysis: analysis };
|
|
||||||
f(&annotation, payload)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn needs_ast_map(ppm: &PpMode, opt_uii: &Option<UserIdentifiedItem>) -> bool {
|
fn needs_ast_map(ppm: &PpMode, opt_uii: &Option<UserIdentifiedItem>) -> bool {
|
||||||
match *ppm {
|
match *ppm {
|
||||||
PpmSource(PpmNormal) |
|
PpmSource(PpmNormal) |
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue