-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add stdlib & add bit module #872
Conversation
@nilehmann, I'm trying to figure out what the best way to do this would be. I cannot add a module to flux-rs because you can't use proc macros in the same crate as they are defined. So I figured I would isolate the macros to a different crate and then have This works fine for the macros, but unfortunately, it doesn't seem to work well for the stdlib. If I try to compile, I get errors like: error[E0433]: failed to resolve: use of undeclared crate or module `flux_tool`
--> lib/flux-rs/src/std/bit.rs:89:13
|
89 | / #[sig(fn ($t[@b1], $t[@b2]) -> bv_shl(b1, b2))]
90 | | fn shr(self, rhs: $t) -> $t { $name(self.0 >> rhs.0) }
| |__________________________________________________________________^ use of undeclared crate or module `flux_tool`
...
95 | shr_impl! { B8, B8 B16, B16 B32, B32 B64, B64 B128, B128 Bi8, Bi8 Bi16, Bi16 Bi32, Bi32 Bi64, Bi64 Bi128, Bi128 }
| ----------------------------------------------------------------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `shr_impl` (in Nightly builds, run with -Z macro-backtrace for more info) I think this has to do with conditional compilation of proc macros using the flux_sysroot environment variable (seems like the proc macros are dummies during normal compilation). So I'm not quite sure what to do if I want to use those proc macros in the stdlib. I'm thinking that somehow, I need to prevent flux from actually running these macros during compilation (as is done by the proc macro crate). Do you have any ideas on how to do that? |
Hmm, I don't see why this isn't working 🤔 . I would have done the same. I'll take a look |
Oh, I see. It's tricky. I'm not sure what is the best way to fix it. As you mentioned, the crates in
In flux mode, all the proc macros get replaced by a All this is actually working. If you ignore the error you are getting with
So that's the issue, setting the en var will cause the proc macros in The bottom line is that we need to enable the |
The same applies for tests. Running |
On further thought, the only option is to prebuild it with one of our wrappers to generate the flux metadata file |
57c6b0e
to
2abb785
Compare
So you're saying that we need to build this using |
I'm not entirely sure this is the best way, but I'm saying that in |
9b97e05
to
bbf320b
Compare
bbf320b
to
43366f8
Compare
@nilehmann, Ok I think this works. One thing I noticed is that I am unable to use std attributes when using Also, I think the CI will need some tweaks. The tests etc work for me locally. |
No description provided.