memchr
memchr copied to clipboard
Duplicate lang items with 2/more crates depended on this in Cargo.toml and -Zbuild-std
To reproduce the error,
- Create a lib crate
- Add 2 or more crates depended on
memchr
to the Cargo.toml. For me, it would benom = "7.0"
andobject = "0.26"
- Execute
cargo build -Z build-std=core,compiler_builtins,alloc -Z build-std-features=compiler-builtins-mem --target x86_64-unknown-linux-gnu
And there'll go thousands of lines of output of cargo with duplicate lang items
or so.
My rust version: nightly-x86_64-unknown-linux-gnu (default) rustc 1.56.0-nightly (b03ccace5 2021-08-24)
Does this happen with memchr 2.4.0
? I wonder if this is related to #89? cc @alexcrichton
I believe the bug here is that the std
feature of memchr
is enabled but you're not building std as part of -Zbuild-std
.
Well, actually it doen't work either if marking the crate with #![no_std]
and setting default-features = false
of those dependent crates, which disables the std
dependency.
To be honest, I don't know. This doesn't really look like an issue with memchr to me. This crate doesn't define lang items. So I suspect your issue is elsewhere. Either way, I don't know what the next debugging steps are.
Alright, I'll search for more info about build-std. Maybe there's something.
Closing due to inactivity and a general suspicion that this isn't related to memchr
specifically.