Skip to content

Static assertions are marked as dead code #13951

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jdm opened this issue May 5, 2014 · 2 comments · Fixed by #24910
Closed

Static assertions are marked as dead code #13951

jdm opened this issue May 5, 2014 · 2 comments · Fixed by #24910

Comments

@jdm
Copy link
Contributor

jdm commented May 5, 2014

#[static_assert]
static a: bool = 1 == 1;

fn main() {
}
/tmp/sa.rs:2:1: 2:25 warning: code is never used: `a`, #[warn(dead_code)] on by default
/tmp/sa.rs:2 static a: bool = 1 == 1;
             ^~~~~~~~~~~~~~~~~~~~~~~~
@jdm jdm added the I-wrong label May 5, 2014
@thestinger
Copy link
Contributor

I think we should just remove this feature... it's quite unintuitive to use a static this way. Real static asserts make little sense because they would break parametric polymorphism for generics.

@steveklabnik
Copy link
Member

Triage: static_assert is behind a feature gate, and it doesn't look like it's being used anywhere at all in the codebase. We still warn.

steveklabnik added a commit to steveklabnik/rust that referenced this issue Apr 28, 2015
This was always a weird feature, and isn't being used in the compiler.
Static assertions should be done better than this.

Fixes rust-lang#13951
Fixes rust-lang#23008
Fixes rust-lang#6676

This is behind a feature gate, but that's still a

[breaking-change]
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jun 3, 2015
This was always a weird feature, and isn't being used in the compiler.
Static assertions should be done better than this.

This implements RFC rust-lang#1096.

Fixes rust-lang#13951
Fixes rust-lang#23008
Fixes rust-lang#6676

This is behind a feature gate, but that's still a

[breaking-change]
bors added a commit that referenced this issue Jun 3, 2015
This was always a weird feature, and isn't being used in the compiler.
Static assertions should be done better than this.

Fixes #13951
Fixes #23008
Fixes #6676

This is behind a feature gate, but that's still a

[breaking-change]

(It's not entirely clear to me that this should or shouldn't have an RFC, but if it does, I'm fine blocking on such a thing.)
dlrobertson pushed a commit to dlrobertson/rust that referenced this issue Nov 29, 2018
This was always a weird feature, and isn't being used in the compiler.
Static assertions should be done better than this.

This implements RFC rust-lang#1096.

Fixes rust-lang#13951
Fixes rust-lang#23008
Fixes rust-lang#6676

This is behind a feature gate, but that's still a

[breaking-change]
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 28, 2025
…-lang#13951)

changelog: [`manual_div_ceil`]: lint constants as well

Fix rust-lang#13950
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants