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

Allowing a lint fails on let binding. #51942

Closed
vi opened this issue Jun 30, 2018 · 2 comments
Closed

Allowing a lint fails on let binding. #51942

vi opened this issue Jun 30, 2018 · 2 comments
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@vi
Copy link
Contributor

vi commented Jun 30, 2018

Example with cost_err:

fn main() {
    #[allow(const_err)]
    let _x = 42 / 0;
}
#[allow(const_err)]
fn main() {
    let _x = 42 / 0;
}

Expected: the same. Actual: warning in the first case.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 30, 2018

This is not just a const_err thing. This issue exists for all lints.

@oli-obk oli-obk added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. labels Jun 30, 2018
@crlf0710 crlf0710 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 11, 2020
@ehuss
Copy link
Contributor

ehuss commented May 14, 2021

I believe this is fixed via #69185 (nightly-2020-02-21). allow(unconditional_panic) works on let _x = 42 / 0;. And more convoluted lints also work (tested up to nightly-2021-05-12):

#[allow(const_err, unconditional_panic)]
let _x = [1; {const CONST: usize = 1/0; 1}];

I'm not sure what lints the previous comment is referring to. In my tests, other lint controls seem to work (back to 1.16, 1.15 seemed to ignore them). I'll close, but if there is something else, please reopen with more information on what is not working.

@ehuss ehuss closed this as completed May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. 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

4 participants