-
Notifications
You must be signed in to change notification settings - Fork 51
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 structural type invariants #801
Conversation
19d419a
to
5825771
Compare
e768e46
to
4e64e32
Compare
let generics = ty_param_names(ctx.tcx, def_id).collect(); | ||
(generics, subst) | ||
} else if let DepNode::TyInv(ty) = dep { | ||
let generics = TyInvKind::from_ty(ty).generics(ctx.tcx); |
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.
👍
#[inline] | ||
pub(crate) fn erase_regions(mut self, tcx: TyCtxt<'tcx>) -> Self { | ||
match &mut self { | ||
Dependency::Item(_, s) => *s = tcx.erase_regions(*s), |
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 wonder if you couldn't derive TypeFoldable
for Dependency
and get this for free?
A few nits about the code, and we've already talked about the remaining larger issues in mattermost. I think this is pretty much ready to merge as a first step though! |
@@ -38,7 +38,7 @@ impl TyInvKind { | |||
} | |||
} | |||
|
|||
pub(crate) fn to_ty<'tcx>(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { | |||
pub(crate) fn to_skeleton_ty<'tcx>(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { |
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.
Can you remove pub(crate)
?
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.
No, the function is used to build the self node in the clone map.
This includes all the code for generating structural invariants but does not yet actually generate them when adding type invariants. This will be in a follow-up PR.