-
Notifications
You must be signed in to change notification settings - Fork 1
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
Initial support for traits in impure code #51
base: rewrite-2023
Are you sure you want to change the base?
Conversation
let call_trait_substs = | ||
ty::EarlyBinder::bind(trait_ref.args).instantiate(tcx, impl_method_substs); | ||
let impl_substs = ty::List::identity_for_item(tcx, impl_def_id); | ||
let trait_method_substs = tcx.mk_args_from_iter( | ||
call_trait_substs | ||
.iter() | ||
.chain(impl_method_substs.iter().skip(impl_substs.len())), | ||
); | ||
|
||
// sanity check: do we now have the correct number of substs? | ||
let identity_trait_method = ty::List::identity_for_item(tcx, trait_method_def_id); | ||
assert_eq!(trait_method_substs.len(), identity_trait_method.len()); |
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'm a bit fuzzy now, but I believe this is what rustc internally calls "rebasing" the substitution, no? Can we not just use that?
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.
Refactored to use rebase_onto
. For some reason, the Nevermind, I wasn't using it correctly initially.rebase_onto
operation doesn't include the initial subst for Self
in the trait generics (e.g. Foo -> Self
for impl Trait for Foo
), so that needs to be added back in.
Start support for traits in impure code.
This PR does not yet support encoding the traits themselves as domains in Viper yet.
No support for type-conditional spec refinement yet.