The following is a minimal demo of my problem. In main.rs, I use the #![feature(rustc_private)]
feature. In rust-toolchain.toml, I selected the nightly-2023-12-28
toolchain. And now I want to run with build-std
, and it the compiler with the following errors
error[E0152]: duplicate lang item in crate `core` (which `rustc_std_workspace_core` depends on): `RangeTo`.
|
= note: the lang item is first defined in crate `core` (which `std` depends on)
= note: first definition in `core` loaded from .../target/x86_64-unknown-linux-gnu/debug/deps/libcore-b60050ba0ca6eb75.rmeta
= note: second definition in `core` loaded from /data/nvme0n1/calvin/.rustup/toolchains/nightly-2023-12-28-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-632ae0f28c5e55ff.rlib
// There are multiple similar error messages.
My question is:
Is this a well known issue? I understand I am using nightly toolchain, and there could be some problems with it. However I have no choice, my project is using this toolchain, and -Z
is only permitted with nightly versions. So I have to somehow figure this thing out.
If it is a common problem, then I hope it be explained here. However, if it is not, then what could I do? Is it OK that I provide the following error messages to some forum or can I propose an issue to some github repo?
==== MINIMAL DEMO ====
The command to run
cargo build --no-default-features -Z build-std=core,std,alloc,proc_macro,test -Z unstable-options --target "x86_64-unknown-linux-gnu" --out-dir target/debug
main.rs
#![feature(rustc_private)]
extern crate libc;
fn main() {
println!("Hello, world!");
}
Cargo.toml
[package]
name = "test_libc"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rust-toolchain.toml
[toolchain]
channel = "nightly-2023-12-28"
components = ["rustfmt", "clippy", "rust-src", "rust-analyzer"]
profile = "minimal"