Skip to content

Commit 15fdb95

Browse files
bors[bot]Jonas Schievink
and
Jonas Schievink
authored
Merge #11802
11802: fix: add stubs to make proc macros work that use the `SourceFile` API r=jonas-schievink a=jonas-schievink Helps with the rocket 0.4 macros, at least on some Rust versions. Fixes #11264 bors r+ Co-authored-by: Jonas Schievink <[email protected]>
2 parents 75fada4 + ef8365b commit 15fdb95

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

crates/proc_macro_srv/src/abis/abi_1_58/rustc_server.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,13 @@ impl Extend<TokenStream> for TokenStream {
9797
}
9898
}
9999

100+
#[derive(Clone)]
101+
pub struct SourceFile {
102+
// FIXME stub
103+
}
104+
100105
type Level = super::proc_macro::Level;
101106
type LineColumn = super::proc_macro::LineColumn;
102-
type SourceFile = super::proc_macro::SourceFile;
103107

104108
/// A structure representing a diagnostic message and associated children
105109
/// messages.
@@ -594,16 +598,15 @@ impl server::Literal for Rustc {
594598
}
595599

596600
impl server::SourceFile for Rustc {
597-
fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool {
598-
file1.eq(file2)
601+
// FIXME these are all stubs
602+
fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool {
603+
true
599604
}
600-
fn path(&mut self, file: &Self::SourceFile) -> String {
601-
String::from(
602-
file.path().to_str().expect("non-UTF8 file path in `proc_macro::SourceFile::path`"),
603-
)
605+
fn path(&mut self, _file: &Self::SourceFile) -> String {
606+
String::new()
604607
}
605-
fn is_real(&mut self, file: &Self::SourceFile) -> bool {
606-
file.is_real()
608+
fn is_real(&mut self, _file: &Self::SourceFile) -> bool {
609+
true
607610
}
608611
}
609612

@@ -646,8 +649,7 @@ impl server::Span for Rustc {
646649
tt::TokenId::unspecified()
647650
}
648651
fn source_file(&mut self, _span: Self::Span) -> Self::SourceFile {
649-
// let MySpanData(span) = self.span_interner.get(span.0);
650-
unimplemented!()
652+
SourceFile {}
651653
}
652654
fn save_span(&mut self, _span: Self::Span) -> usize {
653655
// FIXME stub

0 commit comments

Comments
 (0)