-
Notifications
You must be signed in to change notification settings - Fork 26
Better Unsized Type support #797
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
5374cf5 to
4f619fc
Compare
bc8f83c to
d7659ad
Compare
e87cafe to
4a97f82
Compare
cf228f8 to
c52dbbc
Compare
|
Previously, the metadata was wrongly fetched even when the access is not to the DST field (the last field). I.e., previously, in cases like accessing I newly added a pass for resolving the |
36a6776 to
5950145
Compare
|
CI is failing, could you fix it before I have a look? |
charon/src/bin/charon-driver/translate/translate_trait_objects.rs
Outdated
Show resolved
Hide resolved
Yes, it is a known problem with the assoc-types. |
|
OK, latest changes merged, but the results are the same: the support for assoc-types are required to let the overall process of fetching metadata go smoothly. |
What support do you need exactly? I haven't noticed anything related to associated types. |
|
OK, with the newly merged support for assoc-types, now the remaining is some generic inconsistency. Will try to fix tomorrow. |
|
CI should pass now. Originally, the |
|
Marking the PR as draft for now, please mark it as ready once you've fixed the subslice things and CI passes. |
|
OK, will try now. |
ce1fa9b to
1056c27
Compare
|
OK, done. Sorry for being late, it's the first time I do this. |
|
Thanks! Could you do the eurydice update? It should be a tiny PR that just ignores the new field probably. I'll do aeneas. |
62c638d to
f3d2530
Compare
|
OK, a very good news is that AeneasVerif/eurydice#259 is a perfect deploy of this PR in Eurydice, which, using the info of metadata, has restructured the whole support of DST in Eurydice. The latest change in that PR merged the latest version of the main official branch of Eurydice and has been tested to be fully compatible with this PR. Hopefully, @protz we can polish AeneasVerif/eurydice#259 to get fully ready next week and when @Nadrieril is back the week after next, we can merge both PR altogether! |
|
This is proving tricky on the aeneas side, we're working on it. |
|
OK, it seems that @protz is also working on the array PR, before the DST PR can get ready. |
5e1851a to
f3695c0
Compare
f3695c0 to
7cf6388
Compare
* fixed ptr metadata fixed PtrMetadata & its obtainment * metadata type & fixation in index to function call * fixed transform_constant_expr * two todo for bug fix * new pass to fix metadata obtainment * fixed syntactic error in test * fixed `translate_ptr_metadata` & doc test bug fixed * fixed build for the merge for `insert_ptr_metadata` & `simplify_constants` * update Hax & ML gen & ML print fix * version updated * fixed `()` as ptr metadata Now the ptr metadata will not introduce new `RawConstantExpr::Adt` Also fixed for `simplify_constants` * tests * fixed get-metadata * debug: no ptr-metadata for non-final field access * pass for resolving sized ptr-metadata inheritance Update insert_ptr_metadata.rs * Update charon/src/bin/charon-driver/translate/translate_trait_objects.rs Co-authored-by: Nadrieril <[email protected]> * Update charon/src/bin/charon-driver/translate/translate_types.rs Co-authored-by: Nadrieril <[email protected]> * as advised * some change * more on merge * changes as per advice * per advice: from panic to TyErr * bug fix: vtable reference generic error * half fix of subslice operation * fixed subslice ptr-metadata * formatting * version * resolving PtrMetadata<T> for Sized<T> including code revision as advised --------- Co-authored-by: Nadrieril <[email protected]>
This is important to give llbc clear semantics wrt references: we previously had to copy a mutable reference in order to read its metadata, but mutable references are importantly not copyable.
7cf6388 to
eaa116a
Compare
Following #608 , this PR aims to provide the metadata explicitly when a reference / raw pointer is created. Specifically, a new field
Operandis added to bothRvalue::Ref&Rvalue::RawPtr. It is()to correspond to the explicitNonecase of thePtrMetadata.This also involves a rework on the data structure of
PtrMetadata. Now,PtrMetadata::VTablerefers directly to the virtual table struct generated. Also, a variantPtrMetadata::InheritFromis added to handle the generic case.A new type kind
TyKind::PtrMetadatais added to serve as generic case placeholder. I.e., for typesT<U : ?Sized>withUparametrized, useTyKind::PtrMetadata(U)to refer to the potential metadata type.Besides, during
translate_rvaluewhen translating the function bodies, as types are not yet fully translated, it is hard to get the metadata in place. So a placeholder()is inserted there and a new passinsert_ptr_metadatafor Cleanup phase is added to compute the correct value.Now the feature should work quite well except the potential bug of taking the metadata from the index / subslice projections.
ci: use AeneasVerif/aeneas#609
ci: use AeneasVerif/eurydice#288