[−][src]Function chalk_solve::clauses::push_auto_trait_impls
pub fn push_auto_trait_impls<I: Interner>(
builder: &mut ClauseBuilder<I>,
auto_trait_id: TraitId<I>,
adt_id: AdtId<I>
)
For auto-traits, we generate a default rule for every struct, unless there is a manual impl for that struct given explicitly.
So, if you have impl Send for MyList<Foo>
, then we would
generate no rule for MyList
at all -- similarly if you have
impl !Send for MyList<Foo>
, or impl<T> Send for MyList<T>
.
But if you have no rules at all for Send
/ MyList
, then we
generate an impl based on the field types of MyList
. For example
given the following program:
#[auto] trait Send { }
struct MyList<T> {
data: T,
next: Box<Option<MyList<T>>>,
}
we generate:
forall<T> {
Implemented(MyList<T>: Send) :-
Implemented(T: Send),
Implemented(Box<Option<MyList<T>>>: Send).
}