Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upNeed a mechanism to write rust-version-specific code #3795
Comments
This comment has been minimized.
This comment has been minimized.
|
Nominating for maturity milestone 3 (feature-complete). |
This comment has been minimized.
This comment has been minimized.
|
I'd suggest it's more of a backwards-compatibility issue, figuring out how we wall off version incompatibility. |
This comment has been minimized.
This comment has been minimized.
|
This kind of thing is really useful for the RubySpec project. I don't think people will be building an alternate Rust any time soon, but it's also more comprehensive than the standard distribution's unit tests as well. Anyway. Just pointing it out since Rust is trying to learn so much from other languages. |
This comment has been minimized.
This comment has been minimized.
|
accepted for feature-complete milestone |
This comment has been minimized.
This comment has been minimized.
|
Still relevant. Note we have semver support in |
This comment has been minimized.
This comment has been minimized.
|
To implement this one just needs to, during cfg-stripping, compare any given rust_version to the current version. |
This comment has been minimized.
This comment has been minimized.
|
Accepted for 1.0, assigning P-backcompat-lang. |
This comment has been minimized.
This comment has been minimized.
|
cc #3392 |
This comment has been minimized.
This comment has been minimized.
kaseyc
referenced this issue
May 15, 2014
Closed
Add cfg for version based conditional compilation #14218
This comment has been minimized.
This comment has been minimized.
|
What do we need to do to get this moving again? This should probably take into account #3392, which calls for version markers at the top of source files. That issue may be covered simply by putting the tags described herein at the top of crate files. |
This comment has been minimized.
This comment has been minimized.
|
Someone needs to come up with a way to integrate this and put it in an RFC. It seems that trying to implement it in the current As for #3392, implementing this issue and using top level |
This comment has been minimized.
This comment has been minimized.
|
We don't need to support anything older than whatever we release as 1.0, so On Wed, Jun 11, 2014 at 5:43 PM, Kasey Carrothers notifications@github.com
|
This comment has been minimized.
This comment has been minimized.
|
(I agree that doing anything on less than per-crate granularity is the path to madness) |
This comment has been minimized.
This comment has been minimized.
|
Nominating for removing from milestone because I don't believe this is backwards incompatible. |
pcwalton
added
the
I-nominated
label
Jun 18, 2014
brson
added
P-low
and removed
I-nominated
labels
Jun 19, 2014
This comment has been minimized.
This comment has been minimized.
|
P-low, not 1.0. |
brson
removed this from the 1.0 milestone
Jun 26, 2014
This comment has been minimized.
This comment has been minimized.
|
A potential way to solve some of these use cases without impacting the language is to have cargo inject cfg variables related to crate versions (and remember a version of std is the same as the language version), e.g.:
It's very likely we can keep the language around crate files backwards compatible forever, so using something like this at the crate level could smooth over not just lib issues, but lang as well. |
This comment has been minimized.
This comment has been minimized.
|
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized. This issue has been moved to the RFCs repo: rust-lang/rfcs#700 |
erickt commentedOct 17, 2012
Since rust is still going through active development, it's hard to write a library that works for both rust-0.4 and rust-incoming. We need a cfg
#[cfg(rust_version="0.5")]to carve off chunks of code that have evolved in between versions.If we want to get more fancy with these controls, I do have an old semantic version parser I wrote back in the 0.3 days. Maybe we could use something like that to let us write checks like: