-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Spurious warnings around uninhabited types with 1.33 #58844
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
Comments
What problem are you seeing here? That |
What do you mean by trivially? This is a convenient way to represent platform-specific behaviour: have a type an uninhabited enum on some platforms and something useful in others, and then you can write code that abstracts over the two. This is what the code is in that case: I also use uninhabited enums extensively in Actually https://github.com/serde-rs/serde/blob/master/serde/src/ser/impossible.rs I don't see why an empty enum should trigger the warning, we literally have an issue filed against this very repo about not making |
Upstream is going to prefix both concerned variables in webrender with an Not knowing about the fact that empty enums can lead to warnings, I would be myself really confused as to why the variables are prefixed, given they totally look used in the code, even if only on some platforms. This new spurious warning means you basically have to either prefix variables with |
@nox Inhabitedness checks are privacy based, so consuming code will only get these warnings if it "knows" that the type is uninhabited. Maybe you can use something like |
That is helpful, thanks, I wasn't aware of how visibility affects the inhabitedness check. Closing this issue. |
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=25adf77e74f612769891852bfeaf237c
Using uninhabited enums for some targets or combinations of crate features are a useful common idiom and this probably shouldn't emit any warning.
The text was updated successfully, but these errors were encountered: