mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Keep track of crate edition
This commit is contained in:
parent
1526eb25c9
commit
3a9934e2c3
8 changed files with 44 additions and 24 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue