-
Notifications
You must be signed in to change notification settings - Fork 183
add Sized well-known impl and wf check #374
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
Conversation
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.
Seems good! I left some nits.
WellKnownTrait::CopyTrait => { /* TODO */ } | ||
WellKnownTrait::CloneTrait => { /* TODO */ } | ||
} | ||
} | ||
|
||
fn add_sized_program_clauses<I: 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 we should make builtin_traits/sized.rs
and put this function in there
|
||
let struct_datum = db.struct_datum(struct_id); | ||
|
||
if struct_datum.binders.map_ref(|b| b.fields.is_empty()).value { |
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.
Comment:
Structs with no fields are always Sized
return; | ||
} | ||
|
||
let last_field_ty = struct_datum |
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.
Let's add a comment here -- something like this:
To check if a struct type S<..>
is Sized
, we only have to look at its last field. This is because the WF checks for structs require that all the other fields must be Sized
.
Addressed the nits and rebased |
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.
Thanks! One minor suggestion but otherwise I think looks good to go
All done and rebased |
@nikomatsakis wait, why did I put the constraint check into the WfSolver? It should probably be in ToProgramClauses for StructDatum, right? |
made a zulip thread because I have many questions about this |
EDIT: doesnt actually close \#261, we need #368 to land first and address it