-
Notifications
You must be signed in to change notification settings - Fork 635
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
Replace Never
with !
#897
Comments
Unfortunately this would also bump up the version of Rust required to use futures, so we probably won't make this change right away. |
Isn't that OK to do on a breaking release? |
@carllerche My concern is not so much about breakage as that (1) futures is intended to be a foundational library and (2) this change doesn't buy us very much. I'd prefer not to impose stronger requirements on rustc versions unless there's a clear need for it. |
As a counterpoint, futures is a library with a lot of visibility and lots of people will be looking at it as an example of library design in Rust, and so it could be a good idea to use it to showcase idiomatic Rust, which I'd expect to include shedding old baggage when the language offers a proper route to take to avoid old hacks. In other words, when people ask, "Why would you need the never type?" you can point to a high-profile real-world example here in futures. Furthermore, supporting pre-never-type rustc seems like a conflicting goal given that futures 1.0 and the larger Rust async stack is being closely tied to the Rust 2018 era. |
I agree, As a compromise proposal, we can let |
The stabilized feature isn't released yet afaict, and it will probably take some weeks until 1.0.26. Apart from that I disagree with the "don't want to use latest stable features because it would bump the required Rust version" (although I'd very much like to see rust-lang/cargo#2751; if a "non-breaking" crate update suddenly requires a new rust version you'll have a very bad time finding working crate versions on older rustc). Also I'm pretty sure over the year there will be a lot of features in rust that But if you really want to go that way, please note that the current And afaict it will be impossible to replace without breakage if crates (like this one) use things like |
Luckily cargo disables the ability for dependencies to |
I think it is a bad idea to make Never two different types depending on the "nightly" feature as done in stbuehler@hide-never-impl-for-std-never-alias. It would make the non-nightly and nightly versions slightly incompatible with each other, like proc-macro2 0.2.x did. Adding an extra feature should not break compatibility (if different dependencies depend on different features of the same crate then the union of the feature sets will be used). If there are really no cases where changing to nightly could break any valid code then ok of course. |
I admit I'm not completely sure what the I don't think the But actually using |
But it wouldn't be fully compatible unfortunately. For example the following code would be perfectly valid (and possibly sane for a crate using some custom error handling) for the non-nightly version but would fail to compile due to conflicting implementations on nightly. struct MyError;
impl From<Never> for MyError {
fn from(_: Never) -> Self {
unreachable!()
}
}
impl From<!> for MyError {
fn from(_: !) -> Self {
unreachable!()
}
} IMHO the |
Good point (about the conflicting |
@stbuehler Not really. I think this change should be somehow tied to the Rust 2018 edition, with a new major release (like 0.3 or 1.0), in which case it should not be a problem to increase min rustc version. (It would be great to require that for async/await support on stable too). Though I think it would be not that bad to require new stable compiler when bumping to 0.2, I can see why some people are against it. |
This should have the same resolution as rust-lang/rust#49039. (It doesn't seem to be decided yet) |
It seems that the issue is superseded by the approach of |
Recently, [features(never_type)] is stabilized in rustc master branch. PR Link
And I remember that
Never
type infutures
is a temporary replacement for!
. Now!
type is stabilized and shall we proceed to replaceNever
with!
?The text was updated successfully, but these errors were encountered: