Import of deprecated function triggers warning even if a non-deprecated macro of the same name is used
Open
@jdonszelmann is already working on this.
Since Nov 3, 2025.
A-lints
A-resolve
C-bug
L-deprecated
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code (with snapbox 0.6.23):
use snapbox::cmd::cargo_bin;
fn foo() {
cargo_bin!();
}
There is:
- A deprecated function
snapbox::cmd::cargo_bin - A non-deprecated macro
snapbox::cmd::cargo_bin
I expected to see this happen: no warning, since we're only using the macro.
Instead, this happened: import of the deprecated function triggered a warning.
error: use of deprecated function `snapbox::cmd::cargo_bin`: incompatible with a custom cargo build-dir, see instead `cmd::cargo_bin!`
--> tests/suite/cli_rustup_init_ui.rs:5:29
|
5 | use snapbox::cmd::{Command, cargo_bin};
| ^^^^^^^^^
|
= note: `-D deprecated` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(deprecated)]`
Meta
rustc --version --verbose:
rustc 1.91.0 (f8297e351 2025-10-28)
binary: rustc
commit-hash: f8297e351a40c1439a467bbbb6879088047f50b3
commit-date: 2025-10-28
host: aarch64-apple-darwin
release: 1.91.0
LLVM version: 21.1.2
(Behavior is the same with rustc 1.93.0-nightly (b15a874aa 2025-11-02)).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.