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

Use vec![] for instantiate an empty vector in nonempty! macro #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

greyblake
Copy link

It fixes #68

I hope using vec![] should not be a big problem, cause vec![] is already used in another branch of the macro.

Thank you again for you work!

@FintanH
Copy link
Collaborator

FintanH commented Jan 6, 2025

Thanks for the contribution! @nuttycom would vec! work here, or would that mean that std is required? It seems like the no-std builds successfully, so perhaps it's fine!

@greyblake
Copy link
Author

@FintanH

vec![] is already used in another branch of the macro, so I would assume it does not make it worse :D

image

@nuttycom
Copy link
Contributor

nuttycom commented Jan 6, 2025 via email

@d-k-bo
Copy link

d-k-bo commented Jan 7, 2025

vec! itself is part of std

It is actually part of alloc: https://doc.rust-lang.org/alloc/macro.vec.html

It looks like it requires a #[macro_use] on alloc to compile, take a look at this example:

#![no_std]

#[macro_use]
extern crate alloc;

fn main() {
    vec![0];
}

@FintanH
Copy link
Collaborator

FintanH commented Jan 13, 2025

Ok, so afaiu this change is fine because the no-std actions check uses --no-default-features which means that std is not enabled, and all other dependencies are optional – so also not enabled – and it passes just fine :) I'll merge and push a hotfix version

@FintanH FintanH mentioned this pull request Jan 13, 2025
@greyblake
Copy link
Author

@FintanH Thanks!

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.

nonempty! with a single macro fails to compile
4 participants