Skip to content

Commit b202882

Browse files
committed
Auto merge of #53433 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests Successful merges: - #52946 (Documented impl From on line 367 of libserialize/json.rs) - #53234 (Remove Travis shutdown debug scripts, and remove CI-specific DNS settings) - #53313 (Two small improvements) - #53360 (Addressed #51602) - #53364 (Warn if the user tries to use GATs) - #53373 (Tweak unclosed delimiter parser error) - #53377 (std: Use target_pointer_width for BACKTRACE_ELF_SIZE) - #53395 (Use #[non_exhaustive] on internal enums) - #53399 (Tidy: ignore non-Markdown files when linting for the Unstable Book) - #53412 (syntax_ext: remove leftover span_err_if_not_stage0 macro.)
2 parents b559042 + a68e61a commit b202882

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+297
-245
lines changed

.travis.yml

-6
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,6 @@ before_install:
218218
echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json;
219219
sudo service docker restart;
220220
fi
221-
- date
222-
- sudo atq || true
223-
- sudo grep -rE 'shutdown|poweroff|halt' /var/spool/cron || true
224-
- sudo grep -E 'google-clock-skew|ntpd|startup-script' /var/log/syslog || true
225221

226222
install:
227223
- case "$TRAVIS_OS_NAME" in
@@ -278,8 +274,6 @@ after_success:
278274
du . | sort -nr | head -n100
279275
280276
after_failure:
281-
# Requested by travis to debug "shutting down NOW" errors
282-
- sudo tail -n 500 /var/log/syslog
283277
- >
284278
echo "#### Build failed; Disk usage after running script:";
285279
df -h;

src/Cargo.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ name = "backtrace"
100100
version = "0.3.9"
101101
source = "registry+https://github.com/rust-lang/crates.io-index"
102102
dependencies = [
103-
"backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
103+
"backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)",
104104
"cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
105105
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
106106
"rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -109,7 +109,7 @@ dependencies = [
109109

110110
[[package]]
111111
name = "backtrace-sys"
112-
version = "0.1.23"
112+
version = "0.1.24"
113113
source = "registry+https://github.com/rust-lang/crates.io-index"
114114
dependencies = [
115115
"cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3125,7 +3125,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31253125
"checksum assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98589b0e465a6c510d95fceebd365bb79bedece7f6e18a480897f2015f85ec51"
31263126
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
31273127
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
3128-
"checksum backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "bff67d0c06556c0b8e6b5f090f0eac52d950d9dfd1d35ba04e4ca3543eaf6a7e"
3128+
"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
31293129
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
31303130
"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789"
31313131
"checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32"

src/ci/docker/run.sh

-4
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ fi
119119
# goes ahead and sets it for all builders.
120120
args="$args --privileged"
121121

122-
if [ "$CI" != "" ]; then
123-
args="$args --dns 8.8.8.8 --dns 8.8.4.4 --dns 1.1.1.1 --dns 1.0.0.1"
124-
fi
125-
126122
exec docker \
127123
run \
128124
--volume "$root_dir:/checkout:ro" \

src/doc/unstable-book/src/library-features/future-atomic-orderings.md

-5
This file was deleted.

src/doc/unstable-book/src/library-features/io-error-internals.md

-5
This file was deleted.

src/libcore/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
#![feature(const_slice_len)]
121121
#![feature(const_str_as_bytes)]
122122
#![feature(const_str_len)]
123+
#![feature(non_exhaustive)]
123124

124125
#[prelude_import]
125126
#[allow(unused)]

src/libcore/sync/atomic.rs

+1-24
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ unsafe impl<T> Sync for AtomicPtr<T> {}
185185
/// [nomicon]: ../../../nomicon/atomics.html
186186
#[stable(feature = "rust1", since = "1.0.0")]
187187
#[derive(Copy, Clone, Debug)]
188+
#[non_exhaustive]
188189
pub enum Ordering {
189190
/// No ordering constraints, only atomic operations.
190191
///
@@ -256,10 +257,6 @@ pub enum Ordering {
256257
/// [`AcqRel`]: https://llvm.org/docs/Atomics.html#acquirerelease
257258
#[stable(feature = "rust1", since = "1.0.0")]
258259
SeqCst,
259-
// Prevent exhaustive matching to allow for future extension
260-
#[doc(hidden)]
261-
#[unstable(feature = "future_atomic_orderings", issue = "0")]
262-
__Nonexhaustive,
263260
}
264261

265262
/// An [`AtomicBool`] initialized to `false`.
@@ -1954,7 +1951,6 @@ fn strongest_failure_ordering(order: Ordering) -> Ordering {
19541951
SeqCst => SeqCst,
19551952
Acquire => Acquire,
19561953
AcqRel => Acquire,
1957-
__Nonexhaustive => __Nonexhaustive,
19581954
}
19591955
}
19601956

@@ -1966,7 +1962,6 @@ unsafe fn atomic_store<T>(dst: *mut T, val: T, order: Ordering) {
19661962
SeqCst => intrinsics::atomic_store(dst, val),
19671963
Acquire => panic!("there is no such thing as an acquire store"),
19681964
AcqRel => panic!("there is no such thing as an acquire/release store"),
1969-
__Nonexhaustive => panic!("invalid memory ordering"),
19701965
}
19711966
}
19721967

@@ -1978,7 +1973,6 @@ unsafe fn atomic_load<T>(dst: *const T, order: Ordering) -> T {
19781973
SeqCst => intrinsics::atomic_load(dst),
19791974
Release => panic!("there is no such thing as a release load"),
19801975
AcqRel => panic!("there is no such thing as an acquire/release load"),
1981-
__Nonexhaustive => panic!("invalid memory ordering"),
19821976
}
19831977
}
19841978

@@ -1991,7 +1985,6 @@ unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T {
19911985
AcqRel => intrinsics::atomic_xchg_acqrel(dst, val),
19921986
Relaxed => intrinsics::atomic_xchg_relaxed(dst, val),
19931987
SeqCst => intrinsics::atomic_xchg(dst, val),
1994-
__Nonexhaustive => panic!("invalid memory ordering"),
19951988
}
19961989
}
19971990

@@ -2004,7 +1997,6 @@ unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
20041997
AcqRel => intrinsics::atomic_xadd_acqrel(dst, val),
20051998
Relaxed => intrinsics::atomic_xadd_relaxed(dst, val),
20061999
SeqCst => intrinsics::atomic_xadd(dst, val),
2007-
__Nonexhaustive => panic!("invalid memory ordering"),
20082000
}
20092001
}
20102002

@@ -2017,7 +2009,6 @@ unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
20172009
AcqRel => intrinsics::atomic_xsub_acqrel(dst, val),
20182010
Relaxed => intrinsics::atomic_xsub_relaxed(dst, val),
20192011
SeqCst => intrinsics::atomic_xsub(dst, val),
2020-
__Nonexhaustive => panic!("invalid memory ordering"),
20212012
}
20222013
}
20232014

@@ -2039,8 +2030,6 @@ unsafe fn atomic_compare_exchange<T>(dst: *mut T,
20392030
(AcqRel, Relaxed) => intrinsics::atomic_cxchg_acqrel_failrelaxed(dst, old, new),
20402031
(SeqCst, Relaxed) => intrinsics::atomic_cxchg_failrelaxed(dst, old, new),
20412032
(SeqCst, Acquire) => intrinsics::atomic_cxchg_failacq(dst, old, new),
2042-
(__Nonexhaustive, _) => panic!("invalid memory ordering"),
2043-
(_, __Nonexhaustive) => panic!("invalid memory ordering"),
20442033
(_, AcqRel) => panic!("there is no such thing as an acquire/release failure ordering"),
20452034
(_, Release) => panic!("there is no such thing as a release failure ordering"),
20462035
_ => panic!("a failure ordering can't be stronger than a success ordering"),
@@ -2065,8 +2054,6 @@ unsafe fn atomic_compare_exchange_weak<T>(dst: *mut T,
20652054
(AcqRel, Relaxed) => intrinsics::atomic_cxchgweak_acqrel_failrelaxed(dst, old, new),
20662055
(SeqCst, Relaxed) => intrinsics::atomic_cxchgweak_failrelaxed(dst, old, new),
20672056
(SeqCst, Acquire) => intrinsics::atomic_cxchgweak_failacq(dst, old, new),
2068-
(__Nonexhaustive, _) => panic!("invalid memory ordering"),
2069-
(_, __Nonexhaustive) => panic!("invalid memory ordering"),
20702057
(_, AcqRel) => panic!("there is no such thing as an acquire/release failure ordering"),
20712058
(_, Release) => panic!("there is no such thing as a release failure ordering"),
20722059
_ => panic!("a failure ordering can't be stronger than a success ordering"),
@@ -2082,7 +2069,6 @@ unsafe fn atomic_and<T>(dst: *mut T, val: T, order: Ordering) -> T {
20822069
AcqRel => intrinsics::atomic_and_acqrel(dst, val),
20832070
Relaxed => intrinsics::atomic_and_relaxed(dst, val),
20842071
SeqCst => intrinsics::atomic_and(dst, val),
2085-
__Nonexhaustive => panic!("invalid memory ordering"),
20862072
}
20872073
}
20882074

@@ -2094,7 +2080,6 @@ unsafe fn atomic_nand<T>(dst: *mut T, val: T, order: Ordering) -> T {
20942080
AcqRel => intrinsics::atomic_nand_acqrel(dst, val),
20952081
Relaxed => intrinsics::atomic_nand_relaxed(dst, val),
20962082
SeqCst => intrinsics::atomic_nand(dst, val),
2097-
__Nonexhaustive => panic!("invalid memory ordering"),
20982083
}
20992084
}
21002085

@@ -2106,7 +2091,6 @@ unsafe fn atomic_or<T>(dst: *mut T, val: T, order: Ordering) -> T {
21062091
AcqRel => intrinsics::atomic_or_acqrel(dst, val),
21072092
Relaxed => intrinsics::atomic_or_relaxed(dst, val),
21082093
SeqCst => intrinsics::atomic_or(dst, val),
2109-
__Nonexhaustive => panic!("invalid memory ordering"),
21102094
}
21112095
}
21122096

@@ -2118,7 +2102,6 @@ unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T {
21182102
AcqRel => intrinsics::atomic_xor_acqrel(dst, val),
21192103
Relaxed => intrinsics::atomic_xor_relaxed(dst, val),
21202104
SeqCst => intrinsics::atomic_xor(dst, val),
2121-
__Nonexhaustive => panic!("invalid memory ordering"),
21222105
}
21232106
}
21242107

@@ -2131,7 +2114,6 @@ unsafe fn atomic_max<T>(dst: *mut T, val: T, order: Ordering) -> T {
21312114
AcqRel => intrinsics::atomic_max_acqrel(dst, val),
21322115
Relaxed => intrinsics::atomic_max_relaxed(dst, val),
21332116
SeqCst => intrinsics::atomic_max(dst, val),
2134-
__Nonexhaustive => panic!("invalid memory ordering"),
21352117
}
21362118
}
21372119

@@ -2144,7 +2126,6 @@ unsafe fn atomic_min<T>(dst: *mut T, val: T, order: Ordering) -> T {
21442126
AcqRel => intrinsics::atomic_min_acqrel(dst, val),
21452127
Relaxed => intrinsics::atomic_min_relaxed(dst, val),
21462128
SeqCst => intrinsics::atomic_min(dst, val),
2147-
__Nonexhaustive => panic!("invalid memory ordering"),
21482129
}
21492130
}
21502131

@@ -2157,7 +2138,6 @@ unsafe fn atomic_umax<T>(dst: *mut T, val: T, order: Ordering) -> T {
21572138
AcqRel => intrinsics::atomic_umax_acqrel(dst, val),
21582139
Relaxed => intrinsics::atomic_umax_relaxed(dst, val),
21592140
SeqCst => intrinsics::atomic_umax(dst, val),
2160-
__Nonexhaustive => panic!("invalid memory ordering"),
21612141
}
21622142
}
21632143

@@ -2170,7 +2150,6 @@ unsafe fn atomic_umin<T>(dst: *mut T, val: T, order: Ordering) -> T {
21702150
AcqRel => intrinsics::atomic_umin_acqrel(dst, val),
21712151
Relaxed => intrinsics::atomic_umin_relaxed(dst, val),
21722152
SeqCst => intrinsics::atomic_umin(dst, val),
2173-
__Nonexhaustive => panic!("invalid memory ordering"),
21742153
}
21752154
}
21762155

@@ -2260,7 +2239,6 @@ pub fn fence(order: Ordering) {
22602239
AcqRel => intrinsics::atomic_fence_acqrel(),
22612240
SeqCst => intrinsics::atomic_fence(),
22622241
Relaxed => panic!("there is no such thing as a relaxed fence"),
2263-
__Nonexhaustive => panic!("invalid memory ordering"),
22642242
}
22652243
}
22662244
}
@@ -2350,7 +2328,6 @@ pub fn compiler_fence(order: Ordering) {
23502328
AcqRel => intrinsics::atomic_singlethreadfence_acqrel(),
23512329
SeqCst => intrinsics::atomic_singlethreadfence(),
23522330
Relaxed => panic!("there is no such thing as a relaxed compiler fence"),
2353-
__Nonexhaustive => panic!("invalid memory ordering"),
23542331
}
23552332
}
23562333
}

src/libproc_macro/diagnostic.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use syntax_pos::MultiSpan;
1616
/// An enum representing a diagnostic level.
1717
#[unstable(feature = "proc_macro_diagnostic", issue = "38356")]
1818
#[derive(Copy, Clone, Debug)]
19+
#[non_exhaustive]
1920
pub enum Level {
2021
/// An error.
2122
Error,
@@ -25,8 +26,6 @@ pub enum Level {
2526
Note,
2627
/// A help message.
2728
Help,
28-
#[doc(hidden)]
29-
__Nonexhaustive,
3029
}
3130

3231
/// A structure representing a diagnostic message and associated children

src/libproc_macro/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#![feature(staged_api)]
3737
#![feature(lang_items)]
3838
#![feature(optin_builtin_traits)]
39+
#![feature(non_exhaustive)]
3940

4041
#![recursion_limit="256"]
4142

src/libproc_macro/rustc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ impl Level {
278278
Level::Warning => errors::Level::Warning,
279279
Level::Note => errors::Level::Note,
280280
Level::Help => errors::Level::Help,
281-
Level::__Nonexhaustive => unreachable!("Level::__Nonexhaustive"),
282281
}
283282
}
284283
}

src/librustc_apfloat/ieee.rs

+4-14
Original file line numberDiff line numberDiff line change
@@ -2306,24 +2306,14 @@ mod sig {
23062306

23072307
/// One, not zero, based LSB. That is, returns 0 for a zeroed significand.
23082308
pub(super) fn olsb(limbs: &[Limb]) -> usize {
2309-
for (i, &limb) in limbs.iter().enumerate() {
2310-
if limb != 0 {
2311-
return i * LIMB_BITS + limb.trailing_zeros() as usize + 1;
2312-
}
2313-
}
2314-
2315-
0
2309+
limbs.iter().enumerate().find(|(_, &limb)| limb != 0).map_or(0,
2310+
|(i, limb)| i * LIMB_BITS + limb.trailing_zeros() as usize + 1)
23162311
}
23172312

23182313
/// One, not zero, based MSB. That is, returns 0 for a zeroed significand.
23192314
pub(super) fn omsb(limbs: &[Limb]) -> usize {
2320-
for (i, &limb) in limbs.iter().enumerate().rev() {
2321-
if limb != 0 {
2322-
return (i + 1) * LIMB_BITS - limb.leading_zeros() as usize;
2323-
}
2324-
}
2325-
2326-
0
2315+
limbs.iter().enumerate().rfind(|(_, &limb)| limb != 0).map_or(0,
2316+
|(i, limb)| (i + 1) * LIMB_BITS - limb.leading_zeros() as usize)
23272317
}
23282318

23292319
/// Comparison (unsigned) of two significands.

src/libserialize/json.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ impl std::error::Error for EncoderError {
365365
}
366366

367367
impl From<fmt::Error> for EncoderError {
368+
/// Converts a [`fmt::Error`] into `EncoderError`
369+
///
370+
/// This conversion does not allocate memory.
368371
fn from(err: fmt::Error) -> EncoderError { EncoderError::FmtError(err) }
369372
}
370373

@@ -1387,10 +1390,9 @@ impl Stack {
13871390

13881391
// Used by Parser to test whether the top-most element is an index.
13891392
fn last_is_index(&self) -> bool {
1390-
if let Some(InternalIndex(_)) = self.stack.last() {
1391-
true
1392-
} else {
1393-
false
1393+
match self.stack.last() {
1394+
Some(InternalIndex(_)) => true,
1395+
_ => false,
13941396
}
13951397
}
13961398

src/libstd/build.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ fn build_libbacktrace(target: &str) -> Result<(), ()> {
104104
} else {
105105
build.file("../libbacktrace/elf.c");
106106

107-
if target.contains("64") {
107+
let pointer_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap();
108+
if pointer_width == "64" {
108109
build.define("BACKTRACE_ELF_SIZE", "64");
109110
} else {
110111
build.define("BACKTRACE_ELF_SIZE", "32");

src/libstd/io/error.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ struct Custom {
9797
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
9898
#[stable(feature = "rust1", since = "1.0.0")]
9999
#[allow(deprecated)]
100+
#[non_exhaustive]
100101
pub enum ErrorKind {
101102
/// An entity was not found, often a file.
102103
#[stable(feature = "rust1", since = "1.0.0")]
@@ -180,15 +181,6 @@ pub enum ErrorKind {
180181
/// read.
181182
#[stable(feature = "read_exact", since = "1.6.0")]
182183
UnexpectedEof,
183-
184-
/// A marker variant that tells the compiler that users of this enum cannot
185-
/// match it exhaustively.
186-
#[unstable(feature = "io_error_internals",
187-
reason = "better expressed through extensible enums that this \
188-
enum cannot be exhaustively matched against",
189-
issue = "0")]
190-
#[doc(hidden)]
191-
__Nonexhaustive,
192184
}
193185

194186
impl ErrorKind {
@@ -212,7 +204,6 @@ impl ErrorKind {
212204
ErrorKind::Interrupted => "operation interrupted",
213205
ErrorKind::Other => "other os error",
214206
ErrorKind::UnexpectedEof => "unexpected end of file",
215-
ErrorKind::__Nonexhaustive => unreachable!()
216207
}
217208
}
218209
}

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@
311311
#![feature(doc_keyword)]
312312
#![feature(panic_info_message)]
313313
#![feature(panic_implementation)]
314+
#![feature(non_exhaustive)]
314315

315316
#![default_lib_allocator]
316317

0 commit comments

Comments
 (0)