From 243742262265164795c3dd0ee2df1bfa15d51cf8 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Mon, 21 Mar 2022 22:57:31 +0100 Subject: [PATCH 1/8] Stabilize Stdin::lines. --- library/std/src/io/stdio.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index ac6d41e13b009..38558fb574003 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -394,7 +394,6 @@ impl Stdin { /// # Examples /// /// ```no_run - /// #![feature(stdin_forwarders)] /// use std::io; /// /// let lines = io::stdin().lines(); @@ -403,7 +402,7 @@ impl Stdin { /// } /// ``` #[must_use = "`self` will be dropped if the result is not used"] - #[unstable(feature = "stdin_forwarders", issue = "87096")] + #[stable(feature = "stdin_forwarders", since = "1.61.0")] pub fn lines(self) -> Lines> { self.lock().lines() } From 34bcc8e8ff73725e160e630be147a295bd5c7a13 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sun, 3 Apr 2022 17:03:59 -0400 Subject: [PATCH 2/8] Don't cast thread name to an integer for prctl libc::prctl and the prctl definitions in glibc, musl, and the kernel headers are C variadic functions. Therefore, all the arguments (except for the first) are untyped. It is only the Linux man page which says that prctl takes 4 unsigned long arguments. I have no idea why it says this. In any case, the upshot is that we don't need to cast the pointer to an integer and confuse Miri. --- library/std/src/sys/unix/thread.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index bb4e4ee9aa75b..967d3b2bd9fe4 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -122,7 +122,7 @@ impl Thread { // pthread wrapper only appeared in glibc 2.12, so we use syscall // directly. unsafe { - libc::prctl(PR_SET_NAME, name.as_ptr() as libc::c_ulong, 0, 0, 0); + libc::prctl(PR_SET_NAME, name.as_ptr(), 0, 0, 0); } } From b72a7fbcdc6978f73f6e16d0c0cfad8551dc6afe Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 6 Apr 2022 11:09:16 +1000 Subject: [PATCH 3/8] Improve terse test output. The current terse output gives 112 chars per line, which causes wraparound for people using 100 char wide terminals, which is very common. This commit changes it to be exactly 100 wide, which makes the output look much nicer. --- library/test/src/formatters/terse.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs index fb40f86b42e19..5dace8baef7f8 100644 --- a/library/test/src/formatters/terse.rs +++ b/library/test/src/formatters/terse.rs @@ -11,8 +11,9 @@ use crate::{ types::TestDesc, }; -// insert a '\n' after 100 tests in quiet mode -const QUIET_MODE_MAX_COLUMN: usize = 100; +// We insert a '\n' when the output hits 100 columns in quiet mode. 88 test +// result chars leaves 12 chars for a progress count like " 11704/12853". +const QUIET_MODE_MAX_COLUMN: usize = 88; pub(crate) struct TerseFormatter { out: OutputLocation, @@ -65,7 +66,7 @@ impl TerseFormatter { ) -> io::Result<()> { self.write_pretty(result, color)?; if self.test_count % QUIET_MODE_MAX_COLUMN == QUIET_MODE_MAX_COLUMN - 1 { - // we insert a new line every 100 dots in order to flush the + // We insert a new line regularly in order to flush the // screen when dealing with line-buffered output (e.g., piping to // `stamp` in the rust CI). let out = format!(" {}/{}\n", self.test_count + 1, self.total_test_count); From f87d180e7d36e761ef51fb33d9ee2406424de8ee Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 6 Apr 2022 17:26:33 +0200 Subject: [PATCH 4/8] Bump stabilization of stdin_forwarders to 1.62.0. --- library/std/src/io/stdio.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index 38558fb574003..ae16015e35a1a 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -402,7 +402,7 @@ impl Stdin { /// } /// ``` #[must_use = "`self` will be dropped if the result is not used"] - #[stable(feature = "stdin_forwarders", since = "1.61.0")] + #[stable(feature = "stdin_forwarders", since = "1.62.0")] pub fn lines(self) -> Lines> { self.lock().lines() } From 6a7ff98a99b9bfc4f3c47da55c3f5d4e8a59f2a3 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Wed, 6 Apr 2022 18:45:11 +0200 Subject: [PATCH 5/8] Revert "Mark Location::caller() as #[inline]" This reverts commit 6d0b61e2f598c1d1102ea9b6f22c4d0e71e5f967. --- library/core/src/panic/location.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/library/core/src/panic/location.rs b/library/core/src/panic/location.rs index a018ad9eab345..714e9b73c78a6 100644 --- a/library/core/src/panic/location.rs +++ b/library/core/src/panic/location.rs @@ -83,7 +83,6 @@ impl<'a> Location<'a> { #[stable(feature = "track_caller", since = "1.46.0")] #[rustc_const_unstable(feature = "const_caller_location", issue = "76156")] #[track_caller] - #[inline] pub const fn caller() -> &'static Location<'static> { crate::intrinsics::caller_location() } From d48a39a5e24ab08f727d1c919dc2af98c333ad14 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 6 Apr 2022 20:41:44 +0200 Subject: [PATCH 6/8] Switch item-info div to span to generate valid HTML --- src/librustdoc/html/render/mod.rs | 6 +++--- src/librustdoc/html/static/css/rustdoc.css | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index e223b30650541..12da16527a0eb 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -597,11 +597,11 @@ fn document_item_info( ) { let item_infos = short_item_info(item, cx, parent); if !item_infos.is_empty() { - w.write_str("
"); + w.write_str(""); for info in item_infos { w.write_str(&info); } - w.write_str("
"); + w.write_str(""); } } @@ -1772,7 +1772,7 @@ pub(crate) fn render_impl_summary( let is_trait = i.inner_impl().trait_.is_some(); if is_trait { if let Some(portability) = portability(&i.impl_item, Some(parent)) { - write!(w, "
{}
", portability); + write!(w, "{}", portability); } } diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index ee265b8c4b543..68c88b551ca74 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -737,6 +737,10 @@ h2.location a { border: none; } +.item-info { + display: block; +} + .content .item-info code { font-size: 0.875rem; } From 56d0f9484b700740f0717212b55e2d9f8e001158 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 6 Apr 2022 20:41:57 +0200 Subject: [PATCH 7/8] Update rustdoc test following DOM change --- src/test/rustdoc/stability.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/rustdoc/stability.rs b/src/test/rustdoc/stability.rs index 4ff06d9c9954e..90be2050d926b 100644 --- a/src/test/rustdoc/stability.rs +++ b/src/test/rustdoc/stability.rs @@ -4,7 +4,7 @@ pub struct Unstable { // @has stability/struct.Unstable.html \ - // '//div[@class="item-info"]//div[@class="stab unstable"]' \ + // '//span[@class="item-info"]//div[@class="stab unstable"]' \ // 'This is a nightly-only experimental API' // @count stability/struct.Unstable.html '//span[@class="stab unstable"]' 0 pub foo: u32, From e8a6f53af82b43f79ae36de139cb6867a7bc73ee Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Wed, 6 Apr 2022 17:11:50 -0400 Subject: [PATCH 8/8] Change trailing prctl arguments to c_ulong --- library/std/src/sys/unix/thread.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index 967d3b2bd9fe4..d191e1fe7a650 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -122,7 +122,13 @@ impl Thread { // pthread wrapper only appeared in glibc 2.12, so we use syscall // directly. unsafe { - libc::prctl(PR_SET_NAME, name.as_ptr(), 0, 0, 0); + libc::prctl( + PR_SET_NAME, + name.as_ptr(), + 0 as libc::c_ulong, + 0 as libc::c_ulong, + 0 as libc::c_ulong, + ); } }