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

Move cfg_if macro from libstd to libcore #57446

Closed
dlrobertson opened this issue Jan 8, 2019 · 5 comments
Closed

Move cfg_if macro from libstd to libcore #57446

dlrobertson opened this issue Jan 8, 2019 · 5 comments
Labels
T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@dlrobertson
Copy link
Contributor

Summary

If possible I would like to move the cfg_if macro from src/libstd/macros.rs to src/libcore/macros.rs.

Motivation

The cfg_if macro could potentially increase the readability of some cfgs in no_std code. In particular it could dramatically improve the readability of some code in libcore e.g. ffi::VaList (why I'm interested in moving it 😄). I don't see anything in the macro that would make it invalid in libcore.

@alexcrichton
Copy link
Member

Unfortunately we don't have a great way to export a macro from libcore to use in libstd that isn't part of the public API. We aren't quite ready yet I think to make this part of the public API but duplicating the definition should be fine as its a pretty simple macro

@dlrobertson
Copy link
Contributor Author

@alexcrichton 👍 Thanks for the info. I'll hold off on duplicating it in libstd until I know I need it then.

@estebank estebank added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Jan 8, 2019
@joshtriplett joshtriplett added I-nominated T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-lang Relevant to the language team, which will review and decide on the PR/issue. I-nominated labels Jan 10, 2019
@djc
Copy link
Contributor

djc commented Nov 6, 2019

@alexcrichton can you elaborate on why we don't want to make cfg_if public? It came up recently in the left-pad index dicussions, seems like it would be good to expose this publicly in std and core.

@alexcrichton
Copy link
Member

More discussion about this is at #59443 as well. I do not personally have an opinion on whether or not this should be exported from core or not. I don't personally have the motivation to push for that stabilization and/or inclusion myself.

@Mark-Simulacrum
Copy link
Member

I am going to close this issue as it's been somewhat obsoleted by the fact that libstd depends on cfg-if (the crate) now, and libcore can always duplicate if necessary. I imagine we might even be able to get libcore to depend on cfg-if (since it's a macro-only crate I believe), but that's likely harder :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants