Skip to content

Unused results lint fails on trivial program #43806

Closed
@milibopp

Description

@milibopp

The unused_results lint appears to be somewhat overzealous on the current nightly compiler. I managed to reduce the issue down to a simple hello world-program, so something is definitely broken.

I tried this code:

#![deny(unused_results)]

fn main() {
    println!("hello world!");
}

I expected to see the code compile successfully without any warnings.

Instead, the following error message showed up.

error: unused result
 --> src/main.rs:4:5
  |
4 |     println!("hello world!");
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: lint level defined here
 --> src/main.rs:1:9
  |
1 | #![deny(unused_results)]
  |         ^^^^^^^^^^^^^^
  = note: this error originates in a macro outside of the current crate

Meta

$ rustc --version
rustc 1.21.0-nightly (13d94d5fa 2017-08-10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions