Skip to content

Move Miri extern functions to a Miri utils crate #2760

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

Open
dtolnay opened this issue Jan 17, 2023 · 2 comments
Open

Move Miri extern functions to a Miri utils crate #2760

dtolnay opened this issue Jan 17, 2023 · 2 comments
Labels
A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement

Comments

@dtolnay
Copy link
Member

dtolnay commented Jan 17, 2023

These things: https://github.com/rust-lang/miri/tree/73452b3213b906a7d2a08f176d38730bcc363f6f#miri-extern-functions

Quoting @saethlin in #2757 (comment):

We should really figure out some kind of Miri utils crate if we're going to keep incentivizing library authors to do stuff like this. As-written, this is ugly to use and also the mechanism that this hooks into makes me uncomfortable because it's so permissive.

@dtolnay
Copy link
Member Author

dtolnay commented Jan 17, 2023

I confirmed that [target.'cfg(miri)'.dependencies] in Cargo.toml works correctly, those dependencies will build only during cargo miri and not for ordinary use of the library. It should be documented that this is the intended way to declare the dependency on the miri utils.

@bjorn3
Copy link
Member

bjorn3 commented Jan 17, 2023

Another option would be for miri to provide this utils crate in the sysroot such that #[cfg(miri)] extern crate miri_utils; works and always pulls in the right utils crate version for the current miri version.

@RalfJung RalfJung added C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement A-shims Area: This affects the external function shims labels Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement
Projects
None yet
Development

No branches or pull requests

3 participants