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

std is been pulled as dependecy, even without any backends #47

Closed
lassade opened this issue Mar 12, 2023 · 4 comments
Closed

std is been pulled as dependecy, even without any backends #47

lassade opened this issue Mar 12, 2023 · 4 comments

Comments

@lassade
Copy link

lassade commented Mar 12, 2023

profiling = "1.0.7" with no extra features can't be built with:

cargo build -r --target=x86_64-pc-windows-msvc -Z build-std=core,compiler_builtins,alloc,panic_abort

I something like profiling::scope!("sort"); shouldn't be generating any code at all but for some reason the compiles keeps liking std any ideas why?

@aclysma
Copy link
Owner

aclysma commented Mar 12, 2023

I think no_std has to be opted into with #![no_std]. It controls linking so I could see it only need to be used in the binary crate but I have little experience with it. Does it need to be present in all dependencies? May be worth checking with cargo tree that there aren’t any dependencies or dev-dependencies being brought in?

@lassade
Copy link
Author

lassade commented Mar 12, 2023

Nop there is no other std dependency.

This is happening because profiling doesn't have a #![no_std] so even though no code is been generated from the macros the std is still pulled into the dependency. That doesn't show on cargo tree :)

It is possible this crate to no_std maybe supporting only a couple of backends?

@aclysma
Copy link
Owner

aclysma commented Mar 12, 2023

I don’t mind having this crate opt into no_std for when no backend is enabled or if there is a backend that doesn’t need std. I don’t know if any of the backends would support it though. If you want to PR something related to this I’d be happy to look! I’m not currently using rust on platforms that don’t have std so I’m not sure if/when I would find time to do this myself.

@lassade lassade changed the title Macros even when no feature is enabled pull std std is been pulled as dependecy, even without any backends Mar 12, 2023
@aclysma
Copy link
Owner

aclysma commented Mar 18, 2023

Completed in #49

@lassade lassade closed this as completed Mar 18, 2023
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 a pull request may close this issue.

2 participants