Skip to content

Commit 12ee1b9

Browse files
committed
---
yaml --- r: 277476 b: refs/heads/try c: 6da1153 h: refs/heads/master
1 parent 71c272d commit 12ee1b9

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 82e0dd5ac1166426f4b1b91cc184ae3797842467
4+
refs/heads/try: 6da115374ffd344f9bc748df36a50b55e61b4ea8
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_resolve/lib.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ pub struct ModuleS<'a> {
829829
globs: RefCell<Vec<&'a ImportDirective<'a>>>,
830830

831831
// Used to memoize the traits in this module for faster searches through all traits in scope.
832-
traits: RefCell<Option<Box<[&'a NameBinding<'a>]>>>,
832+
traits: RefCell<Option<Box<[(Name, &'a NameBinding<'a>)]>>>,
833833

834834
// Whether this module is populated. If not populated, any attempt to
835835
// access the children must be preceded with a
@@ -1234,14 +1234,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
12341234
self.glob_map.insert(directive.id, new_set);
12351235
}
12361236

1237-
fn get_trait_name(&self, did: DefId) -> Name {
1238-
if let Some(node_id) = self.ast_map.as_local_node_id(did) {
1239-
self.ast_map.expect_item(node_id).name
1240-
} else {
1241-
self.session.cstore.item_name(did)
1242-
}
1243-
}
1244-
12451237
/// Resolves the given module path from the given root `module_`.
12461238
fn resolve_module_path_from_root(&mut self,
12471239
module_: Module<'a>,
@@ -3146,20 +3138,19 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
31463138
let mut traits = module.traits.borrow_mut();
31473139
if traits.is_none() {
31483140
let mut collected_traits = Vec::new();
3149-
module.for_each_child(|_, ns, binding| {
3141+
module.for_each_child(|name, ns, binding| {
31503142
if ns != TypeNS { return }
31513143
if let Some(Def::Trait(_)) = binding.def() {
3152-
collected_traits.push(binding);
3144+
collected_traits.push((name, binding));
31533145
}
31543146
});
31553147
*traits = Some(collected_traits.into_boxed_slice());
31563148
}
31573149

3158-
for binding in traits.as_ref().unwrap().iter() {
3150+
for &(trait_name, binding) in traits.as_ref().unwrap().iter() {
31593151
let trait_def_id = binding.def().unwrap().def_id();
31603152
if self.trait_item_map.contains_key(&(name, trait_def_id)) {
31613153
add_trait_info(&mut found_traits, trait_def_id, name);
3162-
let trait_name = self.get_trait_name(trait_def_id);
31633154
self.record_use(trait_name, TypeNS, binding);
31643155
}
31653156
}

0 commit comments

Comments
 (0)