Description
Looks like rust-analyzer
built with --stage=1
will use the proc_macro server from the checkout, but the proc_macro client from beta (stage 0). This "works" "fine" as long as we don't make any changes to the proc macro bridge. But it breaks terribly when we make any changes to the proc_macro interface.
To reproduce:
Make some backwards-incomplatible change to the proc macro bridge communication protocol. For example, in library/proc_macro/src/bridge/rpc.rs
:
@@ -115,13 +115,14 @@ fn decode(_: &mut Reader<'_>, _: &mut S) -> Self {}
impl<S> Encode<S> for u8 {
fn encode(self, w: &mut Writer, _: &mut S) {
w.push(self);
+ w.push(0);
}
}
impl<S> DecodeMut<'_, '_, S> for u8 {
fn decode(r: &mut Reader<'_>, _: &mut S) -> Self {
let x = r[0];
- *r = &r[1..];
+ *r = &r[2..];
x
}
}
And then run
./x.py test src/tools/rust-analyzer --stage=1
Everything panics.
(With --stage=2
, it works fine.)
This is a problem, because we run the r-a tests at --stage=1 as part of CI. This means we currently cannot make any changes to the proc macro bridge (without purposely breaking and disabling tests).
Discovered while trying to merge #139671