handling fallout from entry api
This commit is contained in:
parent
8e58f3088b
commit
fe8a413fc0
14 changed files with 99 additions and 44 deletions
|
|
@ -24,6 +24,7 @@ use plugin::load::PluginMetadata;
|
|||
|
||||
use std::rc::Rc;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hashmap::{Occupied, Vacant};
|
||||
use syntax::ast;
|
||||
use syntax::abi;
|
||||
use syntax::attr;
|
||||
|
|
@ -82,7 +83,10 @@ fn dump_crates(cstore: &CStore) {
|
|||
fn warn_if_multiple_versions(diag: &SpanHandler, cstore: &CStore) {
|
||||
let mut map = HashMap::new();
|
||||
cstore.iter_crate_data(|cnum, data| {
|
||||
map.find_or_insert_with(data.name(), |_| Vec::new()).push(cnum);
|
||||
match map.entry(data.name()) {
|
||||
Vacant(entry) => { entry.set(vec![cnum]); },
|
||||
Occupied(mut entry) => { entry.get_mut().push(cnum); },
|
||||
}
|
||||
});
|
||||
|
||||
for (name, dupes) in map.into_iter() {
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ use std::slice;
|
|||
use std::string;
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::hashmap::{Occupied, Vacant};
|
||||
use flate;
|
||||
use time;
|
||||
|
||||
|
|
@ -428,15 +429,18 @@ impl<'a> Context<'a> {
|
|||
return FileDoesntMatch
|
||||
};
|
||||
info!("lib candidate: {}", path.display());
|
||||
let slot = candidates.find_or_insert_with(hash.to_string(), |_| {
|
||||
(HashSet::new(), HashSet::new())
|
||||
});
|
||||
|
||||
let slot = match candidates.entry(hash.to_string()) {
|
||||
Occupied(entry) => entry.into_mut(),
|
||||
Vacant(entry) => entry.set((HashSet::new(), HashSet::new())),
|
||||
};
|
||||
let (ref mut rlibs, ref mut dylibs) = *slot;
|
||||
if rlib {
|
||||
rlibs.insert(fs::realpath(path).unwrap());
|
||||
} else {
|
||||
dylibs.insert(fs::realpath(path).unwrap());
|
||||
}
|
||||
|
||||
FileMatches
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue