Merge commit '0113bc9388' into sync-from-ra

This commit is contained in:
Laurențiu Nicola 2024-02-04 10:37:58 +02:00
parent f43cea0878
commit b8a3180a60
197 changed files with 3106 additions and 2007 deletions

View file

@ -113,7 +113,7 @@ impl ProcMacroServer {
}
pub fn load_dylib(&self, dylib: MacroDylib) -> Result<Vec<ProcMacro>, ServerError> {
let _p = profile::span("ProcMacroClient::load_dylib");
let _p = tracing::span!(tracing::Level::INFO, "ProcMacroClient::load_dylib").entered();
let macros =
self.process.lock().unwrap_or_else(|e| e.into_inner()).find_proc_macros(&dylib.path)?;
@ -184,7 +184,7 @@ impl ProcMacro {
.process
.lock()
.unwrap_or_else(|e| e.into_inner())
.send_task(msg::Request::ExpandMacro(task))?;
.send_task(msg::Request::ExpandMacro(Box::new(task)))?;
match response {
msg::Response::ExpandMacro(it) => {

View file

@ -29,7 +29,7 @@ pub enum Request {
/// Since [`NO_VERSION_CHECK_VERSION`]
ListMacros { dylib_path: PathBuf },
/// Since [`NO_VERSION_CHECK_VERSION`]
ExpandMacro(ExpandMacro),
ExpandMacro(Box<ExpandMacro>),
/// Since [`VERSION_CHECK_VERSION`]
ApiVersionCheck {},
/// Since [`RUST_ANALYZER_SPAN_SUPPORT`]

View file

@ -106,9 +106,9 @@ fn read_section<'a>(dylib_binary: &'a [u8], section_name: &str) -> io::Result<&'
/// <https://github.com/rust-lang/rust-analyzer/issues/6174>
pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> {
let dylib_file = File::open(dylib_path)?;
let dylib_mmaped = unsafe { Mmap::map(&dylib_file) }?;
let dylib_mmapped = unsafe { Mmap::map(&dylib_file) }?;
let dot_rustc = read_section(&dylib_mmaped, ".rustc")?;
let dot_rustc = read_section(&dylib_mmapped, ".rustc")?;
// check if magic is valid
if &dot_rustc[0..4] != b"rust" {