Skip to content

Commit b9db3c1

Browse files
committed
---
yaml --- r: 277867 b: refs/heads/auto c: 6da1153 h: refs/heads/master i: 277865: a7d1513 277863: b5b7d5f
1 parent 8a7663f commit b9db3c1

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
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 82e0dd5ac1166426f4b1b91cc184ae3797842467
11+
refs/heads/auto: 6da115374ffd344f9bc748df36a50b55e61b4ea8
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/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)