Proposal
Problem statement
cfg-if is one of the most widely used macro crates. it is as ubiquitous as it is simple, and it is also essentially "done", staying at 1.0.0 for 4 years.
however, external dependencies are never free, adding an extra http request to check for the latest version, an extra rustc invocation, as well as complicating the build process for projects that don't use cargo.
Motivating examples or use cases
the core library actually uses cfg_if 15 times, and the standard library uses it 65 times. however, because core is not allowed to have dependencies, this means that they are actually using separate, (but identical) macros.
Solution sketch
make the copy of cfg_if in core the definitive version, and make std depend on that.
Alternatives
- add it to the
std facade, and add it as a seperate sysroot crate.
- wait for
cfg_match to be stablized
Links and related work
https://crates.io/crates/cfg-if
What happens now?
This issue contains an API change proposal (or ACP) and is part of the libs-api team feature lifecycle. Once this issue is filed, the libs-api team will review open proposals as capability becomes available. Current response times do not have a clear estimate, but may be up to several months.
Possible responses
The libs team may respond in various different ways. First, the team will consider the problem (this doesn't require any concrete solution or alternatives to have been proposed):
- We think this problem seems worth solving, and the standard library might be the right place to solve it.
- We think that this probably doesn't belong in the standard library.
Second, if there's a concrete solution:
- We think this specific solution looks roughly right, approved, you or someone else should implement this. (Further review will still happen on the subsequent implementation PR.)
- We're not sure this is the right solution, and the alternatives or other materials don't give us enough information to be sure about that. Here are some questions we have that aren't answered, or rough ideas about alternatives we'd want to see discussed.
Proposal
Problem statement
cfg-ifis one of the most widely used macro crates. it is as ubiquitous as it is simple, and it is also essentially "done", staying at 1.0.0 for 4 years.however, external dependencies are never free, adding an extra http request to check for the latest version, an extra
rustcinvocation, as well as complicating the build process for projects that don't use cargo.Motivating examples or use cases
the
corelibrary actually usescfg_if15 times, and the standard library uses it 65 times. however, becausecoreis not allowed to have dependencies, this means that they are actually using separate, (but identical) macros.Solution sketch
make the copy of
cfg_ifincorethe definitive version, and makestddepend on that.Alternatives
stdfacade, and add it as a seperate sysroot crate.cfg_matchto be stablizedLinks and related work
https://crates.io/crates/cfg-if
What happens now?
This issue contains an API change proposal (or ACP) and is part of the libs-api team feature lifecycle. Once this issue is filed, the libs-api team will review open proposals as capability becomes available. Current response times do not have a clear estimate, but may be up to several months.
Possible responses
The libs team may respond in various different ways. First, the team will consider the problem (this doesn't require any concrete solution or alternatives to have been proposed):
Second, if there's a concrete solution: