-
Notifications
You must be signed in to change notification settings - Fork 631
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
futures-core 1.0 release #2207
Comments
This all sounds great! One question I have is about the timing of a |
Even after the RFC has been merged, it can be changed with good reason, so it is a very difficult question at which stage to determine that. (The risk cannot be zero.) That said, "when the RFC is merged" is probably one of the reasonable timings. |
This sounds great to me. In general I'd prefer to start chopping some things from The only thing I'm unsure about is having |
In this proposal, once the std This idea originally mentioned in Async Interview #2:
UPDATE: Updated issue description to add a description of this in the |
I think to make it a forward-compatible update the build script must detect Alternatively this could be a documented "unchecked" future-incompatibility so that it's not compiler checked like that, but users are told that simultaneously implementing |
Yes, you are right.
Maybe a build-script like this could resolve the problem? // build.rs
#[cfg_accessible(core::?::Stream)] // `cfg_accessible` isn't stable so in practice we probably use `autocfg`.
println!("cargo:rustc-cfg=std_stream_trait");
// lib.rs
#[cfg(std_stream_trait)]
pub use core::?::Stream;
#[cfg(not(std_stream_trait))]
pub trait Stream {
// ...
} |
Another concern with using build-scripts is their compatibility with non-cargo build systems that do not run build-scripts. We may need to consider something like serde-rs/serde#1593 (support only the latest stable Rust on those build systems), but in any case, breakage may be unavoidable... (fwiw, we can check if build-script is run by unconditionally emitting rustc-cfg in build-script.) |
I don't understand why a build script would be needed if you're using cfg accessible. |
cfg-accessible isn't stable yet, and a stable alternative requires build-script, so I've written the above example using build-script. |
FYI: I've created a demo of how |
I'd still consider it a possibility that In particular, if Maybe that's an acceptable compromise? |
I also have concerns around the naming of |
Another item I think is worth discussing is the removal of Perhaps this should be outside of the |
@tmandry I understand your concerns, but basically, I don't think we really need to rename it.
@yoshuawuyts As I've mentioned several times, Fused* doesn't work as expected without min_specialization. I think there is not much benefit to having them until the min_specialization is stable. |
|
@taiki-e I'm not familiar with the argument, most likely because I don't use If we're uncertain about |
@Nemo157 Interesting. Do you think it's the timing when type_alias_impl_trait is stable? Or will it take longer? |
@yoshuawuyts One of the other problems is that it's difficult to propagate an implementation correctly from the underlying type without specialization. For example, in #2213, the current implementation is correct if the underlying types do not implement FusedFuture, but is incorrect if it is implemented. |
This isn't used. We could opt for implementing FusedFuture and FusedStream, but these traits seem incoherent [1] and are due to removal for futures-core 1.0 [2]. They're not needed, so just get rid of them. [1] rust-lang/futures-rs#2779 [2] rust-lang/futures-rs#2207
This is a proposal for the next major release of futures-core.
(I will open issues for other crates later. They are probably 0.4 instead of 1.0.)
About
I propose to further reduce the APIs of futures-core and only provide what is really stable.
This makes futures-core a shim crate that provides future/task-related APIs of the standard library.
Eventually (maybe after
core::stream::Stream
stabilized), only crates that need compatibility with older compilers will depend on futures-core, and other crates will not need to depend on futures-core.APIs provided by this crate
The following two kinds of APIs are provided:
This allows you to use items that are only available in the latest rustc, even if you are using an older version of rustc.
Stream
trait andready!
macro are probably the only exceptions to this.Other APIs are provided by individual
futures-*
crate.MSRV
APIs of this crate is really small, so it would be nice to be able to pin it to one of the following:
Every time the MSRV is increased, a new minor version is released.
Changes
Here is a list of proposed actual changes:
FusedFuture
,FusedStream
.select!
macro is replaced with the way suggested in select! without FusedFuture #1989.BoxFuture
,LocalBoxFuture
,BoxStream
,LocalBoxStream
); pending in Move type/trait aliases to futures-util #2344futures-util
.Pin<Box>
ed future/stream.TryFuture
,TryStream
); pending in Move type/trait aliases to futures-util #2344futures-util
.Result
, but the real trait aliases are not yet stable, so they have some limitations. See doc: calling TryStreamExt methods on !Unpin values #2200 for one of the limitations.Stream
traitStream
trait is stable,futures_core::Stream
is replaced with re-export from the standard library. (In the version that has stable std Stream, std Stream and futures_core::Stream is the same trait.)* Addnext
method fromStreamExt
.Stream
changes after futures-core 1.0 is released.)StreamExt
/TryStreamExt
. There is no general agreement on those APIs. Especialy, async closure vs normal closure.ready!
macroready!
macro maybecore::task::ready!
instead ofcore::ready!
, butfutures-core
expose this at top-revel.Because:
futures-core
provides only future/task-related items.Wake
traitArcWake
, and defined infutures-task
.core::task::Wake
trait stable, re-export/define infutures-core
.From
-impl may not be available in the old version, so provide conversion utilities (waker
,waker_ref
) infutures-task
orfutures-util
.std::{future, task, stream}
futures-core
.futures-util
. (Be careful with minimal-versions to avoid compile failure.)EDIT1: Clarified
futures_core::Stream
changes when stdStream
is stable. (originally only described in "about" section's "APIs not yet stable in the standard library")cc @cramertj @Nemo157 @seanmonstar
FYI @rust-lang/wg-async-foundations
The text was updated successfully, but these errors were encountered: