-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
ICE in mir_drops_elaborated_and_const_checked #135039
Comments
A bit more investigation (with some help from @sarah-quinones) led me to this additional, possibly related ICE:
ICE + backtrace:
Note that this example does not use async. |
Just noting that is not "minimized", since that second ICE is a totally different ICE from the first. |
Good point, changed the wording (it might make sense to open a second issue, WDYT?) |
One more bit of information: the code is not supposed to compile (it is missing a |
You don't need to change the code to get the two different ICEs, just cargo check the OP to get the second one. |
There's two causes to this problem:
I'll make a PR soon to fix this by addressing the first problem here since I don't think that there's anything that isn't breaking that would fix the second. But first, cc @rust-lang/types to see if they have any ideas. |
@matthewjasper: By "addressing the first problem here", are you suggesting running dropck in HIR? Or what? |
I mean reporting the errors in borrowck |
New test cases are from rust-lang#135039
… r=<try> Emit dropck normalization errors in borrowck Borrowck generally assumes that any queries it runs for type checking will succeed, thinking that HIR typeck will have errored first if there was a problem. However as of rust-lang#98641, dropck isn't run on HIR, so there's no direct guarantee that it doesn't error. While a type being well-formed might be expected to ensure that its fields are well-formed, this is not the case for types containing a type projection: ```rust pub trait AuthUser { type Id; } pub trait AuthnBackend { type User: AuthUser; } pub struct AuthSession<Backend: AuthnBackend> { data: Option<<<Backend as AuthnBackend>::User as AuthUser>::Id>, } pub trait Authz: Sized { type AuthnBackend: AuthnBackend<User = Self>; } pub fn run_query<User: Authz>(auth: AuthSession<User::AuthnBackend>) {} // ^ No User: AuthUser bound is required or inferred. ``` While improvements to trait solving might fix this in the future, for now we go for a pragmatic solution of emitting an error from borrowck (by rerunning dropck outside of a query) and making drop elaboration check if an error has been emitted previously before panicking for a failed normalization. Closes rust-lang#103899 Closes rust-lang#135039 r? `@compiler-errors` (feel free to re-assign)
Takes crash tests from rust-lang#135039, rust-lang#103899, rust-lang#91985 and rust-lang#105299 and turns them into ui tests
… r=<try> Emit dropck normalization errors in borrowck Borrowck generally assumes that any queries it runs for type checking will succeed, thinking that HIR typeck will have errored first if there was a problem. However as of rust-lang#98641, dropck isn't run on HIR, so there's no direct guarantee that it doesn't error. While a type being well-formed might be expected to ensure that its fields are well-formed, this is not the case for types containing a type projection: ```rust pub trait AuthUser { type Id; } pub trait AuthnBackend { type User: AuthUser; } pub struct AuthSession<Backend: AuthnBackend> { data: Option<<<Backend as AuthnBackend>::User as AuthUser>::Id>, } pub trait Authz: Sized { type AuthnBackend: AuthnBackend<User = Self>; } pub fn run_query<User: Authz>(auth: AuthSession<User::AuthnBackend>) {} // ^ No User: AuthUser bound is required or inferred. ``` While improvements to trait solving might fix this in the future, for now we go for a pragmatic solution of emitting an error from borrowck (by rerunning dropck outside of a query) and making drop elaboration check if an error has been emitted previously before panicking for a failed normalization. Closes rust-lang#103899 Closes rust-lang#135039 r? `@compiler-errors` (feel free to re-assign)
Takes crash tests from rust-lang#135039, rust-lang#103899, rust-lang#91985 and rust-lang#105299 and turns them into ui tests
Takes crash tests from rust-lang#135039, rust-lang#103899, rust-lang#91985 and rust-lang#105299 and turns them into ui tests
Code
(this is my best attempt at minimizing -- it includes some modified pieces from axum_login)
Meta
rustc --version --verbose
:The error appears to persist in the latest nightly (2025-01-01)
Error output
Backtrace
The text was updated successfully, but these errors were encountered: