Skip to content

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

Closed
@briansmith

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.

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