Keep track of crate edition

This commit is contained in:
Florian Diebold 2019-02-10 22:34:29 +01:00
parent 1526eb25c9
commit 3a9934e2c3
8 changed files with 44 additions and 24 deletions

View file

@ -35,6 +35,7 @@ struct PackageData {
targets: Vec<Target>,
is_member: bool,
dependencies: Vec<PackageDependency>,
edition: String,
}
#[derive(Debug, Clone)]
@ -84,6 +85,9 @@ impl Package {
pub fn root(self, ws: &CargoWorkspace) -> &Path {
ws.packages[self].manifest.parent().unwrap()
}
pub fn edition(self, ws: &CargoWorkspace) -> &str {
&ws.packages[self].edition
}
pub fn targets<'a>(self, ws: &'a CargoWorkspace) -> impl Iterator<Item = Target> + 'a {
ws.packages[self].targets.iter().cloned()
}
@ -135,6 +139,7 @@ impl CargoWorkspace {
manifest: meta_pkg.manifest_path.clone(),
targets: Vec::new(),
is_member,
edition: meta_pkg.edition,
dependencies: Vec::new(),
});
let pkg_data = &mut packages[pkg];