Rust: fix compilation errors after rust-anlyzer update

This commit is contained in:
Paolo Tranquilli
2025-02-25 13:37:00 +01:00
parent cbae16b392
commit bfcf9ea606
3 changed files with 4 additions and 3 deletions

View File

@@ -106,7 +106,7 @@ impl Config {
let sysroot_src_input = self.sysroot_src.as_ref().map(|p| join_path_buf(dir, p));
match (sysroot_input, sysroot_src_input) {
(None, None) => Sysroot::discover(dir, &self.cargo_extra_env),
(Some(sysroot), None) => Sysroot::discover_sysroot_src_dir(sysroot),
(Some(sysroot), None) => Sysroot::discover_rust_lib_src_dir(sysroot),
(None, Some(sysroot_src)) => {
Sysroot::discover_with_src_override(dir, &self.cargo_extra_env, sysroot_src)
}
@@ -130,7 +130,7 @@ impl Config {
(
CargoConfig {
all_targets: self.cargo_all_targets,
sysroot_src: sysroot.src_root().map(ToOwned::to_owned),
sysroot_src: sysroot.rust_lib_src_root().map(ToOwned::to_owned),
rustc_source: self
.rustc_src
.as_ref()

View File

@@ -297,4 +297,5 @@ pub(crate) fn path_to_file_id(path: &Path, vfs: &Vfs) -> Option<FileId> {
.and_then(|x| AbsPathBuf::try_from(x).ok())
.map(VfsPath::from)
.and_then(|x| vfs.file_id(&x))
.map(|(id, _excluded)| id)
}

View File

@@ -417,7 +417,7 @@ impl<'a> Translator<'a> {
}
}
ItemContainer::Module(it) => self.canonical_path_from_hir_module(it),
ItemContainer::ExternBlock() | ItemContainer::Crate(_) => Some("".to_owned()),
ItemContainer::ExternBlock(..) | ItemContainer::Crate(..) => Some("".to_owned()),
}?;
Some(format!("{prefix}::{name}"))
}