-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Casting or adding type ascription to panic!() triggers unreachable_code #67227
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
Me and @jonas-schievink briefly discussed this on Discord. It's not clear to me that this is a bug, but I could also see an argument for why coercions (through type ascription or via e.g. Particularly, we might consider coercions & casts different than e.g. fn test() -> impl Iterator<Item = i32> {
foo(
panic!()
)
}
fn foo(_: !) -> impl Iterator<Item = i32> { std::iter::empty() } which results in:
|
T-compiler triage: Leaving unprioritized for now while we wait to see what T-lang decides about whether this is a bug or not. |
We discussed this very briefly in Thursday's language team meeting. Sadly, we did not have quorum to make any decisions. Mainly, I informed those present of the possible argument for a distinction wrt. casts and coercions as compared to e.g. function calls. @leo60228 If possible, it would be good to elaborate on why we should add a special case to stop linting here and whether such complexity would be justified. |
I return |
While I could just return |
While I am sympathetic to the annoyance of the lint here, this issue does not seem like a high priority issue for us to address. triage: P-medium. Leaving nomination label so that we still try to discuss what to do next about it. |
The language team discussed this today. Attendance was low, but we agreed that it would be OK to avoid linting in this case as it “makes sense because these expressions are useful for ensuring type inference succeeds”. This would apply to both type ascription and casts. |
doesn't compile, as
()
(nor!
) implementIterator<Item = i32>
.compiles, but gives this warning:
also compiles, but gives the same warning.
The text was updated successfully, but these errors were encountered: