Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warning emitted from derive without a span #56195

Closed
bluss opened this issue Nov 24, 2018 · 2 comments · Fixed by #65310

Comments

@bluss
Copy link
Member

commented Nov 24, 2018

Reproducing code:

#[derive(Clone)]
#[deprecated(note="This is no longer useful")]
pub struct MyType { }

fn main() { }

Emits (without line numbers)

warning: use of deprecated item 'MyType': This is no longer useful
  |
  = note: #[warn(deprecated)] on by default

(Old report)

In this branch / commit of itertools, running cargo build shows a deprecation error without location in the code.

Running `rustc --crate-name itertools src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="use_std"' -C metadata=ba59252761bab077 -C extra-filename=-ba59252761bab077 --out-dir /home/travis/build/bluss/rust-itertools/target/debug/deps -L dependency=/home/travis/build/bluss/rust-itertools/target/debug/deps --extern either=/home/travis/build/bluss/rust-itertools/target/debug/deps/libeither-298d84de5004c8fc.rlib`
warning: use of deprecated item: Use std .step_by() instead
  |
  = note: #[warn(deprecated)] on by default
warning: use of deprecated item: Use std .step_by() instead

Version: rustc 1.32.0-nightly (1f57e48 2018-11-23)

@bluss

This comment has been minimized.

Copy link
Member Author

commented Nov 24, 2018

Culprit found: the derives on top of the deprecated type.

#[deprecated(note="Use std .step_by() instead", since="0.8")]
#[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct Step<I> {
    iter: Fuse<I>,
    skip: usize,
}

Inserting an#[allow(deprecated)] on the deprecated struct silences the mystery warning.

@bluss bluss changed the title Deprecation warning emitted by rustc without a span Deprecation warning emitted from derive without a span Nov 24, 2018
@estebank estebank added the A-lint label Nov 24, 2018
@joshlf

This comment has been minimized.

Copy link
Contributor

commented Oct 5, 2019

Same as #38832?

da-x added a commit to da-x/rust that referenced this issue Oct 11, 2019
The dummy Span pointed to the beginning, and it tripped the check doing
`in_derive_expansion(span)` in `src/librustc/middle/stability.rs`,
causing spurious deprecation warnings.

Fixes rust-lang#56195, rust-lang#55417.
da-x added a commit to da-x/rust that referenced this issue Oct 11, 2019
The dummy Span pointed to the beginning of the source file instead to
where the `#[derive]` is located. Later, it tripped the
`in_derive_expansion(span)` check at `src/librustc/middle/stability.rs`.
causing a span-less deprecation warning to be emitted.

Fixes rust-lang#56195, rust-lang#55417.
tmandry added a commit to tmandry/rust that referenced this issue Oct 11, 2019
deriving: avoid dummy Span on an artificial `type_ident` path

The dummy Span pointed to the beginning of the source file instead to where the `#[derive]` is located. Later, it tripped the `in_derive_expansion(span)` check at `src/librustc/middle/stability.rs`, causing a span-less deprecation warning to be emitted.

Fixes rust-lang#56195, Fixes rust-lang#55417.
@bors bors closed this in a32aec0 Oct 12, 2019
XiangQingW added a commit to XiangQingW/rust that referenced this issue Oct 13, 2019
The dummy Span pointed to the beginning of the source file instead to
where the `#[derive]` is located. Later, it tripped the
`in_derive_expansion(span)` check at `src/librustc/middle/stability.rs`,
causing a span-less deprecation warning to be emitted.

Fixes rust-lang#56195, rust-lang#55417.
choller added a commit to choller/rust that referenced this issue Oct 17, 2019
The dummy Span pointed to the beginning of the source file instead to
where the `#[derive]` is located. Later, it tripped the
`in_derive_expansion(span)` check at `src/librustc/middle/stability.rs`,
causing a span-less deprecation warning to be emitted.

Fixes rust-lang#56195, rust-lang#55417.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.