Resolve 2015 style imports

This commit is contained in:
Florian Diebold 2019-02-11 23:11:12 +01:00
parent 3a9934e2c3
commit d5ad38cbb8
4 changed files with 119 additions and 9 deletions

View file

@ -119,6 +119,10 @@ impl CrateGraph {
self.arena[&crate_id].file_id
}
pub fn edition(&self, crate_id: CrateId) -> Edition {
self.arena[&crate_id].edition
}
// TODO: this only finds one crate with the given root; we could have multiple
pub fn crate_id_for_crate_root(&self, file_id: FileId) -> Option<CrateId> {
let (&crate_id, _) = self.arena.iter().find(|(_crate_id, data)| data.file_id == file_id)?;