-
Notifications
You must be signed in to change notification settings - Fork 182
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
Generate auto trait clauses for opaque type goals #468
Conversation
d362b5e
to
8a3e89f
Compare
opaque_id | ||
); | ||
|
||
let opaque_ty_datum = &builder.db.opaque_ty_data(opaque_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder that we should factor the "hidden type" out from this struct and make it something that we lazilly request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would that work, actually? A method on the database to request it, or something similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, just a separate method on the db that only gets invoked when auto trait impls are actually required (that's important) would be fine, I think
@@ -161,7 +224,12 @@ fn program_clauses_that_could_match<I: Interner>( | |||
|
|||
if trait_datum.is_non_enumerable_trait() || trait_datum.is_auto_trait() { | |||
let self_ty = trait_ref.self_type_parameter(interner); | |||
if self_ty.bound_var(interner).is_some() | |||
|
|||
if let TyData::Alias(AliasTy::Opaque(opaque_ty)) = self_ty.data(interner) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this probably wants to be the placeholder, and not the alias type, but we can leave it as "future work" for now
When you have
opaque type Foo: Trait = Bar
,solving the goal
Foo: Send
will generate
Foo: Send :- Bar: Send