-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
9cce744
to
06d5168
Compare
@thomaseizinger looks great! Yeah, I'd love this change. I wonder why it's not compiling though. I found this issue rust-lang/rust#56935 Edit: Oh, I see you referenced that already. |
06d5168
to
592df58
Compare
rust-lang/rust#81498 has been merged, waiting for it to be included in a nightly build and then rustfmt needs to update to that nightly as well. |
592df58
to
5ab53ea
Compare
The PR is included in the recent nightly but it still fails. I assume we would need to patch more crates with the same workaround 🙄 I'll look into this. |
That sucks. Thanks so much for taking this on and looking into it! |
Further investigation revealed that rustfmt is just not yet depending on a recent enough version of the
No worries. I am keen to make use of some recent features in rustfmt, that is why I am willing to push this forward :D |
I investigated this just now... looks like we're still waiting on a rustfmt release (last one was 1.4.36 on Feb 8th). |
Correct. I've subscribed to the repo and will pick this up once they cut a new release! |
Alternatively, we could depend on a specific commit hash? |
@dsherret What is your thought on depending on a specific commit hash vs a tagged one? I am tired of waiting for a release 😅 Additionally, it doesn't really make a big difference for dprint itself so I don't necessarily want to take up resources of the rustfmt team just so we can depend on a more "official" version. I don't know if tagged releases of rustmft undergo more specific testing than the usual CI? If not, I see little risk in depending on a specific commit on their main branch vs depending on a tagged release. |
@thomaseizinger yeah depending on a specific commit sounds good to me! |
5ab53ea
to
df52204
Compare
@dsherret I've updated the patch to point to latest master of From my perspective, this is ready be reviewed! |
To make future upgrades easier, we also make the following changes: 1. Use a rust-toolchain file to clearly specify the requirements of our toolchain. 2. Refer to this toolchain in the CI configuration to avoid duplicating the version requirement. 3. Remove `wasm` feature in favour of cfg-based dependency declarations. 4. Remove `patches` directory as they are now outdated with the recent ap-crates releases. 5. Depend on rustfmt via git because the crates.io release is no longer being updated. The Cargo.lock file tracks which specific Git revision we depend on. Future updates therefore should only require a `cargo update`.
df52204
to
d56df29
Compare
@thomaseizinger great! Thanks! Seems like the release build failed on the CI for some reason. I didn't look into it yet, but it says it can't find "rustc_ast". |
Uhm, that should have been installed through rustup, at least locally that worked but then I didn't actually build for wasm32 locally 🤦♂️ Let's hope that actually works for wasm ... |
So here is what happened:
I've opened an issue here to discuss this but I am not very confident that this will be resolved quickly. As far as I understand |
That sucks… I’m thinking it might be time to change this to a dprint “process plugin”, which is unfortunate, but not too big of a deal. I can start on that tomorrow or Monday and then hopefully in the future rustfmt supports compiling to wasm. |
Yeah, I found it quite elegant that rustfmt was a wasm plugin :) If you change it to a process plugin, are you still going to compile it yourself? One of the things I like about dprint is that I can use nightly formatting features but still use stable Rust without having to muck around and install two toolchains in CI etc. Will that be possible with a process plugin or are you going to rely on rustfmt being installed on the machine? |
@thomaseizinger yup, will be possible! I'm going to merge this PR even though it doesn't work due to changes in rustfmt. Thanks for all your help on this and hopefully we'll be able to make this a Wasm plugin again in the future so that it's more portable and secure. |
@thomaseizinger ok, the work here is done. You can update to the process plugin by following the instructions here: https://github.com/dprint/dprint-plugin-rustfmt/releases/ (Slightly more verbose because a checksum needs to be provided because the plugin doesn't run sandboxed—unlike Wasm plugins) |
To make future upgrades easier, we also make the following changes:
our toolchain.
the version requirement.
wasm
feature in favour of cfg-based dependency declarations.patches
directory as they are now outdated with the recentap-crates releases.
being updated.
This is a draft PR because:a) I am not sure if you want all the changes to the infrastructure.b) We need this to be merged and released before this is going to build. I applied the patch locally and it works. We could also patch this the wayrustc-ap-rustc_data_structures
was patched before however, I thought it is nice to actually be able to get rid of this stuff hence I didn't want to re-introduce it again. We might need to wait for another rustc + rustfmt release though before we can use that.