From 32c4b714715338e82711e3611681aada3f28cf39 Mon Sep 17 00:00:00 2001 From: Pirh Date: Sun, 8 Oct 2017 22:11:20 +0100 Subject: [PATCH 01/12] Link std::process::Output to Command and Child --- src/libstd/process.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index dbb589912153c..847dbd14dd615 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -701,7 +701,14 @@ impl AsInnerMut for Command { fn as_inner_mut(&mut self) -> &mut imp::Command { &mut self.inner } } -/// The output of a finished process. +/// The output of a finished process. This is returned in a Result by +/// either the [`output`] method of a [`Command`], or the +/// [`wait_with_output`] method of a [`Child`] process. +/// +/// [`Command`]: struct.Command.html +/// [`Child`]: struct.Child.html +/// [`output`]: struct.Command.html#method.output +/// [`wait_with_output`]: struct.Child.html#method.wait_with_output #[derive(PartialEq, Eq, Clone)] #[stable(feature = "process", since = "1.0.0")] pub struct Output { From 8d20030a03d0d809819a538da32452d262ee0b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A1ulio=20Bezerra?= Date: Thu, 12 Oct 2017 23:30:46 -0300 Subject: [PATCH 02/12] Moved details of unstable non-ascii identifiers from the Reference to the Unstable book --- .../src/language-features/non-ascii-idents.md | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/doc/unstable-book/src/language-features/non-ascii-idents.md b/src/doc/unstable-book/src/language-features/non-ascii-idents.md index d5600c58fd9a6..a1bb0ce7869e9 100644 --- a/src/doc/unstable-book/src/language-features/non-ascii-idents.md +++ b/src/doc/unstable-book/src/language-features/non-ascii-idents.md @@ -15,4 +15,34 @@ The `non_ascii_idents` feature adds support for non-ASCII identifiers. const ε: f64 = 0.00001f64; const Π: f64 = 3.14f64; -``` \ No newline at end of file +``` + +## Changes to the language reference + +> **Lexer:** +> IDENTIFIER : +>       XID_start XID_continue\* +>    | `_` XID_continue+ + +An identifier is any nonempty Unicode string of the following form: + +Either + + * The first character has property [`XID_start`] + * The remaining characters have property [`XID_continue`] + +Or + + * The first character is `_` + * The identifier is more than one character, `_` alone is not an identifier + * The remaining characters have property [`XID_continue`] + +that does _not_ occur in the set of [strict keywords]. + +> **Note**: [`XID_start`] and [`XID_continue`] as character properties cover the +> character ranges used to form the more familiar C and Java language-family +> identifiers. + +[`XID_start`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Start%3A%5D&abb=on&g=&i= +[`XID_continue`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Continue%3A%5D&abb=on&g=&i= +[strict keywords]: keywords.html#strict-keywords From 8f4ff6307f0a4c8be9b9c0ec57b57a354cbba005 Mon Sep 17 00:00:00 2001 From: bgermann Date: Fri, 13 Oct 2017 11:36:44 +0200 Subject: [PATCH 03/12] Make Solaris builder compatible with Solaris 10 --- src/ci/docker/cross2/Dockerfile | 12 +++++----- .../docker/cross2/build-solaris-toolchain.sh | 22 +++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/ci/docker/cross2/Dockerfile b/src/ci/docker/cross2/Dockerfile index f5fc06767ce90..029d2c18d4a4c 100644 --- a/src/ci/docker/cross2/Dockerfile +++ b/src/ci/docker/cross2/Dockerfile @@ -36,12 +36,12 @@ ENV \ AR_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-ar \ CC_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang \ CXX_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang++ \ - AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.11-ar \ - CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.11-gcc \ - CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.11-g++ \ - AR_x86_64_sun_solaris=x86_64-sun-solaris2.11-ar \ - CC_x86_64_sun_solaris=x86_64-sun-solaris2.11-gcc \ - CXX_x86_64_sun_solaris=x86_64-sun-solaris2.11-g++ + AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \ + CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \ + CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \ + AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \ + CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \ + CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ ENV TARGETS=x86_64-unknown-fuchsia ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia diff --git a/src/ci/docker/cross2/build-solaris-toolchain.sh b/src/ci/docker/cross2/build-solaris-toolchain.sh index ae84cc62b6086..935cbe5d61b58 100755 --- a/src/ci/docker/cross2/build-solaris-toolchain.sh +++ b/src/ci/docker/cross2/build-solaris-toolchain.sh @@ -25,7 +25,7 @@ cd binutils curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf - mkdir binutils-build cd binutils-build -hide_output ../binutils-$BINUTILS/configure --target=$ARCH-sun-solaris2.11 +hide_output ../binutils-$BINUTILS/configure --target=$ARCH-sun-solaris2.10 hide_output make -j10 hide_output make install @@ -58,13 +58,17 @@ for deb in *$APT_ARCH.deb; do dpkg -x $deb . done -mkdir /usr/local/$ARCH-sun-solaris2.11/usr -mv usr/include /usr/local/$ARCH-sun-solaris2.11/usr/include -mv usr/lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.11/lib -mv lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.11/lib +# Strip Solaris 11 functions that are optionally used by libbacktrace. +# This is for Solaris 10 compatibility. +$ARCH-sun-solaris2.10-strip -N dl_iterate_phdr -N strnlen lib/$LIB_ARCH/libc.so -ln -s /usr/local/$ARCH-sun-solaris2.11/usr/include /usr/local/$ARCH-sun-solaris2.11/sys-include -ln -s /usr/local/$ARCH-sun-solaris2.11/usr/include /usr/local/$ARCH-sun-solaris2.11/include +mkdir /usr/local/$ARCH-sun-solaris2.10/usr +mv usr/include /usr/local/$ARCH-sun-solaris2.10/usr/include +mv usr/lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib +mv lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib + +ln -s /usr/local/$ARCH-sun-solaris2.10/usr/include /usr/local/$ARCH-sun-solaris2.10/sys-include +ln -s /usr/local/$ARCH-sun-solaris2.10/usr/include /usr/local/$ARCH-sun-solaris2.10/include cd .. rm -rf solaris @@ -80,7 +84,7 @@ mkdir ../gcc-build cd ../gcc-build hide_output ../gcc-$GCC/configure \ --enable-languages=c,c++ \ - --target=$ARCH-sun-solaris2.11 \ + --target=$ARCH-sun-solaris2.10 \ --with-gnu-as \ --with-gnu-ld \ --disable-multilib \ @@ -94,7 +98,7 @@ hide_output ../gcc-$GCC/configure \ --disable-libsanitizer \ --disable-libquadmath-support \ --disable-lto \ - --with-sysroot=/usr/local/$ARCH-sun-solaris2.11 + --with-sysroot=/usr/local/$ARCH-sun-solaris2.10 hide_output make -j10 hide_output make install From 45502d23fb7849bc4afc2dc6a2ebf15b7ef13ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ho=C3=A0ng=20=C4=90=E1=BB=A9c=20Hi=E1=BA=BFu?= Date: Fri, 13 Oct 2017 14:12:49 +0700 Subject: [PATCH 04/12] compiletest/runtest: format ErrorKind with Display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The strings are nouns for the most part, so we give ErrorKind::Help a more sensible string. This reduces quote hiccups in failure output. unexpected "error": '...' ↓ unexpected error: '...' --- src/tools/compiletest/src/errors.rs | 2 +- src/tools/compiletest/src/runtest.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/errors.rs b/src/tools/compiletest/src/errors.rs index b7fb3670165d6..251dd4d5edb4e 100644 --- a/src/tools/compiletest/src/errors.rs +++ b/src/tools/compiletest/src/errors.rs @@ -45,7 +45,7 @@ impl FromStr for ErrorKind { impl fmt::Display for ErrorKind { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - ErrorKind::Help => write!(f, "help"), + ErrorKind::Help => write!(f, "help message"), ErrorKind::Error => write!(f, "error"), ErrorKind::Note => write!(f, "note"), ErrorKind::Suggestion => write!(f, "suggestion"), diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 870e08cc6e595..8ff571bc8b80f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1040,7 +1040,7 @@ actual:\n\ None => { if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) { self.error( - &format!("{}:{}: unexpected {:?}: '{}'", + &format!("{}:{}: unexpected {}: '{}'", file_name, actual_error.line_num, actual_error.kind.as_ref() From 8c4a68dca1428fab4bfb9c9f176ad66e2e1d85fc Mon Sep 17 00:00:00 2001 From: Pirh Date: Fri, 13 Oct 2017 18:18:09 +0100 Subject: [PATCH 05/12] Add line break after summary of process::Output --- src/libstd/process.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 847dbd14dd615..8287c43ba969a 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -701,9 +701,11 @@ impl AsInnerMut for Command { fn as_inner_mut(&mut self) -> &mut imp::Command { &mut self.inner } } -/// The output of a finished process. This is returned in a Result by -/// either the [`output`] method of a [`Command`], or the -/// [`wait_with_output`] method of a [`Child`] process. +/// The output of a finished process. +/// +/// This is returned in a Result by either the [`output`] method of a +/// [`Command`], or the [`wait_with_output`] method of a [`Child`] +/// process. /// /// [`Command`]: struct.Command.html /// [`Child`]: struct.Child.html From 7439da61fcb3b484eeea9461b10d1ae70c3963ed Mon Sep 17 00:00:00 2001 From: Alexander Kuleshov Date: Fri, 13 Oct 2017 23:51:38 +0600 Subject: [PATCH 06/12] fix typo in src/bootstrap/README.md --- src/bootstrap/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/README.md b/src/bootstrap/README.md index ebacc62b0fdda..6eb074605fc14 100644 --- a/src/bootstrap/README.md +++ b/src/bootstrap/README.md @@ -126,7 +126,7 @@ install a nightly, presumably using `rustup`. You will then want to configure your directory to use this build, like so: ``` -# configure to use local rust instead of downloding a beta. +# configure to use local rust instead of downloading a beta. # `--local-rust-root` is optional here. If elided, we will # use whatever rustc we find on your PATH. > configure --enable-rustbuild --local-rust-root=~/.cargo/ --enable-local-rebuild From 8e6119f353ab424657080776243d6f9af4f7dfe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A1ulio=20Bezerra?= Date: Fri, 13 Oct 2017 17:15:28 -0300 Subject: [PATCH 07/12] Fixed link to keywords page in the reference --- src/doc/unstable-book/src/language-features/non-ascii-idents.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/unstable-book/src/language-features/non-ascii-idents.md b/src/doc/unstable-book/src/language-features/non-ascii-idents.md index a1bb0ce7869e9..efb5495fe26ac 100644 --- a/src/doc/unstable-book/src/language-features/non-ascii-idents.md +++ b/src/doc/unstable-book/src/language-features/non-ascii-idents.md @@ -45,4 +45,4 @@ that does _not_ occur in the set of [strict keywords]. [`XID_start`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Start%3A%5D&abb=on&g=&i= [`XID_continue`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Continue%3A%5D&abb=on&g=&i= -[strict keywords]: keywords.html#strict-keywords +[strict keywords]: ../reference/keywords.html#strict-keywords From 2bd5238e44dfa31109ff9ebcc264581aba8d269a Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Fri, 13 Oct 2017 19:22:33 -0700 Subject: [PATCH 08/12] Fix TcpStream::connect_timeout on linux Linux appears to set POLLOUT when a conection's refused, which is pretty weird. Invert the check to look for an error explicitly. Also add an explict test for this case. Closes #45265. --- src/libstd/net/tcp.rs | 14 ++++++++++++++ src/libstd/sys/unix/net.rs | 13 +++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index b904641a336ba..1fc905d6570fe 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -1579,6 +1579,20 @@ mod tests { "bad error: {} {:?}", e, e.kind()); } + #[test] + fn connect_timeout_unbound() { + // bind and drop a socket to track down a "probably unassigned" port + let socket = TcpListener::bind("127.0.0.1:0").unwrap(); + let addr = socket.local_addr().unwrap(); + drop(socket); + + let timeout = Duration::from_secs(1); + let e = TcpStream::connect_timeout(&addr, timeout).unwrap_err(); + assert!(e.kind() == io::ErrorKind::ConnectionRefused || + e.kind() == io::ErrorKind::Other, + "bad error: {} {:?}", e, e.kind()); + } + #[test] fn connect_timeout_valid() { let listener = TcpListener::bind("127.0.0.1:0").unwrap(); diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index c8019d1c768c5..91515aca56af9 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -176,11 +176,16 @@ impl Socket { } 0 => {} _ => { - if pollfd.revents & libc::POLLOUT == 0 { - if let Some(e) = self.take_error()? { - return Err(e); - } + // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look + // for errors rather than read readiness + if pollfd.revents & libc::POLLERR != 0 { + let e = self.take_error()? + .unwrap_or_else(|| { + io::Error::new(io::ErrorKind::Other, "no error set after POLLERR") + }); + return Err(e); } + return Ok(()); } } From c729e4dca7581fcd060978bcb0d7f98ea4eb6b82 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 14 Oct 2017 15:52:50 +0200 Subject: [PATCH 09/12] Remove terribly useless and problematic margin when searching on mobile --- src/librustdoc/html/static/rustdoc.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 9e2798f1cf71a..a132223a05101 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -831,6 +831,10 @@ span.since { .toggle-wrapper { height: 1.5em; } + + #search { + margin-left: 0; + } } @media print { From bb9e850246092d3931080ddbac551a0857b28364 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 13 Oct 2017 13:09:35 -0400 Subject: [PATCH 10/12] std: Get rid of hash_offet in RawTable This offset is always zero, and we don't consistently take it into account. This is okay, because it's zero, but if it ever changes we're going to have bugs (e.g. in the `dealloc` call, where we don't take it into account). It's better to remove this for now; if we ever have a need for a nonzero offset we can add it back, and handle it properly when we do so. --- src/libstd/collections/hash/table.rs | 31 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 93929637e2f1e..527c4ef4592cd 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -717,26 +717,25 @@ fn calculate_offsets(hashes_size: usize, (pairs_offset, end_of_pairs, oflo) } -// Returns a tuple of (minimum required malloc alignment, hash_offset, +// Returns a tuple of (minimum required malloc alignment, // array_size), from the start of a mallocated array. fn calculate_allocation(hash_size: usize, hash_align: usize, pairs_size: usize, pairs_align: usize) - -> (usize, usize, usize, bool) { - let hash_offset = 0; + -> (usize, usize, bool) { let (_, end_of_pairs, oflo) = calculate_offsets(hash_size, pairs_size, pairs_align); let align = cmp::max(hash_align, pairs_align); - (align, hash_offset, end_of_pairs, oflo) + (align, end_of_pairs, oflo) } #[test] fn test_offset_calculation() { - assert_eq!(calculate_allocation(128, 8, 16, 8), (8, 0, 144, false)); - assert_eq!(calculate_allocation(3, 1, 2, 1), (1, 0, 5, false)); - assert_eq!(calculate_allocation(6, 2, 12, 4), (4, 0, 20, false)); + assert_eq!(calculate_allocation(128, 8, 16, 8), (8, 144, false)); + assert_eq!(calculate_allocation(3, 1, 2, 1), (1, 5, false)); + assert_eq!(calculate_allocation(6, 2, 12, 4), (4, 20, false)); assert_eq!(calculate_offsets(128, 15, 4), (128, 143, false)); assert_eq!(calculate_offsets(3, 2, 4), (4, 6, false)); assert_eq!(calculate_offsets(6, 12, 4), (8, 20, false)); @@ -768,10 +767,10 @@ impl RawTable { // This is great in theory, but in practice getting the alignment // right is a little subtle. Therefore, calculating offsets has been // factored out into a different function. - let (alignment, hash_offset, size, oflo) = calculate_allocation(hashes_size, - align_of::(), - pairs_size, - align_of::<(K, V)>()); + let (alignment, size, oflo) = calculate_allocation(hashes_size, + align_of::(), + pairs_size, + align_of::<(K, V)>()); assert!(!oflo, "capacity overflow"); // One check for overflow that covers calculation and rounding of size. @@ -784,7 +783,7 @@ impl RawTable { let buffer = Heap.alloc(Layout::from_size_align(size, alignment).unwrap()) .unwrap_or_else(|e| Heap.oom(e)); - let hashes = buffer.offset(hash_offset as isize) as *mut HashUint; + let hashes = buffer as *mut HashUint; RawTable { capacity_mask: capacity.wrapping_sub(1), @@ -1183,10 +1182,10 @@ unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable { let hashes_size = self.capacity() * size_of::(); let pairs_size = self.capacity() * size_of::<(K, V)>(); - let (align, _, size, oflo) = calculate_allocation(hashes_size, - align_of::(), - pairs_size, - align_of::<(K, V)>()); + let (align, size, oflo) = calculate_allocation(hashes_size, + align_of::(), + pairs_size, + align_of::<(K, V)>()); debug_assert!(!oflo, "should be impossible"); From e8e7715bebdd401ebacfabb66928d0f7e4733120 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 13 Oct 2017 13:19:15 -0400 Subject: [PATCH 11/12] std: Set probe length tag on cloned hashmaps This isn't strictly necessary for hashmap cloning to work. The tag is used to hint for an upcoming resize, so it's good to copy this information over. (We can do cleverer things like actually resizing the hashmap when we see the tag, or even cleaning up the entry order, but this requires more thought and might not be worth it) --- src/libstd/collections/hash/table.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 527c4ef4592cd..7e623a0af17c3 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -1156,6 +1156,7 @@ impl Clone for RawTable { } new_ht.size = self.size(); + new_ht.set_tag(self.tag()); new_ht } From 5acc185ceef4dd2a64726df62ae79895a84d3a1e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 14 Oct 2017 18:35:54 +0200 Subject: [PATCH 12/12] Fix arrow display --- src/librustdoc/html/layout.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index d08a7bde71c73..873d978b9cb84 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -97,9 +97,9 @@ r##"
Show this help dialog
S
Focus the search field
-
+
Move up in search results
-
+
Move down in search results
Go to active search result