Open
Description
Code
Without the macro feature enabled.
use axum::extract::FromRef;
#[derive(Clone, FromRef)]
struct AppState {
db: SqlitePool,
}
Current output
error: cannot find derive macro `FromRef` in this scope
--> src/main.rs:33:17
|
33 | #[derive(Clone, FromRef)]
| ^^^^^^^
|
note: `FromRef` is imported here, but it is only a trait, without a derive macro
--> src/main.rs:1:12
|
1 | use axum::{extract::FromRef, Router};
| ^^^^^^^^^^^^^^^^
Desired output
error[E0432]: unresolved import `axum::extract::FromRef`
--> src/main.rs:2:5
|
2 | use axum::extract::FromRef;
| ^^^^^^^^^^^^^^^^^ no `FromRef` in `extract`
|
note: found an item that was configured out
--> /Users/joshka/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.7.9/src/extract/mod.rs:xx:yy
|
xx | macro_rules! FromRef;
| ^^
note: the item is gated behind the `macros` feature
--> /Users/joshka/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.7.9/src/extract/mod.rs:xx:yy
Rationale and extra context
The detection of cfg'd out items should treat items that match the expected type (e.g. a macro) as higher priority than items which match the name (e.g. FromRef
)
Other cases
Rust Version
rustc --version --verbose
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: aarch64-apple-darwin
release: 1.83.0
LLVM version: 19.1.1
Anything else?
Similar to but not the same as #132166
Possibly relevant to #129183
Metadata
Metadata
Assignees
Labels
Area: `cfg` conditional compilationArea: Messages for errors, warnings, and lintsArea: Name/path resolution done by `rustc_resolve` specificallyDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.