diff --git a/Cargo.lock b/Cargo.lock index 19566366f59..eb5d192abb3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,9 +132,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" +checksum = "3abb7553d5b9b8421c6de7cb02606ff15e0c6eea7d8eadd75ef013fd636bec36" dependencies = [ "camino", "cargo-platform", diff --git a/crates/flycheck/Cargo.toml b/crates/flycheck/Cargo.toml index 1fb4f70006b..d3d180ece51 100644 --- a/crates/flycheck/Cargo.toml +++ b/crates/flycheck/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] crossbeam-channel = "0.5.5" tracing = "0.1.35" -cargo_metadata = "0.14.2" +cargo_metadata = "0.15.0" serde = { version = "1.0.137", features = ["derive"] } serde_json = "1.0.81" jod-thread = "0.1.2" diff --git a/crates/proc-macro-test/Cargo.toml b/crates/proc-macro-test/Cargo.toml index 872b2a99d84..684477191b2 100644 --- a/crates/proc-macro-test/Cargo.toml +++ b/crates/proc-macro-test/Cargo.toml @@ -12,4 +12,4 @@ doctest = false [build-dependencies] proc-macro-test-impl = { path = "imp", version = "0.0.0" } toolchain = { path = "../toolchain", version = "0.0.0" } -cargo_metadata = "0.14.2" +cargo_metadata = "0.15.0" diff --git a/crates/project-model/Cargo.toml b/crates/project-model/Cargo.toml index 35465d0861f..84b239b3e29 100644 --- a/crates/project-model/Cargo.toml +++ b/crates/project-model/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] tracing = "0.1.35" rustc-hash = "1.1.0" -cargo_metadata = "0.14.2" +cargo_metadata = "0.15.0" semver = "1.0.10" serde = { version = "1.0.137", features = ["derive"] } serde_json = "1.0.81" diff --git a/crates/project-model/src/cargo_workspace.rs b/crates/project-model/src/cargo_workspace.rs index 76ef44e1471..597880c2ca2 100644 --- a/crates/project-model/src/cargo_workspace.rs +++ b/crates/project-model/src/cargo_workspace.rs @@ -318,10 +318,15 @@ pub fn new(mut meta: cargo_metadata::Metadata) -> CargoWorkspace { .. } = meta_pkg; let meta = from_value::(metadata.clone()).unwrap_or_default(); - let edition = edition.parse::().unwrap_or_else(|err| { - tracing::error!("Failed to parse edition {}", err); - Edition::CURRENT - }); + let edition = match edition { + cargo_metadata::Edition::E2015 => Edition::Edition2015, + cargo_metadata::Edition::E2018 => Edition::Edition2018, + cargo_metadata::Edition::E2021 => Edition::Edition2021, + _ => { + tracing::error!("Unsupported edition `{:?}`", edition); + Edition::CURRENT + } + }; // We treat packages without source as "local" packages. That includes all members of // the current workspace, as well as any path dependency outside the workspace. let is_local = meta_pkg.source.is_none();