Closed
Description
The error happens on latest stable and nightly.
Steps to reproduce: cargo new --lib lib1
;
src/lib.rs
:
pub mod std {
}
tests/test1.rs
:
use lib1;
fn main() {
}
cargo test
returns error:
error[E0260]: the name `std` is defined multiple times
|
= note: `std` must be defined only once in the type namespace of this module
The error only happens if the module is named std
(for instance, core
and alloc
work without error). The error is not produced if test1.rs
doesn't use lib1
in any way. If test1.rs
doesn't contain imports but uses the library directly (e.g. ::lib1::x()
), the error is produced. cargo build
always succeeds.
I don't know if this is supposed to be forbidden but the error message seems to be misleading.