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 upMake `i128` support automatic #250
Comments
This comment has been minimized.
This comment has been minimized.
|
Since build scripts cannot enable features, this would actually require that @BurntSushi's byteorder also use auto-detection, and then that |
This comment has been minimized.
This comment has been minimized.
BurntSushi
commented
Oct 4, 2018
•
|
I agree it would be nice to have auto detection here. It looks like In terms of auto detection, what are we thinking here? We could use |
This comment has been minimized.
This comment has been minimized.
|
We haven't had any issues — but I don't believe this implemented for the 0.5 release, and 0.6 is still pending, so it hasn't had a lot of testing. |
This comment has been minimized.
This comment has been minimized.
|
As @newpavlov points out, we shouldn't have to depend on Users of old (pre-1.26) stable compilers can't use I was going to add (2), users may not notice when they do something losing backwards compatibility. But (a) the only way to ensure this is to test and (b) Conclusion: I don't think there's any reason not to do this. |
This comment has been minimized.
This comment has been minimized.
|
This seems reasonable to me; If @BurntSushi thinks that this is a good solution for byteorder, I'll implement it for bincode. |
This comment has been minimized.
This comment has been minimized.
BurntSushi
commented
Oct 12, 2018
|
Yeah I've tried hard to think about downsides to this. Changing the public API of a library based on the compiler version makes me very nervous, but I'm having a hard time finding concrete examples to justify it. One thing that pops to mind is viewing the docs for a library which contain new API items because the docs were generated with a newer compiler, while developing on an older compiler and being surprised when a public API item isn't available. AIUI, I think the first error message they'll see is "some_thing is not available" rather than "some_thing uses u128 which isn't available on your Rust 1.22 compiler." So I could see the failure modes being pretty mystifying here. I don't know how heavily to weight them though. Since this is going to impact foundational crates, I'd feel more comfortable if we got more eyes on this issue. I opened an internals thread: https://internals.rust-lang.org/t/trade-offs-for-adding-new-apis-based-on-compiler-version/8549 |
This comment has been minimized.
This comment has been minimized.
|
Could we please move forward with this? There has been no further discussion in the internals thread since October. I recognise the doc problem; probably the best solution is to mention the Rustc version requirement in the doc (which already happens for the |
This comment has been minimized.
This comment has been minimized.
BurntSushi
commented
Jan 3, 2019
|
@dhardy Oh, sorry, I had assumed that my comment here meant that I was good with version sniffing and automatically adding |
This comment has been minimized.
This comment has been minimized.
|
It should be even easier than that; please see this PR: rust-random/rand#664 @TyOverby would you like to prepare this for both crates? Otherwise I can make a PR. |
This comment has been minimized.
This comment has been minimized.
BurntSushi
commented
Jan 3, 2019
|
Interesting. I linked to the way I did it in regex to specifically avoid adding a new crate dep, but I hadn't seen |
This comment has been minimized.
This comment has been minimized.
|
I do basically the way regex does it (for example here in serde and here in syn). But I like autocfg and wouldn't mind if it takes off. Whether you use it will depend on whether you want to be an early adopter (where people might notice the extra 1 second compile time or decide not to use your crate because managing two external crates in their non-Cargo build environment isn't worth it) or a late adopter (by which time every nontrivial project already pulls in autocfg anyway). |
This comment has been minimized.
This comment has been minimized.
BurntSushi
commented
Jan 3, 2019
|
@dtolnay Thanks for your thoughts! That's a good point about early/late adopter. For byteorder, it's probably a good idea to be a late adopter. Although, I could see using it for regex since it already has several external crate dependencies. |
BurntSushi
added a commit
to BurntSushi/byteorder
that referenced
this issue
Jan 19, 2019
BurntSushi
added a commit
to BurntSushi/byteorder
that referenced
this issue
Jan 19, 2019
BurntSushi
added a commit
to BurntSushi/byteorder
that referenced
this issue
Jan 19, 2019
This comment has been minimized.
This comment has been minimized.
BurntSushi
commented
Jan 19, 2019
|
|
dhardy commentedOct 4, 2018
To revisit #236, it would be more convenient for users if
i128support was enabled automatically on compatible compilers. We already argued in July that this was the best option for Rand.The linked PR shows how this can be achieved without any breakage (except for old nightlies, which are generally not possible to ensure support for anyway).