-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
inflexibility with diverging functions #10352
Comments
#7680 was rejected, but this presents a good reason for changing how we handle this |
Maybe we could just make |
In that case it probably makes more sense just to use an uninhabited enum with a lang item called something like |
I don't consider this a bug. The type of
|
As an example of the kind of code that having
Another possible fix would be to say that all unconstrained type variables are arbitrarily assigned unit. We did this for a while and reverted it due to bugs I think, and possibly some surprising interactions. I'm inclined not to change the inference rules, personally, partially because I'm not too happy with our inference scheme and I don't want to get locked into defaults we might want to change. |
Okay, I'm convinced. |
Add `unnecessary_literal_unwrap` lint Add lint for more unnecessary unwraps and suggest fixes for them. Fixes rust-lang#10352 - [x] Followed [lint naming conventions][lint_naming] - [x] Added passing UI tests (including committed `.stderr` file) - [x] `cargo test` passes locally - [x] Executed `cargo dev update_lints` - [x] Added lint documentation - [x] Run `cargo dev fmt` r? `@llogiq` --- changelog: New lint [`unnecessary_literal_unwrap`] [rust-lang#10358](rust-lang/rust-clippy#10358) <!-- changelog_checked -->
The following code compiles, since the return type is inferred to be
Option<()>
:However, this will not compile because
rustc
cannot infer a type:If we used something like
Void
instead of!
, the return type would obviously beOption<Void>
here. However, since!
isn't allowed anywhere but a function signature this is a pain.The text was updated successfully, but these errors were encountered: