Skip to content

unused_results is stricter on Nightly and Beta than on Stable #44119

Closed

Description

@briansmith

This compiles fine on stable, but fails on nightly and beta:

https://play.rust-lang.org/?gist=9504fbb631c253be8e43bcb872524e0e&version=nightly

#![deny(unused_results)]

fn main() {
   let mut p = std::path::PathBuf::from("asdf");
   p.set_extension("foo");
}

Nightly results:

  Compiling playground v0.0.1 (file:///playground)
error: unused result
 --> src/main.rs:5:4
  |
5 |    p.set_extension("foo");
  |    ^^^^^^^^^^^^^^^^^^^^^^^
  |
note: lint level defined here
 --> src/main.rs:1:9
  |
1 | #![deny(unused_results)]
  |         ^^^^^^^^^^^^^^

error: aborting due to previous error

Regardless of whether the change in behavior is an intentional backward compatibility break, it should be documented in the release notes.

See also #43806.

Activity

  1. zackmdavis commented on Aug 28, 2017

    @zackmdavis
    Contributor

    This is specific to booleans. Not intentional. (I could see a case for the new behavior, but that doesn't matter; if we're going to change this, it should be on purpose.) Fix forthcoming (if it doesn't make the 1.21 beta branch cut, it would need to be backported). Very sorry for regression. 😞 😰 ☠️

  2. added a commit that references this issue on Aug 28, 2017
    cc5ea04
  3. eddyb commented on Aug 28, 2017

    @eddyb
    Contributor

    FWIW lint changes are not considered backwards-compatibility breaking.
    cc @rust-lang/lang

  4. whitequark commented on Aug 28, 2017

    @whitequark
    Contributor

    @eddyb Then we should mention that Rust's (or perhaps rustc's?) backwards compatibility guarantee only holds with --cap-lints warn. It's the default in Cargo for non-root crates, but root crates could still result in breakage on rustc updates if e.g. compiled by scripts.

  5. eddyb commented on Aug 28, 2017

    @eddyb
    Contributor

    @whitequark Yeah, --cap-lints is a relatively new trick and the stability document (I don't even know where to look for it - I think it was an RFC) should be updated if it hasn't been already.

  6. briansmith commented on Aug 28, 2017

    @briansmith
    ContributorAuthor

    @alexcrichton This isn't just a regression from stable to nightly, it is a regression from stable to beta.

    FWIW lint changes are not considered backwards-compatibility breaking.

    OTOH, this is probably the most common lint for which #[deny(...)] and #[forbid(...)] are used.

  7. eddyb commented on Aug 28, 2017

    @eddyb
    Contributor

    @briansmith As @whitequark mentioned above, lints can't break dependencies from compiling.

  8. arielb1 commented on Aug 28, 2017

    @arielb1
    Contributor

    1.21 is now beta - this needs to be backported.

  9. est31 commented on Aug 28, 2017

    @est31
    Member

    I think this issue is treated wrongly by reverting behaviour (#44122). Rustc needs the ability to add and remove lints in any way wanted, otherwise there won't be any improvement of lints in the future.

    E.g. I've seen the "unused_mut" lint become more powerful, it detected some non required mut annotations. Why shouldn't it be possible to improve it? Stability? If you say #![deny(lint)] you give up that stability guarantee, except if its some very obvious thing like unsafe.

    Of course though, @zackmdavis is right, a lint change should be done knowingly and on purpose.

  10. changed the title [-]`unused_results` is stricter on Nightly than on Beta or Stable[/-] [+]`unused_results` is stricter on Nightly and Beta than on Stable[/+] on Aug 28, 2017
  11. 21 remaining items

  12. added a commit that references this issue on Aug 29, 2017
    15fe598
  13. alexcrichton commented on Aug 29, 2017

    @alexcrichton
    Member

    I don't have any idea why bool has be excepted from [unused_results].

    @alexcrichton might remember?

    Nothing like trying to remember a commit from three years ago! Nah unfortunately though I don't remember why bool was excepted. Your explanation above though, sounds like the most plausible reason!


    We kind of have to decide within the next 24 hours

    I thought @alexcrichton was talking about beta being already branched off somewhere else?

    Yes beta branched a few days ago so this, but with the current disposition to close I don't think we're going to backport/stop anything at this point.

  14. added 2 commits that reference this issue on Aug 29, 2017
    eefe818
    1d43bca
  15. added a commit that references this issue on Aug 29, 2017
    ff75c01
  16. zackmdavis commented on Aug 29, 2017

    @zackmdavis
    Contributor

    @nikomatsakis

    doesn't automatically trigger lints for the much more common comparison operators (unless anyone has any alternative implementation ideas that would do so??

    I can probably help with this. =) Where should I comment? (Tracking issue?)

    Tracking issue is #43302, although I would argue that the currently-unreviewed #44103 (having the lint look at the operators) adequately solves the problem even if it's not the "automatic" implementation folks originally imagined.

  17. rfcbot commented on Aug 31, 2017

    @rfcbot

    🔔 This is now entering its final comment period, as per the review above. 🔔

  18. rfcbot commented on Aug 31, 2017

    @rfcbot

    🔔 This is now entering its final comment period, as per the review above. 🔔

  19. added
    final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.
    and removed
    proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
    on Aug 31, 2017
  20. added this to the 1.21 milestone on Sep 2, 2017
  21. rfcbot commented on Sep 10, 2017

    @rfcbot

    The final comment period is now complete.

  22. Mark-Simulacrum commented on Sep 12, 2017

    @Mark-Simulacrum
    Member

    Closing, seems we've sufficiently figured this out and no objections were raised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.T-langRelevant to the language teamfinal-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions