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

Resolve Miri's concerns around unsafe code #197

Merged
merged 6 commits into from Aug 25, 2022

Conversation

nathanwhit
Copy link
Contributor

Fixes #189.

This PR essentially just ports the changes from anyhow (initial PR, cleanup commit, follow-up PR, follow-up PR) in one go.

The general theme of the changes is to use raw pointers for as much of the vtable shenanigans as possible to avoid the assumptions that references carry.

@zkat
Copy link
Owner

zkat commented Aug 21, 2022

Gosh. This is a big PR. Thank you!

It's unfortunate that I mostly don't understand this so I just hope all this extra unsafe is... safe enough? I don't really know how to review this otherwise, because it's mostly over my head. I'm really looking forward to the Provider API so I don't have to have this Anyhow clone sitting around inline :\

Is it easy to add miri scanning to github issues? We may as well add it to CI now that you've gone through all the effort to make sure it actually passes there?

@nathanwhit
Copy link
Contributor Author

It's unfortunate that I mostly don't understand this so I just hope all this extra unsafe is... safe enough? I don't really know how to review this otherwise, because it's mostly over my head.

Understandable, unsafe is really tricky! That's why I tried to keep the changes here as close to the anyhow fix as possible (I trust dtolnay more than I trust myself 😅).

I'm really looking forward to the Provider API so I don't have to have this Anyhow clone sitting around inline :\

+1! I'm hoping stabilization is not too far out, it'll make things a lot cleaner.

Is it easy to add miri scanning to github issues? We may as well add it to CI now that you've gone through all the effort to make sure it actually passes there?

Yup, that makes a lot of sense. I've pushed a commit to run miri in CI (you can see a successful run in my fork ) and fixed the linter warnings. For reference, before this PR around half of all of the tests were failing due to UB being detected; after this PR, they're all passing! 🎉

@zkat
Copy link
Owner

zkat commented Aug 25, 2022

alright, let's roll with this and see what happens!

@zkat zkat merged commit 5f3429b into zkat:main Aug 25, 2022
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.

Miri complains about miette code
2 participants