Skip to content

Commit 0701419

Browse files
committed
Auto merge of rust-lang#74493 - Manishearth:rollup-ust7yr4, r=Manishearth
Rollup of 7 pull requests Successful merges: - rust-lang#70817 (Add core::task::ready! macro) - rust-lang#73762 (Document the trait keyword) - rust-lang#74021 (impl Index<RangeFrom> for CStr) - rust-lang#74071 (rustc_metadata: Make crate loading fully speculative) - rust-lang#74445 (add test for rust-lang#62878) - rust-lang#74459 (Make unreachable_unchecked a const fn) - rust-lang#74478 (Revert "Use an UTF-8 locale for the linker.") Failed merges: r? @ghost
2 parents 1fa54ad + a83e294 commit 0701419

31 files changed

+892
-550
lines changed

src/libcore/hint.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ use crate::intrinsics;
4545
/// ```
4646
#[inline]
4747
#[stable(feature = "unreachable", since = "1.27.0")]
48-
pub unsafe fn unreachable_unchecked() -> ! {
48+
#[rustc_const_unstable(feature = "const_unreachable_unchecked", issue = "53188")]
49+
pub const unsafe fn unreachable_unchecked() -> ! {
4950
// SAFETY: the safety contract for `intrinsics::unreachable` must
5051
// be upheld by the caller.
5152
unsafe { intrinsics::unreachable() }

src/libcore/intrinsics.rs

+1
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,7 @@ extern "rust-intrinsic" {
932932
///
933933
/// The stabilized version of this intrinsic is
934934
/// [`std::hint::unreachable_unchecked`](../../std/hint/fn.unreachable_unchecked.html).
935+
#[rustc_const_unstable(feature = "const_unreachable_unchecked", issue = "53188")]
935936
pub fn unreachable() -> !;
936937

937938
/// Informs the optimizer that a condition is always true.

src/libcore/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#![feature(const_slice_ptr_len)]
9393
#![feature(const_type_name)]
9494
#![feature(const_likely)]
95+
#![feature(const_unreachable_unchecked)]
9596
#![feature(custom_inner_attributes)]
9697
#![feature(decl_macro)]
9798
#![feature(doc_cfg)]

src/libcore/task/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ pub use self::poll::Poll;
99
mod wake;
1010
#[stable(feature = "futures_api", since = "1.36.0")]
1111
pub use self::wake::{Context, RawWaker, RawWakerVTable, Waker};
12+
13+
mod ready;
14+
#[unstable(feature = "ready_macro", issue = "70922")]
15+
pub use ready::ready;

src/libcore/task/ready.rs

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/// Extracts the successful type of a `Poll<T>`.
2+
///
3+
/// This macro bakes in propagation of `Pending` signals by returning early.
4+
///
5+
/// # Examples
6+
///
7+
/// ```
8+
/// #![feature(future_readiness_fns)]
9+
/// #![feature(ready_macro)]
10+
///
11+
/// use core::task::{ready, Context, Poll};
12+
/// use core::future::{self, Future};
13+
/// use core::pin::Pin;
14+
///
15+
/// pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
16+
/// let mut fut = future::ready(42);
17+
/// let fut = Pin::new(&mut fut);
18+
///
19+
/// let num = ready!(fut.poll(cx));
20+
/// # drop(num);
21+
/// // ... use num
22+
///
23+
/// Poll::Ready(())
24+
/// }
25+
/// ```
26+
///
27+
/// The `ready!` call expands to:
28+
///
29+
/// ```
30+
/// # #![feature(future_readiness_fns)]
31+
/// # #![feature(ready_macro)]
32+
/// #
33+
/// # use core::task::{Context, Poll};
34+
/// # use core::future::{self, Future};
35+
/// # use core::pin::Pin;
36+
/// #
37+
/// # pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
38+
/// # let mut fut = future::ready(42);
39+
/// # let fut = Pin::new(&mut fut);
40+
/// #
41+
/// let num = match fut.poll(cx) {
42+
/// Poll::Ready(t) => t,
43+
/// Poll::Pending => return Poll::Pending,
44+
/// };
45+
/// # drop(num);
46+
/// # // ... use num
47+
/// #
48+
/// # Poll::Ready(())
49+
/// # }
50+
/// ```
51+
#[unstable(feature = "ready_macro", issue = "70922")]
52+
#[rustc_macro_transparency = "semitransparent"]
53+
pub macro ready($e:expr) {
54+
match $e {
55+
$crate::task::Poll::Ready(t) => t,
56+
$crate::task::Poll::Pending => {
57+
return $crate::task::Poll::Pending;
58+
}
59+
}
60+
}

src/librustc_codegen_ssa/back/linker.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ use rustc_target::spec::{LinkOutputKind, LinkerFlavor, LldFlavor};
2828
pub fn disable_localization(linker: &mut Command) {
2929
// No harm in setting both env vars simultaneously.
3030
// Unix-style linkers.
31-
// We use an UTF-8 locale, as the generic C locale disables support for non-ASCII
32-
// bytes in filenames on some platforms.
33-
linker.env("LC_ALL", "en_US.UTF-8");
31+
linker.env("LC_ALL", "C");
3432
// MSVC's `link.exe`.
3533
linker.env("VSLANG", "1033");
3634
}

src/librustc_error_codes/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ E0770: include_str!("./error_codes/E0770.md"),
554554
// E0420, merged into 532
555555
// E0421, merged into 531
556556
// E0427, merged into 530
557-
E0456, // plugin `..` is not available for triple `..`
557+
// E0456, // plugin `..` is not available for triple `..`
558558
E0457, // plugin `..` only found in rlib format, but must be available...
559559
E0460, // found possibly newer version of crate `..`
560560
E0461, // couldn't find crate `..` with expected target triple ..

0 commit comments

Comments
 (0)