diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-03-23 20:58:45 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-23 20:58:45 +0000 |
| commit | 15fdb9518359f648c184197626fd77f08a0f8581 (patch) | |
| tree | ea73bcd77e2fde827e620cf733bc9f5e7355d6a0 | |
| parent | 75fada4aabdc15d87fe7b63a98d4ce5410ea30f9 (diff) | |
| parent | ef8365b1aeace39a3d7cb26c1572210680395fbf (diff) | |
| download | rust-15fdb9518359f648c184197626fd77f08a0f8581.tar.gz rust-15fdb9518359f648c184197626fd77f08a0f8581.zip | |
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 https://github.com/rust-analyzer/rust-analyzer/issues/11264 bors r+ Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
| -rw-r--r-- | crates/proc_macro_srv/src/abis/abi_1_58/rustc_server.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/crates/proc_macro_srv/src/abis/abi_1_58/rustc_server.rs b/crates/proc_macro_srv/src/abis/abi_1_58/rustc_server.rs index 6c57ac92dc6..5c596bc0e62 100644 --- a/crates/proc_macro_srv/src/abis/abi_1_58/rustc_server.rs +++ b/crates/proc_macro_srv/src/abis/abi_1_58/rustc_server.rs @@ -97,9 +97,13 @@ impl Extend<TokenStream> for TokenStream { } } +#[derive(Clone)] +pub struct SourceFile { + // FIXME stub +} + type Level = super::proc_macro::Level; type LineColumn = super::proc_macro::LineColumn; -type SourceFile = super::proc_macro::SourceFile; /// A structure representing a diagnostic message and associated children /// messages. @@ -594,16 +598,15 @@ impl server::Literal for Rustc { } impl server::SourceFile for Rustc { - fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool { - file1.eq(file2) + // FIXME these are all stubs + fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool { + true } - fn path(&mut self, file: &Self::SourceFile) -> String { - String::from( - file.path().to_str().expect("non-UTF8 file path in `proc_macro::SourceFile::path`"), - ) + fn path(&mut self, _file: &Self::SourceFile) -> String { + String::new() } - fn is_real(&mut self, file: &Self::SourceFile) -> bool { - file.is_real() + fn is_real(&mut self, _file: &Self::SourceFile) -> bool { + true } } @@ -646,8 +649,7 @@ impl server::Span for Rustc { tt::TokenId::unspecified() } fn source_file(&mut self, _span: Self::Span) -> Self::SourceFile { - // let MySpanData(span) = self.span_interner.get(span.0); - unimplemented!() + SourceFile {} } fn save_span(&mut self, _span: Self::Span) -> usize { // FIXME stub |
