Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upimplement `is_coinductive` chalk callback #55096
Comments
This comment has been minimized.
This comment has been minimized.
Mentoring instructionsLooking at the chalk implementation, we want this function to match on goals that are:
This function is given a "canonical goal", so the first step is that we want to just look at the canonical value (e.g., fn is_coinductive(&self, goal: &Canonical<'gcx, ty::ParamEnvAnd<'gcx, Goal<'gcx>>>) -> bool {
let mut goal = &goal.value;
loop {
match goal {
GoalKind::DomainGoal(DomainGoal::WellFormed(WellFormed::Trait(..))) => return true,
GoalKind::DomainGoal(DomainGoal::Implemented(trait_predicate) => {
return self.tcx.trait_is_auto(trait_predicate.def_id),
}
GoalKind::Quantified(_, bound_goal) => goal = bound_goal.skip_binder(),
_ => return false,
}
}
} |
This comment has been minimized.
This comment has been minimized.
Hello I'd like to work on this! |
Fixes rust-lang#55096.
Fixes rust-lang#55096.
Fixes rust-lang#55096.
Fixes rust-lang#55096.
Fixes rust-lang#55096.
This comment has been minimized.
This comment has been minimized.
I see that @scalexm is working on this right now. Sorry I haven't been around. I'll let them finish it since they have already started. My apologies again and thanks for picking up my slack! :) |
Fixes rust-lang#55096.
Fixes rust-lang#55096.
Fixes rust-lang#55096.
Fixes rust-lang#55096.
Fixes rust-lang#55096.
The chalk integrate includes a
is_coinductive
callback that indicates whether a particular goal is co-inductive:rust/src/librustc_traits/chalk_context.rs
Lines 132 to 135 in e1643a8
A co-inductive goal is one of the following (see the corresponding chalk code for a kind of reference):
The existing trait solver doesn't have this notion of "well-formed trait goals" -- but it does have code related to testing about auto-traits that gives a few clues as to how to do the first step.