Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicate lang item if #![feature(test)] is enabled #80

Open
skyzh opened this issue Mar 22, 2022 · 0 comments
Open

duplicate lang item if #![feature(test)] is enabled #80

skyzh opened this issue Mar 22, 2022 · 0 comments
Labels
S-needs-investigation Status: needs investigation

Comments

@skyzh
Copy link

skyzh commented Mar 22, 2022

Minimum reproducible step:

cargo new --lib test-build-std

lib.rs:

#![feature(test)]
extern crate test;

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        let result = 2 + 2;
        assert_eq!(result, 4);
    }
}
cargo build -Zbuild-std --target aarch64-apple-darwin

Then there are a lot of errors in console...

error: duplicate lang item in crate `core` (which `std` depends on): `const_ptr`.
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /Users/skyzh/Work/test-build-std/target/aarch64-apple-darwin/debug/deps/libcore-ba459098a3dc74d8.rmeta
  = note: second definition in `core` loaded from /Users/skyzh/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-dd6de681850a671c.rlib

error: duplicate lang item in crate `core` (which `std` depends on): `mut_ptr`.
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /Users/skyzh/Work/test-build-std/target/aarch64-apple-darwin/debug/deps/libcore-ba459098a3dc74d8.rmeta
  = note: second definition in `core` loaded from /Users/skyzh/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-dd6de681850a671c.rlib

Once feature test is removed, everything compiles...

Thanks for investigating into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-needs-investigation Status: needs investigation
Projects
None yet
Development

No branches or pull requests

2 participants