-
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
Use vec![] for instantiate an empty vector in nonempty! macro #69
base: master
Are you sure you want to change the base?
Use vec![] for instantiate an empty vector in nonempty! macro #69
Conversation
Thanks for the contribution! @nuttycom would |
|
Hmmm, I am not sure here. I think the existing use of `vec` may actually
be a bug, I just didn’t notice it because there there are no uses of the
`nonempty` macro in a context where no-std is enforced and not
automatically enabled.
`vec!` itself is part of `std`:
https://doc.rust-lang.org/std/macro.vec.html
So it could be that you can’t use the macro in a no-std context, but
because it’s a macro if it’s never used there is no problem.
What is probably needed to demonstrate the issue is a CI task like the one
I added here:
zcash/orchard#450 but with the generated lib.rs file containing some code that invokes the `nonempty` macro.
I'm not sure what the best way to make sure that `extern crate alloc` is added to the generated code is, though.
…On Mon, Jan 6, 2025 at 8:18 PM Serhii Potapov ***@***.***> wrote:
@FintanH <https://github.com/FintanH>
vec![] is already used in another branch of the macro, so I would assume
it does not make it worse :D
image.png (view on web)
<https://github.com/user-attachments/assets/1acb9b23-78dd-4daf-8b89-b61ccadac33d>
—
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAGXR3Q6OZKCU7KUAWHZC32JLCHVAVCNFSM6AAAAABUB3IE6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZTGY2TSMJYGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It is actually part of It looks like it requires a #![no_std]
#[macro_use]
extern crate alloc;
fn main() {
vec![0];
} |
Ok, so afaiu this change is fine because the |
@FintanH Thanks! |
It fixes #68
I hope using
vec![]
should not be a big problem, causevec![]
is already used in another branch of the macro.Thank you again for you work!