-
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
ICE: delay_span_bug
: error performing ParamEnvAnd
#103899
Comments
Simplified it further trait BaseWithAssoc {
type Assoc;
}
trait WrapperWithAssoc {
type BaseAssoc: BaseWithAssoc;
}
struct Wrapper<B> {
inner: B,
}
struct ProjectToBase<T: BaseWithAssoc> {
data_type_h: T::Assoc,
}
struct DoubleProject<L: WrapperWithAssoc> {
buffer: Wrapper<ProjectToBase<L::BaseAssoc>>,
}
fn trigger<L: WrapperWithAssoc<BaseAssoc = ()>>() -> DoubleProject<L> {
loop {}
}
fn main() {} |
@rustbot claim |
This issue basically hinges on the fact that this code is considered well-formed: trait Foo {
type Assoc: Bar;
}
trait Bar {}
fn test<T: Foo<Assoc = S>, S>() {} Even though trait Foo {
type Assoc: Bar;
}
trait Bar {
type Assoc2;
}
struct Wrapper<T: Foo> {
inner: <<T as Foo>::Assoc as Bar>::Assoc2,
_i: (),
}
fn test<T: Foo<Assoc = S>, S>(s: Wrapper<T>) {
let _ = s.inner;
//~^ ERROR the trait bound `S: Bar` is not satisfied
} However, sometimes we don't observe this projection during HIR typeck, but only during drop elaboration... which is not designed to handle associated type normalization errors 😓 This is evident by commenting out that |
That does sound like something that needs more discussion, so I'll @rustbot release-assignment |
…imulacrum Add a few known-bug tests The labels of these tests should be changed from `S-bug-has-mcve` to `S-bug-has-test` once this is merged. cc: rust-lang#101518 rust-lang#99492 rust-lang#90950 rust-lang#89196 rust-lang#104034 rust-lang#101350 rust-lang#103705 rust-lang#103899 I couldn't reproduce the failures in rust-lang#101962 and rust-lang#100772 (so either these have started passing, or I didn't repro properly), so leaving those out for now. rust-lang#102065 was a bit more complicated, since it uses `rustc_private` and I didn't want to mess with that.
Result::unwrap()
on an Err
value: NoSolution', compiler/rustc_borrowck/src/type_check/liveness/trace.rs:574:88delay_span_bug
: error performing ParamEnvAnd
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
… 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
Meta
rustc --version --verbose
:Also happens on:
Error output
Backtrace
The text was updated successfully, but these errors were encountered: