Skip to content
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

explicitly annotate type of wrap_on_hostcall #93

Merged
merged 1 commit into from
Jan 23, 2024
Merged

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Jan 23, 2024

wrap_on_hostcall has a generic parameter S. When calling the function this parameter is instantiated with some inference variable - _ - Let's call it ?unknown for now.

When calling exec_args.set_on_hostcall we end up equating for<'r> <S as SandBox>::Access<'r> with for<'r> <?unknown as SandBox>::Access<'r>. This currently constrains ?unknown to S, even though this may not strictly be the case.

There could theoretically exist an impl like

impl<S: Sandbox> Sandbox for Wrapper<S> {
    type Access<'r> = S::Access<'r>; 
}

with this using wrap_on_hostcall::<Wrapper<S>>(on_hostcall); would also compile.

Your code previously compiled due to a shortcoming of rustc when handling higher ranked regions. This will be fixed in rust-lang/rust#119849 at which point your code will fail with ambiguity.

@koute koute merged commit 90427a0 into paritytech:master Jan 23, 2024
5 checks passed
@koute
Copy link
Collaborator

koute commented Jan 23, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants