Skip to content

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

@skyzh

Description

@skyzh

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions