derive_more
derive_more copied to clipboard
`cargo test` fails in package named "core"
In the following project,
-
Cargo.toml
:
[workspace]
members = ["core"]
-
core/Cargo.toml
:
[package]
name = "core"
version = "0.1.0"
edition = "2021"
[dependencies]
derive_more = "0.99"
-
core/src/lib.rs
:
use derive_more::Add;
#[derive(Add)]
pub struct Foo(u32);
... cargo check
works fine, but cargo test
gives:
error[E0433]: failed to resolve: could not find `ops` in `core`
--> /home/xxx/core/src/lib.rs:3:10
|
3 | #[derive(Add)]
| ^^^ could not find `ops` in `core`
|
= note: this error originates in the derive macro `Add` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.
cargo test
works fine if package is not named core
.
If you know a way to fix this, feel free to make a PR. Otherwise, maybe just don't call your crate the same as one from the standard library?
@JelteF we can fix this by referring ::derive_more::core
in the expansion rather than just ::core
. A little bit more of hygiene.