Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalathar
Rollup of 17 pull requests Successful merges: - #138374 (Enable contracts for const functions) - #138380 (ci: add runners for vanilla LLVM 20) - #138393 (Allow const patterns of matches to contain pattern types) - #139517 (std: sys: process: uefi: Use NULL stdin by default) - #139554 (std: add Output::exit_ok) - #139660 (compiletest: Add an experimental new executor to replace libtest) - #139669 (Overhaul `AssocItem`) - #139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}) - #139750 (std/thread: Use default stack size from menuconfig for NuttX) - #139772 (Remove `hir::Map`) - #139785 (Let CStrings be either 1 or 2 byte aligned.) - #139789 (do not unnecessarily leak auto traits in item bounds) - #139791 (drop global where-bounds before merging candidates) - #139798 (normalize: prefer `ParamEnv` over `AliasBound` candidates) - #139822 (Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix) - #139833 (Fix some HIR pretty-printing problems) - #139836 (Basic tests of MPMC receiver cloning) r? `@ghost` `@rustbot` modify labels: rollup
bors 2025-04-15
parent 3872119 · parent 2305789 · commit 97b5caa
-rw-r--r--crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs29
-rw-r--r--crates/proc-macro-srv/src/server_impl/token_id.rs22
-rw-r--r--crates/proc-macro-srv/src/tests/mod.rs2
3 files changed, 15 insertions, 38 deletions
diff --git a/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs b/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
index 59293ee3f9..80f6d85a3d 100644
--- a/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
+++ b/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
@@ -11,7 +11,7 @@ use std::{
use intern::Symbol;
use proc_macro::bridge::{self, server};
-use span::{FileId, Span, FIXUP_ERASED_FILE_AST_ID_MARKER};
+use span::{Span, FIXUP_ERASED_FILE_AST_ID_MARKER};
use tt::{TextRange, TextSize};
use crate::server_impl::{literal_kind_to_internal, token_stream::TokenStreamBuilder, TopSubtree};
@@ -27,10 +27,6 @@ mod tt {
type TokenStream = crate::server_impl::TokenStream<Span>;
-#[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub struct SourceFile {
- file_id: FileId,
-}
pub struct FreeFunctions;
pub struct RaSpanServer {
@@ -46,7 +42,6 @@ pub struct RaSpanServer {
impl server::Types for RaSpanServer {
type FreeFunctions = FreeFunctions;
type TokenStream = TokenStream;
- type SourceFile = SourceFile;
type Span = Span;
type Symbol = Symbol;
}
@@ -245,25 +240,17 @@ impl server::TokenStream for RaSpanServer {
}
}
-impl server::SourceFile for RaSpanServer {
- fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool {
- file1 == file2
- }
- fn path(&mut self, _file: &Self::SourceFile) -> String {
- // FIXME
- String::new()
- }
- fn is_real(&mut self, _file: &Self::SourceFile) -> bool {
- true
- }
-}
-
impl server::Span for RaSpanServer {
fn debug(&mut self, span: Self::Span) -> String {
format!("{:?}", span)
}
- fn source_file(&mut self, span: Self::Span) -> Self::SourceFile {
- SourceFile { file_id: span.anchor.file_id.file_id() }
+ fn file(&mut self, _: Self::Span) -> String {
+ // FIXME
+ String::new()
+ }
+ fn local_file(&mut self, _: Self::Span) -> Option<String> {
+ // FIXME
+ None
}
fn save_span(&mut self, _span: Self::Span) -> usize {
// FIXME, quote is incompatible with third-party tools
diff --git a/crates/proc-macro-srv/src/server_impl/token_id.rs b/crates/proc-macro-srv/src/server_impl/token_id.rs
index 409cf3cc78..4d7c7c4676 100644
--- a/crates/proc-macro-srv/src/server_impl/token_id.rs
+++ b/crates/proc-macro-srv/src/server_impl/token_id.rs
@@ -24,8 +24,6 @@ type Literal = tt::Literal;
type Span = tt::TokenId;
type TokenStream = crate::server_impl::TokenStream<Span>;
-#[derive(Clone)]
-pub struct SourceFile;
pub struct FreeFunctions;
pub struct TokenIdServer {
@@ -37,7 +35,6 @@ pub struct TokenIdServer {
impl server::Types for TokenIdServer {
type FreeFunctions = FreeFunctions;
type TokenStream = TokenStream;
- type SourceFile = SourceFile;
type Span = Span;
type Symbol = Symbol;
}
@@ -223,24 +220,15 @@ impl server::TokenStream for TokenIdServer {
}
}
-impl server::SourceFile for TokenIdServer {
- fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool {
- true
- }
- fn path(&mut self, _file: &Self::SourceFile) -> String {
- String::new()
- }
- fn is_real(&mut self, _file: &Self::SourceFile) -> bool {
- true
- }
-}
-
impl server::Span for TokenIdServer {
fn debug(&mut self, span: Self::Span) -> String {
format!("{:?}", span.0)
}
- fn source_file(&mut self, _span: Self::Span) -> Self::SourceFile {
- SourceFile {}
+ fn file(&mut self, _span: Self::Span) -> String {
+ String::new()
+ }
+ fn local_file(&mut self, _span: Self::Span) -> Option<String> {
+ None
}
fn save_span(&mut self, _span: Self::Span) -> usize {
0
diff --git a/crates/proc-macro-srv/src/tests/mod.rs b/crates/proc-macro-srv/src/tests/mod.rs
index 15de88ea65..4bd365be7c 100644
--- a/crates/proc-macro-srv/src/tests/mod.rs
+++ b/crates/proc-macro-srv/src/tests/mod.rs
@@ -97,6 +97,7 @@ fn test_fn_like_macro_clone_raw_ident() {
}
#[test]
+#[cfg(not(bootstrap))]
fn test_fn_like_fn_like_span_join() {
assert_expand(
"fn_like_span_join",
@@ -111,6 +112,7 @@ fn test_fn_like_fn_like_span_join() {
}
#[test]
+#[cfg(not(bootstrap))]
fn test_fn_like_fn_like_span_ops() {
assert_expand(
"fn_like_span_ops",