-
Notifications
You must be signed in to change notification settings - Fork 21
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
flux_rs::defs
and extern_spec
cannot be imported across crates
#759
Comments
A workaround would be to have an unattached file somewhere in the repo (not inside any crate) and then include it in all the crates that want to use it using the // flux-support.rs
flux_rs::defs!{
fn bv32(x:int) -> bitvec<32> { bv_int_to_bv32(x) }
}
// crate1/src/lib.rs
#[path = "../../flux-support.rs"]
mod flux_support;
// crate2/src/lib.rs
#[path = "../../flux-support.rs"]
mod flux_support; This would technically still duplicate the file from the perspective of the build system, but at least the content stays in one place. |
#763 implements the extern spec part of this. @enjhnsn2 please test and see if there are any issues. It should be enough to add the crate with the extern specs as a dependency with the caveat that you need to "mention" the crate at least once. If the crate doesn't contain any item you are importing you can mention it using The |
Just tested the extern_spec part of this and it works great. |
Curently, flux defs like:
cannot be used across crates, nor can extern_specs like:
While this can be worked around by duplicating this code, it is rather inconvenient. For example, we are verifying code in several different crates in Tock. I have all my wrapper types (and would like to have my extern_specs and defs) in one crate called
flux-support
, which is then imported by all the Tock crates we are verifying. Currently Flux cannot support this pattern.The text was updated successfully, but these errors were encountered: