You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rustc-dev component is broken by missing literal-escaper #138647
Trying to load the rustc-dev packages with cargo leads to an error:
Updating crates.io index
error: failed to get `literal-escaper` as a dependency of package `rustc_ast v0.0.0 (/home/r/.rustup/toolchains/miri/lib/rustlib/rustc-src/rust/compiler/rustc_ast)`
... which satisfies path dependency `rustc_ast` of package `rustc_codegen_ssa v0.0.0 (/home/r/.rustup/toolchains/miri/lib/rustlib/rustc-src/rust/compiler/rustc_codegen_ssa)`
... which satisfies path dependency `rustc_codegen_ssa` of package `rustc-main v0.0.0 (/home/r/.rustup/toolchains/miri/lib/rustlib/rustc-src/rust/compiler/rustc)`
Caused by:
failed to load source for dependency `literal-escaper`
Caused by:
Unable to update /home/r/.rustup/toolchains/miri/lib/rustlib/rustc-src/rust/library/literal-escaper
Caused by:
failed to read `/home/r/.rustup/toolchains/miri/lib/rustlib/rustc-src/rust/library/literal-escaper/Cargo.toml`
Caused by:
No such file or directory (os error 2)
This is caused by #136355: compiler crates cannot have path dependencies outside the compiler folder.
rustc_lexer should not depend on literal-escaper via a Cargo.toml dependency, it should instead import it directly with extern crate literal_escaper to get the one from the library sysroot.
For cfg(bootstrap) where literal-escaper is not available in the library sysroot just use #[path] to include the code directly.
rustc_lexer should not depend on literal-escaper via a Cargo.toml dependency, it should instead import it directly with extern crate literal_escaper to get the one from the library sysroot.
This will break rustc_lexer from compiling on stable I believe. Not that it matters I suppose as the change done here in general makes it impossible to publish the crate to crates-io now for rust-analyzer :/
Another option would be to publish literal-escaper to crates.io. That would also allow proc-macro2 to use it. proc-macro2 needs to support not using libproc_macro, so it can't unconditionally use literal escaping through libproc_macro.
That doesn't sound like the simplest solution to me, tbh 😅 Unless the code is done and will never ever change? Otherwise we should probably have some setup for deploying it, managing the crates.io token, figuring out who will own the crate etc. (it probably shouldn't be owned by your GH account).
changed the title [-]rustc-src component is broken by missing literal-escaper[/-][+]rustc-dev component is broken by missing literal-escaper[/+]on Mar 18, 2025
Just a small thing if publishing to crates.io is a possibility: we have a crate in rustdoc (https://crates.io/crates/rustdoc-json) that is published with rights given to https://cargo-public-api. Isn't it possible to do the same here?
Activity
GuillaumeGomez commentedon Mar 18, 2025
cc @rust-lang/bootstrap
Kobzol commentedon Mar 18, 2025
Hmm, I'm not sure if we want to ship library sources in the
rustc-devrustup component (which contains only the compiler sources currently).Kobzol commentedon Mar 18, 2025
But I guess why not? Anyone have any concerns about doing that?
bjorn3 commentedon Mar 18, 2025
It should also be possible to add just
library/literal-escaper, right?Amanieu commentedon Mar 18, 2025
One possible solution:
rustc_lexershould not depend on literal-escaper via a Cargo.toml dependency, it should instead import it directly withextern crate literal_escaperto get the one from the library sysroot.cfg(bootstrap)where literal-escaper is not available in the library sysroot just use#[path]to include the code directly.Veykril commentedon Mar 18, 2025
This will break
rustc_lexerfrom compiling on stable I believe. Not that it matters I suppose as the change done here in general makes it impossible to publish the crate to crates-io now for rust-analyzer :/Kobzol commentedon Mar 18, 2025
Sure, we could selectively add only the required crates.
bjorn3 commentedon Mar 18, 2025
Another option would be to publish literal-escaper to crates.io. That would also allow proc-macro2 to use it. proc-macro2 needs to support not using libproc_macro, so it can't unconditionally use literal escaping through libproc_macro.
GuillaumeGomez commentedon Mar 18, 2025
Publishing on crates.io seems like the simplest solution. Should I do it?
Kobzol commentedon Mar 18, 2025
That doesn't sound like the simplest solution to me, tbh 😅 Unless the code is done and will never ever change? Otherwise we should probably have some setup for deploying it, managing the crates.io token, figuring out who will own the crate etc. (it probably shouldn't be owned by your GH account).
[-]rustc-src component is broken by missing literal-escaper[/-][+]rustc-dev component is broken by missing literal-escaper[/+]GuillaumeGomez commentedon Mar 18, 2025
Very good point. Then I'll keep quiet in the back and step in if my help is needed. 😆
RalfJung commentedon Mar 18, 2025
So this change broke not just Miri but also RA?
I've posted a revert to avoid blocking multiple tools while we figure out a proper solution: #138661.
GuillaumeGomez commentedon Mar 18, 2025
Just a small thing if publishing to crates.io is a possibility: we have a crate in rustdoc (https://crates.io/crates/rustdoc-json) that is published with rights given to https://cargo-public-api. Isn't it possible to do the same here?
7 remaining items
Auto merge of rust-lang#138661 - RalfJung:revert-rustc-dev-breakage, …
GuillaumeGomez commentedon Mar 18, 2025
I created https://github.com/GuillaumeGomez/literal-escaper. So if we agree on publishing it to crates.io, we can move it to the rust-lang organization.
RalfJung commentedon Mar 18, 2025
That also won't help for RA I think.
crates.io is probably the only option for sharing a dependency between
libraryandcompiler.GuillaumeGomez commentedon Mar 18, 2025
Seems like crates.io it is. @Kobzol is gonna open a thread on zulip t-infra channel for the discussion to continue there.
Auto merge of rust-lang#138661 - RalfJung:revert-rustc-dev-breakage, …
Rollup merge of rust-lang#138661 - RalfJung:revert-rustc-dev-breakage…
Unrolled build for rust-lang#138661
Rollup merge of #138661 - RalfJung:revert-rustc-dev-breakage, r=petro…
Rollup merge of rust-lang#138661 - RalfJung:revert-rustc-dev-breakage…
GuillaumeGomez commentedon May 22, 2025
literal-escaperis now published on crates.io and used in bothrustcandproc-macroas dependency (since #139367).So this issue is now fixed. :)