diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index 2e7958325cd61..440181a7611cb 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -125,8 +125,8 @@ from htmlentitydefs import name2codepoint # "void elements" (no closing tag) from the HTML Standard section 12.1.2 -VOID_ELEMENTS = set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', - 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']) +VOID_ELEMENTS = {'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', + 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'} # Python 2 -> 3 compatibility try: @@ -146,7 +146,7 @@ def __init__(self, target=None): self.__builder = target or ET.TreeBuilder() def handle_starttag(self, tag, attrs): - attrs = dict((k, v or '') for k, v in attrs) + attrs = {k: v or '' for k, v in attrs} self.__builder.start(tag, attrs) if tag in VOID_ELEMENTS: self.__builder.end(tag) @@ -155,7 +155,7 @@ def handle_endtag(self, tag): self.__builder.end(tag) def handle_startendtag(self, tag, attrs): - attrs = dict((k, v or '') for k, v in attrs) + attrs = {k: v or '' for k, v in attrs} self.__builder.start(tag, attrs) self.__builder.end(tag) diff --git a/src/libcore/ops/function.rs b/src/libcore/ops/function.rs index 4f08aa451875f..3e5cad2b185a1 100644 --- a/src/libcore/ops/function.rs +++ b/src/libcore/ops/function.rs @@ -160,7 +160,7 @@ pub trait FnMut: FnOnce { /// times. Because of this, if the only thing known about a type is that it /// implements `FnOnce`, it can only be called once. /// -/// `FnOnce` is implemented automatically by closure that might consume captured +/// `FnOnce` is implemented automatically by closures that might consume captured /// variables, as well as all types that implement [`FnMut`], e.g., (safe) /// [function pointers] (since `FnOnce` is a supertrait of [`FnMut`]). /// diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css index 41fe8e0fafb41..01b7ae8778671 100644 --- a/src/librustdoc/html/static/themes/ayu.css +++ b/src/librustdoc/html/static/themes/ayu.css @@ -199,7 +199,6 @@ pre { pre.rust .comment, pre.rust .doccomment { color: #788797; - font-style: italic; } nav:not(.sidebar) { diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 797318d95b777..9eb54c2cc0044 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -251,7 +251,6 @@ use crate::cmp; use crate::fmt; -use crate::mem; use crate::memchr; use crate::ops::{Deref, DerefMut}; use crate::ptr; @@ -1435,12 +1434,15 @@ pub trait Write { /// ``` #[unstable(feature = "write_all_vectored", issue = "70436")] fn write_all_vectored(&mut self, mut bufs: &mut [IoSlice<'_>]) -> Result<()> { + // Guarantee that bufs is empty if it contains no data, + // to avoid calling write_vectored if there is no data to be written. + bufs = IoSlice::advance(bufs, 0); while !bufs.is_empty() { match self.write_vectored(bufs) { Ok(0) => { return Err(Error::new(ErrorKind::WriteZero, "failed to write whole buffer")); } - Ok(n) => bufs = IoSlice::advance(mem::take(&mut bufs), n), + Ok(n) => bufs = IoSlice::advance(bufs, n), Err(ref e) if e.kind() == ErrorKind::Interrupted => {} Err(e) => return Err(e), } @@ -2958,6 +2960,7 @@ mod tests { #[rustfmt::skip] // Becomes unreadable otherwise. let tests: Vec<(_, &'static [u8])> = vec![ (vec![], &[]), + (vec![IoSlice::new(&[]), IoSlice::new(&[])], &[]), (vec![IoSlice::new(&[1])], &[1]), (vec![IoSlice::new(&[1, 2])], &[1, 2]), (vec![IoSlice::new(&[1, 2, 3])], &[1, 2, 3]), diff --git a/src/libstd/lazy.rs b/src/libstd/lazy.rs index 86e1cfae582e8..1705a4f77c555 100644 --- a/src/libstd/lazy.rs +++ b/src/libstd/lazy.rs @@ -827,6 +827,8 @@ mod tests { tx.send(msg).unwrap(); break; } + #[cfg(target_env = "sgx")] + crate::thread::yield_now(); } }); } diff --git a/src/test/ui/binding/func-arg-ref-pattern.rs b/src/test/ui/binding/func-arg-ref-pattern.rs index ebb7a6afa9b74..f46eeb7a020d8 100644 --- a/src/test/ui/binding/func-arg-ref-pattern.rs +++ b/src/test/ui/binding/func-arg-ref-pattern.rs @@ -1,5 +1,4 @@ // run-pass -// exec-env:RUST_POISON_ON_FREE=1 // Test argument patterns where we create refs to the inside of // boxes. Make sure that we don't free the box as we match the diff --git a/src/test/ui/issues/issue-18075.rs b/src/test/ui/issues/issue-18075.rs index ee6845c1278b8..56ec629c61360 100644 --- a/src/test/ui/issues/issue-18075.rs +++ b/src/test/ui/issues/issue-18075.rs @@ -1,5 +1,5 @@ // run-pass -// exec-env:RUSTC_LOG=rustc::middle=debug +// rustc-env:RUSTC_LOG=rustc::middle=debug fn main() { let b = 1isize; diff --git a/src/test/ui/issues/issue-34932.rs b/src/test/ui/issues/issue-34932.rs index 3a5fd20ebc34e..ab568fd01efc5 100644 --- a/src/test/ui/issues/issue-34932.rs +++ b/src/test/ui/issues/issue-34932.rs @@ -1,6 +1,5 @@ // run-pass // compile-flags:--test -// rustc-env:RUSTC_BOOTSTRAP_KEY= #![cfg(any())] // This test should be configured away #![feature(rustc_attrs)] // Test that this is allowed on stable/beta #![feature(iter_arith_traits)] // Test that this is not unused diff --git a/src/test/ui/logging-only-prints-once.rs b/src/test/ui/logging-only-prints-once.rs index 6b49c441d1eae..6d16819ceb0f0 100644 --- a/src/test/ui/logging-only-prints-once.rs +++ b/src/test/ui/logging-only-prints-once.rs @@ -1,7 +1,6 @@ // run-pass // ignore-windows // ignore-emscripten no threads support -// exec-env:RUSTC_LOG=debug use std::cell::Cell; use std::fmt; @@ -19,10 +18,13 @@ impl fmt::Debug for Foo { } pub fn main() { - thread::spawn(move|| { + thread::spawn(move || { let mut f = Foo(Cell::new(0)); println!("{:?}", f); let Foo(ref mut f) = f; assert_eq!(f.get(), 1); - }).join().ok().unwrap(); + }) + .join() + .ok() + .unwrap(); } diff --git a/src/test/ui/logging_before_rt_started.rs b/src/test/ui/logging_before_rt_started.rs deleted file mode 100644 index 540d2b4f58a90..0000000000000 --- a/src/test/ui/logging_before_rt_started.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass -// exec-env:RUSTC_LOG=std::ptr - -// In issue #9487, it was realized that std::ptr was invoking the logging -// infrastructure, and when std::ptr was used during runtime initialization, -// this caused some serious problems. The problems have since been fixed, but -// this test will trigger "output during runtime initialization" to make sure -// that the bug isn't re-introduced. - -// pretty-expanded FIXME #23616 - -pub fn main() {} diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.rs b/src/test/ui/mismatched_types/const-fn-in-trait.rs index 7fcbd7e7e8bb2..3b1992d90b7c5 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.rs +++ b/src/test/ui/mismatched_types/const-fn-in-trait.rs @@ -1,5 +1,3 @@ -// rustc-env:RUST_NEW_ERROR_FORMAT - #![feature(const_fn)] trait Foo { diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.stderr b/src/test/ui/mismatched_types/const-fn-in-trait.stderr index 817582df27db1..450981a9183a2 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.stderr +++ b/src/test/ui/mismatched_types/const-fn-in-trait.stderr @@ -1,11 +1,11 @@ error[E0379]: functions in traits cannot be declared const - --> $DIR/const-fn-in-trait.rs:7:5 + --> $DIR/const-fn-in-trait.rs:5:5 | LL | const fn g(); | ^^^^^ functions in traits cannot be const error[E0379]: functions in traits cannot be declared const - --> $DIR/const-fn-in-trait.rs:11:5 + --> $DIR/const-fn-in-trait.rs:9:5 | LL | const fn f() -> u32 { 22 } | ^^^^^ functions in traits cannot be const diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs index 949f5683c8a20..ba206b8608f6c 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs @@ -1,5 +1,3 @@ -// rustc-env:RUST_NEW_ERROR_FORMAT - trait Foo { fn foo(x: u16); fn bar(&mut self, bar: &mut Bar); diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index b20fddb05acf1..5735120f7104a 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -1,5 +1,5 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/trait-impl-fn-incompatibility.rs:11:15 + --> $DIR/trait-impl-fn-incompatibility.rs:9:15 | LL | fn foo(x: u16); | --- type in trait @@ -11,7 +11,7 @@ LL | fn foo(x: i16) { } found fn pointer `fn(i16)` error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/trait-impl-fn-incompatibility.rs:12:28 + --> $DIR/trait-impl-fn-incompatibility.rs:10:28 | LL | fn bar(&mut self, bar: &mut Bar); | -------- type in trait diff --git a/src/test/ui/threads-sendsync/spawning-with-debug.rs b/src/test/ui/threads-sendsync/spawning-with-debug.rs index 388d62aa7101c..9d3487ffb2956 100644 --- a/src/test/ui/threads-sendsync/spawning-with-debug.rs +++ b/src/test/ui/threads-sendsync/spawning-with-debug.rs @@ -2,7 +2,7 @@ #![allow(unused_must_use)] #![allow(unused_mut)] // ignore-windows -// exec-env:RUSTC_LOG=debug +// exec-env:RUST_LOG=debug // ignore-emscripten no threads support // regression test for issue #10405, make sure we don't call println! too soon. @@ -11,5 +11,5 @@ use std::thread::Builder; pub fn main() { let mut t = Builder::new(); - t.spawn(move|| ()); + t.spawn(move || ()); } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 21fb7673ce061..653e1f13c4b48 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -623,7 +623,7 @@ impl<'test> TestCx<'test> { .arg("-L") .arg(&aux_dir) .args(&self.props.compile_flags) - .envs(self.props.exec_env.clone()); + .envs(self.props.rustc_env.clone()); self.maybe_add_external_args( &mut rustc, self.split_maybe_args(&self.config.target_rustcflags),