-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Figure out why x.py test --stage 0 rust-analyzer
doesn't work
#99610
Comments
fix here: diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 7c37621d417..0f20b74bcb4 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -250,6 +250,15 @@ pub fn prepare_tool_cargo(
}
}
+ if path.ends_with("rust-analyzer") {
+ // RA wants to load proc macros at runtime for one of its tests. But by default, proc macros
+ // are built with the beta proc_macro, not the in-tree proc_macro. Explicitly override this
+ // in the rustc shim.
+ // This is ok because rust-analyzer is `Mode::ToolStd`, so proc_macro is always built before.
+ cargo.rustflag("--sysroot");
+ cargo.rustflag(builder.sysroot(compiler).as_os_str().to_str().unwrap());
+ }
+
// clippy tests need to know about the stage sysroot. Set them consistently while building to
// avoid rebuilding when running tests.
cargo.env("SYSROOT", builder.sysroot(compiler)); will try to write this up more thoroughly soon |
Oh fun, this isn't possible to test unless the proc-macro ABI changed in the last release 🤦 |
This no longer seems to be a problem. Tested on HEAD: f736079
running 13 tests
.............
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.27ms
finished in 9.789 seconds |
you need to combine it with a breaking change to the proc macro lib format in the same release cycle. maybe that's rare enough this isn't worth worrying about? |
Sounds similar to #119172 (comment) problem (when public api changes on compiler crates, ra fails to build).
I think so |
kinda, but in this case a sync will only fix it for stage 1, not for stage 0 |
(This issue only makes sense after #99603 lands)
@jyn514 is convinced it should if the proper sysroot is used to compile both the
proc-macro-srv
andproc-macro-test-impl
crates.There's one nested invocation of rustc in
proc-macro-srv
's build script, but it uses$RUSTC
(all it does is grab the trimmed output ofrustc -v
).There's one nested invocation of cargo in
proc-macro-test
's build script (to buildproc-macro-test-impl
in a temp dir), but it uses$CARGO
.Here's the output of
./x.py test --stage 0 -vv rust-analyzer --test-args like_macro_clone_literals
: https://gist.github.com/fasterthanlime/3de46b62906d0762c8c3ac0e295892a4The text was updated successfully, but these errors were encountered: