Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny fixes: enum style, typo and --pretty flowgraph errors #14326

Merged
merged 3 commits into from
May 21, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/librustc/driver/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub struct Options {
pub gc: bool,
pub optimize: OptLevel,
pub debuginfo: DebugInfoLevel,
pub lint_opts: Vec<(lint::Lint, lint::level)> ,
pub lint_opts: Vec<(lint::Lint, lint::Level)> ,
pub output_types: Vec<back::link::OutputType> ,
// This was mutable for rustpkg, which updates search paths based on the
// parsed code. It remains mutable in case its replacements wants to use
Expand Down Expand Up @@ -580,8 +580,8 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
let no_trans = matches.opt_present("no-trans");
let no_analysis = matches.opt_present("no-analysis");

let lint_levels = [lint::allow, lint::warn,
lint::deny, lint::forbid];
let lint_levels = [lint::Allow, lint::Warn,
lint::Deny, lint::Forbid];
let mut lint_opts = Vec::new();
let lint_dict = lint::get_lint_dict();
for level in lint_levels.iter() {
Expand Down
18 changes: 14 additions & 4 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
krate = time(time_passes, "prelude injection", krate, |krate|
front::std_inject::maybe_inject_prelude(sess, krate));

let (krate, map) = time(time_passes, "assinging node ids and indexing ast", krate, |krate|
let (krate, map) = time(time_passes, "assigning node ids and indexing ast", krate, |krate|
front::assign_node_ids_and_map::assign_node_ids_and_map(sess, krate));

if sess.opts.debugging_opts & config::AST_JSON != 0 {
Expand Down Expand Up @@ -653,11 +653,22 @@ pub fn pretty_print_input(sess: Session,
PpmFlowGraph(nodeid) => {
let ast_map = ast_map.expect("--pretty flowgraph missing ast_map");
let node = ast_map.find(nodeid).unwrap_or_else(|| {
fail!("--pretty flowgraph=id couldn't find id: {}", id)
sess.fatal(format_strbuf!("--pretty flowgraph couldn't find id: {}",
nodeid).as_slice())
});
let block = match node {
syntax::ast_map::NodeBlock(block) => block,
_ => fail!("--pretty=flowgraph needs block, got {:?}", node)
_ => {
let message = format_strbuf!("--pretty=flowgraph needs block, got {:?}",
node);

// point to what was found, if there's an
// accessible span.
match ast_map.opt_span(nodeid) {
Some(sp) => sess.span_fatal(sp, message.as_slice()),
None => sess.fatal(message.as_slice())
}
}
};
let analysis = phase_3_run_analysis_passes(sess, &krate, ast_map);
print_flowgraph(analysis, block, out)
Expand Down Expand Up @@ -846,4 +857,3 @@ pub fn build_output_filenames(input: &Input,
}
}
}

9 changes: 5 additions & 4 deletions src/librustc/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,12 @@ pub fn parse_pretty(sess: &Session, name: &str) -> PpMode {
(None, "typed") => PpmTyped,
(None, "expanded,identified") => PpmExpandedIdentified,
(None, "identified") => PpmIdentified,
(Some(s), "flowgraph") => {
match from_str(s) {
(arg, "flowgraph") => {
match arg.and_then(from_str) {
Some(id) => PpmFlowGraph(id),
None => sess.fatal(format!("`pretty flowgraph=<nodeid>` needs \
an integer <nodeid>; got {}", s))
None => sess.fatal(format_strbuf!("`pretty flowgraph=<nodeid>` needs \
an integer <nodeid>; got {}",
arg.unwrap_or("nothing")).as_slice())
}
}
_ => {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// closely. The idea is that all reachable symbols are live, codes called
// from live codes are live, and everything else is dead.

use middle::lint::{allow, contains_lint, DeadCode};
use middle::lint::{Allow, contains_lint, DeadCode};
use middle::privacy;
use middle::ty;
use middle::typeck;
Expand Down Expand Up @@ -195,7 +195,7 @@ impl<'a> Visitor<()> for MarkSymbolVisitor<'a> {
}

fn has_allow_dead_code_or_lang_attr(attrs: &[ast::Attribute]) -> bool {
contains_lint(attrs, allow, DEAD_CODE_LINT_STR)
contains_lint(attrs, Allow, DEAD_CODE_LINT_STR)
|| attr::contains_name(attrs.as_slice(), "lang")
}

Expand Down
Loading