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

Derives on deprecated items generate deprecation warnings #58822

Closed
cramertj opened this issue Feb 28, 2019 · 10 comments
Closed

Derives on deprecated items generate deprecation warnings #58822

cramertj opened this issue Feb 28, 2019 · 10 comments
Assignees
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cramertj
Copy link
Member

The following code generates a warning on nightly and beta but not on stable:

#[deprecated = "oh no"]
#[derive(Default)]
struct X;
@cramertj cramertj added regression-from-stable-to-beta Performance or correctness regression from stable to beta. A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. labels Feb 28, 2019
@Centril
Copy link
Contributor

Centril commented Feb 28, 2019

Hmm; technically generating warnings seems like correct but annoying behavior (which we don't have to fix but probably should...). Putting #[allow(deprecated)] on generated impls seems like a solution?

@joshlf
Copy link
Contributor

joshlf commented Mar 1, 2019

This regression also breaks existing code with #[deny(warnings)].

@nox
Copy link
Contributor

nox commented Mar 5, 2019

derive attributes can only be put on the type but the same people than the ones who control the deprecated attribute, so I don't see how that's technically correct. Derives should only ever generate a deprecated warning if the trait they derive is deprecated, never because of the type's deprecatedness.

@asajeffrey
Copy link

Just hit this in servo...

warning: use of deprecated item 'vr_display_capabilities::VRDisplayCapabilities::presented_by_browser': please use `future_frame_data` instead
 --> /Users/ajeffrey/github/asajeffrey/rust-webvr/rust-webvr-api/src/vr_display_capabilities.rs:3:52
  |
3 | #[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
  |                                                    ^^^^^^^^^^^
  |
  = note: #[warn(deprecated)] on by default

warning: use of deprecated item 'vr_display_capabilities::VRDisplayCapabilities::presented_by_browser': please use `future_frame_data` instead
 --> /Users/ajeffrey/github/asajeffrey/rust-webvr/rust-webvr-api/src/vr_display_capabilities.rs:3:52
  |
3 | #[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
  |                                                    ^^^^^^^^^^^

warning: use of deprecated item 'vr_display_capabilities::VRDisplayCapabilities::presented_by_browser': please use `future_frame_data` instead
 --> /Users/ajeffrey/github/asajeffrey/rust-webvr/rust-webvr-api/src/vr_display_capabilities.rs:3:65
  |
3 | #[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
  |                                                                 ^^^^^^^^^

Caused by deprecating a field in a struct.

@Centril Centril added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 5, 2019
@joshlf
Copy link
Contributor

joshlf commented Mar 6, 2019

Just hit this in Mundane too. We #![deny(warnings)], so it causes compilation failure.

error: use of deprecated item 'hash::InsecureSha1': SHA-1 is considered insecure
   --> src/hash.rs:102:10
    |
102 | #[derive(Default)]
    |          ^^^^^^^
    |
note: lint level defined here
   --> src/lib.rs:45:9
    |
45  | #![deny(warnings)]
    |         ^^^^^^^^
    = note: #[deny(deprecated)] implied by #[deny(warnings)]

error: use of deprecated item 'hash::InsecureSha1': SHA-1 is considered insecure
   --> src/hash.rs:102:10
    |
102 | #[derive(Default)]
    |          ^^^^^^^

error: use of deprecated item 'hash::InsecureSha1': SHA-1 is considered insecure
   --> src/hash.rs:102:10
    |
102 | #[derive(Default)]
    |          ^^^^^^^
    |
note: lint level defined here
   --> src/lib.rs:45:9
    |
45  | #![deny(warnings)]
    |         ^^^^^^^^
    = note: #[deny(deprecated)] implied by #[deny(warnings)]

error: use of deprecated item 'hash::InsecureSha1': SHA-1 is considered insecure
   --> src/hash.rs:102:10
    |
102 | #[derive(Default)]
    |          ^^^^^^^

error: use of deprecated item 'hash::InsecureSha1::ctx': SHA-1 is considered insecure
   --> src/hash.rs:104:5
    |
104 |     ctx: CStackWrapper<boringssl::SHA_CTX>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@pnkfelix
Copy link
Member

pnkfelix commented Mar 7, 2019

triage: P-high

@pnkfelix pnkfelix added the P-high High priority label Mar 7, 2019
@nikomatsakis nikomatsakis added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Mar 7, 2019
@nikomatsakis
Copy link
Contributor

I'm currently running a bisection with cargo-bisect-rustc.

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Mar 7, 2019

Regression is tracked to c84e797, which is #58098, cc @oli-obk -- this PR is titled " Require a list of features in #[allow_internal_unstable] #58098 ", one can certainly imagine how it could be related to this problem, perhaps the list of "allowed unstable features" for derives simply needs to be extended?

@pnkfelix
Copy link
Member

pnkfelix commented Mar 7, 2019

speculatively assigning to @oli-obk based on @nikomatsakis 's bisection.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 7, 2019

This is definitely caused by this change. We used to just not emit deprecation warnings inside allow_internal_unstable code. I'll extend derives to add #[allow(deprecated)] to replicate the previous behaviour, but we should probably create something more fine grained some day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants