diff options
| author | bors <bors@rust-lang.org> | 2020-03-21 04:34:04 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-03-21 04:34:04 +0000 |
| commit | 5f13820478907b09d50baf74f3ff2b78499ecd6c (patch) | |
| tree | f8a09a299d9c7e09f562913e7aadefd3c4f12f0e /src/libstd | |
| parent | 1057dc97afce39ff6a224966ece3ed438af4c1f5 (diff) | |
| parent | 54285db640453d2beec91423cb8cc792f52797f2 (diff) | |
| download | rust-5f13820478907b09d50baf74f3ff2b78499ecd6c.tar.gz rust-5f13820478907b09d50baf74f3ff2b78499ecd6c.zip | |
Auto merge of #70205 - Centril:rollup-0jq9k4s, r=Centril
Rollup of 16 pull requests
Successful merges:
- #65097 (Make std::sync::Arc compatible with ThreadSanitizer)
- #69033 (Use generator resume arguments in the async/await lowering)
- #69997 (add `Option::{zip,zip_with}` methods under "option_zip" gate)
- #70038 (Remove the call that makes miri fail)
- #70058 (can_begin_literal_maybe_minus: `true` on `"-"? lit` NTs.)
- #70111 (BTreeMap: remove shared root)
- #70139 (add delay_span_bug to TransmuteSizeDiff, just to be sure)
- #70165 (Remove the erase regions MIR transform)
- #70166 (Derive PartialEq, Eq and Hash for RangeInclusive)
- #70176 (Add tests for #58319 and #65131)
- #70177 (Fix oudated comment for NamedRegionMap)
- #70184 (expand_include: set `.directory` to dir of included file.)
- #70187 (more clippy fixes)
- #70188 (Clean up E0439 explanation)
- #70189 (Abi::is_signed: assert that we are a Scalar)
- #70194 (#[must_use] on split_off())
Failed merges:
r? @ghost
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/backtrace.rs | 2 | ||||
| -rw-r--r-- | src/libstd/future.rs | 25 | ||||
| -rw-r--r-- | src/libstd/sys_common/backtrace.rs | 2 |
3 files changed, 20 insertions, 9 deletions
diff --git a/src/libstd/backtrace.rs b/src/libstd/backtrace.rs index 34317c7a2ee..e10d466030f 100644 --- a/src/libstd/backtrace.rs +++ b/src/libstd/backtrace.rs @@ -250,7 +250,7 @@ impl Backtrace { }, }; ENABLED.store(enabled as usize + 1, SeqCst); - return enabled; + enabled } /// Capture a stack backtrace of the current thread. diff --git a/src/libstd/future.rs b/src/libstd/future.rs index c1ca6771326..c0675eeba98 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -1,12 +1,14 @@ //! Asynchronous values. -use core::cell::Cell; -use core::marker::Unpin; -use core::ops::{Drop, Generator, GeneratorState}; -use core::option::Option; -use core::pin::Pin; -use core::ptr::NonNull; -use core::task::{Context, Poll}; +#[cfg(bootstrap)] +use core::{ + cell::Cell, + marker::Unpin, + ops::{Drop, Generator, GeneratorState}, + pin::Pin, + ptr::NonNull, + task::{Context, Poll}, +}; #[doc(inline)] #[stable(feature = "futures_api", since = "1.36.0")] @@ -17,6 +19,7 @@ pub use core::future::*; /// This function returns a `GenFuture` underneath, but hides it in `impl Trait` to give /// better error messages (`impl Future` rather than `GenFuture<[closure.....]>`). // This is `const` to avoid extra errors after we recover from `const async fn` +#[cfg(bootstrap)] #[doc(hidden)] #[unstable(feature = "gen_future", issue = "50547")] pub const fn from_generator<T: Generator<Yield = ()>>(x: T) -> impl Future<Output = T::Return> { @@ -24,6 +27,7 @@ pub const fn from_generator<T: Generator<Yield = ()>>(x: T) -> impl Future<Outpu } /// A wrapper around generators used to implement `Future` for `async`/`await` code. +#[cfg(bootstrap)] #[doc(hidden)] #[unstable(feature = "gen_future", issue = "50547")] #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] @@ -31,8 +35,10 @@ struct GenFuture<T: Generator<Yield = ()>>(T); // We rely on the fact that async/await futures are immovable in order to create // self-referential borrows in the underlying generator. +#[cfg(bootstrap)] impl<T: Generator<Yield = ()>> !Unpin for GenFuture<T> {} +#[cfg(bootstrap)] #[doc(hidden)] #[unstable(feature = "gen_future", issue = "50547")] impl<T: Generator<Yield = ()>> Future for GenFuture<T> { @@ -48,12 +54,15 @@ impl<T: Generator<Yield = ()>> Future for GenFuture<T> { } } +#[cfg(bootstrap)] thread_local! { static TLS_CX: Cell<Option<NonNull<Context<'static>>>> = Cell::new(None); } +#[cfg(bootstrap)] struct SetOnDrop(Option<NonNull<Context<'static>>>); +#[cfg(bootstrap)] impl Drop for SetOnDrop { fn drop(&mut self) { TLS_CX.with(|tls_cx| { @@ -64,6 +73,7 @@ impl Drop for SetOnDrop { // Safety: the returned guard must drop before `cx` is dropped and before // any previous guard is dropped. +#[cfg(bootstrap)] unsafe fn set_task_context(cx: &mut Context<'_>) -> SetOnDrop { // transmute the context's lifetime to 'static so we can store it. let cx = core::mem::transmute::<&mut Context<'_>, &mut Context<'static>>(cx); @@ -71,6 +81,7 @@ unsafe fn set_task_context(cx: &mut Context<'_>) -> SetOnDrop { SetOnDrop(old_cx) } +#[cfg(bootstrap)] #[doc(hidden)] #[unstable(feature = "gen_future", issue = "50547")] /// Polls a future in the current thread-local task waker. diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 2c7ba8f8ea1..e9b1e86d7ae 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -28,7 +28,7 @@ pub fn lock() -> impl Drop { unsafe { LOCK.lock(); - return Guard; + Guard } } |
