Skip to content
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
2 changes: 1 addition & 1 deletion src/librustc/middle/region.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ use front::map as ast_map;
use session::Session;
use util::nodemap::{FnvHashMap, NodeMap, NodeSet};
use middle::cstore::InlinedItem;
use middle::ty::{self, Ty};
use middle::ty;

use std::cell::RefCell;
use std::collections::hash_map::Entry;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_lint/types.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,6 @@ use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
use syntax::{abi, ast};
use syntax::attr::{self, AttrMetaMethods};
use syntax::codemap::{self, Span};
use syntax::ast::{TyIs, TyUs, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};

use rustc_front::hir;
use rustc_front::intravisit::{self, Visitor};
Expand Down
32 changes: 10 additions & 22 deletions src/librustc_resolve/build_reduced_graph.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -142,29 +142,17 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
}

fn block_needs_anonymous_module(&mut self, block: &Block) -> bool {
// Check each statement.
for statement in &block.stmts {
match statement.node {
StmtDecl(ref declaration, _) => {
match declaration.node {
DeclItem(_) => {
return true;
}
_ => {
// Keep searching.
}
}
}
_ => {
// Keep searching.
fn is_item(statement: &hir::Stmt) -> bool {
if let StmtDecl(ref declaration, _) = statement.node {
if let DeclItem(_) = declaration.node {
return true;
}
}
false
}

// If we found no items, we don't need to create
// an anonymous module.

return false;
// If any statements are items, we need to create an anonymous module
block.stmts.iter().any(is_item)
}

/// Constructs the reduced graph for one item.
Expand DownExpand Up@@ -309,7 +297,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
let external_module = self.new_extern_crate_module(parent_link, def);
self.define(parent, name, TypeNS, (external_module, sp));

self.build_reduced_graph_for_external_crate(&external_module);
self.build_reduced_graph_for_external_crate(external_module);
}
parent
}
Expand DownExpand Up@@ -365,7 +353,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
for variant in &(*enum_definition).variants {
let item_def_id = self.ast_map.local_def_id(item.id);
self.build_reduced_graph_for_variant(variant, item_def_id,
&module, variant_modifiers);
module, variant_modifiers);
}
parent
}
Expand DownExpand Up@@ -421,7 +409,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
};

let modifiers = DefModifiers::PUBLIC; // NB: not DefModifiers::IMPORTABLE
self.define(&module_parent, item.name, ns, (def, item.span, modifiers));
self.define(module_parent, item.name, ns, (def, item.span, modifiers));

self.trait_item_map.insert((item.name, def_id), item_def_id);
}
Expand Down
Loading