Open aldanor opened 11 months ago
Update, tracked it down to a single line in paste's build.rs; minimal example that seems to hang is this: add build.rs
with
fn main() {
_ = "".split('.'); // <-- ???
}
This causes it to hang forever:
❯ cargo +nightly remark build
Compiling test-remark v0.1.0 (test-remark)
Building [ ] 0/3: test-remark(build.rs)
Looking into it a bit further, just running
RUSTFLAGS="-Cremark=all -Cdebuginfo=1" cargo +nightly build --release
causes
note: /rustc/59edd67056919c83c59001a8b4f2d8749359377a/library/core/src/char/methods.rs:1767:0 asm-printer (analysis): 179 instructions in function
note: /rustc/59edd67056919c83c59001a8b4f2d8749359377a/library/core/src/str/pattern.rs:544:32 gisel-irtranslator-memsize (analysis): Call to memset. Memory operation size: 4 bytes.
Written Variables: <unknown> (4 bytes).
note: /rustc/59edd67056919c83c59001a8b4f2d8749359377a/library/core/src/str/pattern.rs:543:0 size-info (analysis): IRTranslator: Function: _ZN52_$LT$char$u20$as$u20$core..str..pattern..Pattern$GT$13into_searcher17h80469adc07d8dc57E: MI Instruction count changed from 0 to 43; Delta: 43
note: /rustc/59edd67056919c83c59001a8b4f2d8749359377a/library/core/src/str/pattern.rs:543:0 size-info (analysis): AArch64O0PreLegalizerCombiner: Function: _ZN52_$LT$char$u20$as$u20$core..str..pattern..Pattern$GT$13into_searcher17h80469adc07d8dc57E: MI Instruction count changed from 43 to 40; Delta: -3
note: /rustc/59edd67056919c83c59001a8b4f2d8749359377a/library/core/src/str/pattern.rs:546:9 gisel-legalize (missed): unable to legalize instruction: G_STORE %26:_(<4 x s8>), %25:_(p0) :: (store (<4 x s8>) into %ir.18, align 8)
error: could not compile `test-remark` (build script)
So,
-Cremark
be disabled for build-scripts if possible?cargo-remark
should probably crash loudly and not hang in cases like this?Perhaps related: https://github.com/rust-lang/cargo/issues/6375 (re: not passing RUSTFLAGS down to build scripts which can cause all sorts of problems like here)
Hi, thanks for investigating this! To be clear, you were able to reproduce this with an empty Cargo project containing the mentioned build script? I can't reproduce the build script error on such an empty project with a build script.
Yes, the following hangs:
cargo new --bin foo
cd foo
echo 'fn main() { _ = "".split(\'.\'); }' > build.rs
cargo +nightly remark build
(to clarify, this is on M1 macOS, things may behave different on x64/linux I think)
rustc version: rustc 1.75.0-nightly (59edd6705 2023-10-09)
I see. This works for me on Linux, so it's hard for me to reproduce :sweat_smile: I think that the fact that it errors out for you (not the cargo remark hang, but the -Cremark=all
error) should be reported to rust-lang/rust
as a bug.
For larger projects, chances are there's always going to be some proc-macro dependencies involved, seems like
cargo remark build
just hangs; here's the simplest example (taken frompaste
docs):which results in hanging forever here:
Edit: not sure if it's proc-macro-related, or if it's something to do with
paste
. Or dependencies that have a custombuild.rs
perhaps?