Skip to content

Commit a1aad7c

Browse files
committed
Don't run proc-macro-srv tests on the rust-analyzer repo
proc-macro ABI breakage still affects the tests when a new stable version releases. Ideally we'd still be able to run the tests on the rust-analyzer repo without having to update the proc-macro ABI, but for now just to unblock CI we will ignore them here, as they are still run in upstream.
1 parent 5b49745 commit a1aad7c

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

crates/proc-macro-srv/src/abis/abi_sysroot/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ use proc_macro_api::ProcMacroKind;
1111

1212
use super::PanicMessage;
1313

14+
pub use ra_server::TokenStream;
15+
1416
pub(crate) struct Abi {
1517
exported_macros: Vec<proc_macro::bridge::client::ProcMacro>,
1618
}

crates/proc-macro-srv/src/abis/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ mod abi_sysroot;
3232
include!(concat!(env!("OUT_DIR"), "/rustc_version.rs"));
3333

3434
// Used by `test/utils.rs`
35-
#[cfg(test)]
36-
pub(crate) use abi_1_63::TokenStream as TestTokenStream;
35+
#[cfg(all(test, feature = "sysroot-abi"))]
36+
pub(crate) use abi_sysroot::TokenStream as TestTokenStream;
3737

3838
use super::dylib::LoadProcMacroDylibError;
3939
pub(crate) use abi_1_58::Abi as Abi_1_58;
@@ -144,3 +144,10 @@ impl Abi {
144144
}
145145
}
146146
}
147+
148+
#[test]
149+
fn test_version_check() {
150+
let path = paths::AbsPathBuf::assert(crate::proc_macro_test_dylib_path());
151+
let info = proc_macro_api::read_dylib_info(&path).unwrap();
152+
assert!(info.version.1 >= 50);
153+
}

crates/proc-macro-srv/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
mod dylib;
2121
mod abis;
2222

23+
pub mod cli;
24+
2325
use std::{
2426
collections::{hash_map::Entry, HashMap},
2527
env,
@@ -149,7 +151,10 @@ impl EnvSnapshot {
149151
}
150152
}
151153

152-
pub mod cli;
154+
#[cfg(all(feature = "sysroot-abi", test))]
155+
mod tests;
153156

154157
#[cfg(test)]
155-
mod tests;
158+
pub fn proc_macro_test_dylib_path() -> std::path::PathBuf {
159+
proc_macro_test::PROC_MACRO_TEST_LOCATION.into()
160+
}

crates/proc-macro-srv/src/tests/mod.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
33
#[macro_use]
44
mod utils;
5-
use expect_test::expect;
6-
use paths::AbsPathBuf;
75
use utils::*;
86

7+
use expect_test::expect;
8+
99
#[test]
1010
fn test_derive_empty() {
1111
assert_expand("DeriveEmpty", r#"struct S;"#, expect![[r#"SUBTREE $"#]]);
@@ -157,10 +157,3 @@ fn list_test_macros() {
157157
DeriveError [CustomDerive]"#]]
158158
.assert_eq(&res);
159159
}
160-
161-
#[test]
162-
fn test_version_check() {
163-
let path = AbsPathBuf::assert(fixtures::proc_macro_test_dylib_path());
164-
let info = proc_macro_api::read_dylib_info(&path).unwrap();
165-
assert!(info.version.1 >= 50);
166-
}

crates/proc-macro-srv/src/tests/utils.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
//! utils used in proc-macro tests
22
3-
use crate::dylib;
4-
use crate::ProcMacroSrv;
53
use expect_test::Expect;
64
use std::str::FromStr;
75

8-
pub mod fixtures {
9-
pub fn proc_macro_test_dylib_path() -> std::path::PathBuf {
10-
proc_macro_test::PROC_MACRO_TEST_LOCATION.into()
11-
}
12-
}
6+
use crate::{dylib, proc_macro_test_dylib_path, ProcMacroSrv};
137

148
fn parse_string(code: &str) -> Option<crate::abis::TestTokenStream> {
159
// This is a bit strange. We need to parse a string into a token stream into
@@ -30,7 +24,7 @@ pub fn assert_expand_attr(macro_name: &str, ra_fixture: &str, attr_args: &str, e
3024
}
3125

3226
fn assert_expand_impl(macro_name: &str, input: &str, attr: Option<&str>, expect: Expect) {
33-
let path = fixtures::proc_macro_test_dylib_path();
27+
let path = proc_macro_test_dylib_path();
3428
let expander = dylib::Expander::new(&path).unwrap();
3529
let fixture = parse_string(input).unwrap();
3630
let attr = attr.map(|attr| parse_string(attr).unwrap().into_subtree());
@@ -40,7 +34,7 @@ fn assert_expand_impl(macro_name: &str, input: &str, attr: Option<&str>, expect:
4034
}
4135

4236
pub(crate) fn list() -> Vec<String> {
43-
let dylib_path = fixtures::proc_macro_test_dylib_path();
37+
let dylib_path = proc_macro_test_dylib_path();
4438
let mut srv = ProcMacroSrv::default();
4539
let res = srv.list_macros(&dylib_path).unwrap();
4640
res.into_iter().map(|(name, kind)| format!("{} [{:?}]", name, kind)).collect()

crates/rust-analyzer/tests/slow-tests/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,8 @@ fn main() {
821821
}
822822

823823
#[test]
824+
// FIXME: Re-enable once we can run proc-macro tests on rust-lang/rust-analyzer again
825+
#[ignore]
824826
fn resolve_proc_macro() {
825827
if skip_slow_tests() {
826828
return;

0 commit comments

Comments
 (0)