From 152c851f891eaade1bbb3cc5d35d3e7b7412c7fa Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Wed, 27 Jul 2022 00:24:30 +0200
Subject: [PATCH 01/17] Make forward compatibility lint
 deprecated_cfg_attr_crate_type_name deny by default

---
 compiler/rustc_lint_defs/src/builtin.rs           |  4 ++--
 src/test/codegen/external-no-mangle-statics.rs    |  5 ++---
 ...ture-compat-crate-attributes-using-cfg_attr.rs |  1 -
 ...-compat-crate-attributes-using-cfg_attr.stderr | 15 +++++----------
 4 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 39690851d1ea8..25897fdd0a0c0 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -3068,7 +3068,7 @@ declare_lint! {
     ///
     /// ### Example
     ///
-    /// ```rust
+    /// ```rust,compile_fail
     /// #![cfg_attr(debug_assertions, crate_type = "lib")]
     /// ```
     ///
@@ -3088,7 +3088,7 @@ declare_lint! {
     /// rustc instead of `#![cfg_attr(..., crate_type = "...")]` and
     /// `--crate-name` instead of `#![cfg_attr(..., crate_name = "...")]`.
     pub DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME,
-    Warn,
+    Deny,
     "detects usage of `#![cfg_attr(..., crate_type/crate_name = \"...\")]`",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #91632 <https://github.com/rust-lang/rust/issues/91632>",
diff --git a/src/test/codegen/external-no-mangle-statics.rs b/src/test/codegen/external-no-mangle-statics.rs
index 6274434cd8fcc..c6ecb7aa96abc 100644
--- a/src/test/codegen/external-no-mangle-statics.rs
+++ b/src/test/codegen/external-no-mangle-statics.rs
@@ -1,12 +1,11 @@
 // revisions: lib staticlib
 // ignore-emscripten default visibility is hidden
 // compile-flags: -O
+// [lib] compile-flags: --crate-type lib
+// [staticlib] compile-flags: --crate-type staticlib
 // `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their
 // definitions
 
-#![cfg_attr(lib, crate_type = "lib")]
-#![cfg_attr(staticlib, crate_type = "staticlib")]
-
 // CHECK: @A = local_unnamed_addr constant
 #[no_mangle]
 static A: u8 = 0;
diff --git a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs
index 6cb2ff9d8136b..1f23dadc43226 100644
--- a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs
+++ b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs
@@ -1,7 +1,6 @@
 // check-fail
 // compile-flags:--cfg foo
 
-#![deny(warnings)]
 #![cfg_attr(foo, crate_type="bin")]
 //~^ERROR `crate_type` within
 //~| WARN this was previously accepted
diff --git a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
index 5609f8e9d9f36..b52535ffdbab2 100644
--- a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
+++ b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
@@ -1,20 +1,15 @@
 error: `crate_type` within an `#![cfg_attr] attribute is deprecated`
-  --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18
+  --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:18
    |
 LL | #![cfg_attr(foo, crate_type="bin")]
    |                  ^^^^^^^^^^^^^^^^
    |
-note: the lint level is defined here
-  --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:9
-   |
-LL | #![deny(warnings)]
-   |         ^^^^^^^^
-   = note: `#[deny(deprecated_cfg_attr_crate_type_name)]` implied by `#[deny(warnings)]`
+   = note: `#[deny(deprecated_cfg_attr_crate_type_name)]` on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
 
 error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
-  --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18
+  --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18
    |
 LL | #![cfg_attr(foo, crate_name="bar")]
    |                  ^^^^^^^^^^^^^^^^
@@ -23,7 +18,7 @@ LL | #![cfg_attr(foo, crate_name="bar")]
    = note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
 
 error: `crate_type` within an `#![cfg_attr] attribute is deprecated`
-  --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18
+  --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:18
    |
 LL | #![cfg_attr(foo, crate_type="bin")]
    |                  ^^^^^^^^^^^^^^^^
@@ -32,7 +27,7 @@ LL | #![cfg_attr(foo, crate_type="bin")]
    = note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
 
 error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
-  --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18
+  --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18
    |
 LL | #![cfg_attr(foo, crate_name="bar")]
    |                  ^^^^^^^^^^^^^^^^

From 8998024aa388b1d15992133b98fadba1047e4bfe Mon Sep 17 00:00:00 2001
From: czzrr <chriz@live.dk>
Date: Fri, 19 Aug 2022 22:14:36 +0200
Subject: [PATCH 02/17] Correct test-args to compiletest on Windows

---
 src/bootstrap/test.rs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index baad0c75295a5..c759d9b88e2ff 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1514,7 +1514,15 @@ note: if you're sure you want to do this, please open an issue as to why. In the
 
         test_args.append(&mut builder.config.cmd.test_args());
 
-        cmd.args(&test_args);
+        // On Windows, replace forward slashes in test-args by backslashes
+        // so the correct filters are passed to libtest
+        if cfg!(windows) {
+            let test_args_win: Vec<String> =
+                test_args.iter().map(|s| s.replace("/", "\\")).collect();
+            cmd.args(&test_args_win);
+        } else {
+            cmd.args(&test_args);
+        }
 
         if builder.is_verbose() {
             cmd.arg("--verbose");

From 6a1f7afd2fe8f0a49cb702ac4ac4f1ff45d48ee5 Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Tue, 23 Aug 2022 18:47:29 +0200
Subject: [PATCH 03/17] Use direct pointer to filter_dirs function

---
 src/tools/tidy/src/error_codes_check.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs
index f0054a1c1c9bb..0a226443e01ca 100644
--- a/src/tools/tidy/src/error_codes_check.rs
+++ b/src/tools/tidy/src/error_codes_check.rs
@@ -217,7 +217,7 @@ pub fn check(paths: &[&Path], bad: &mut bool) {
     println!("Checking which error codes lack tests...");
 
     for path in paths {
-        super::walk(path, &mut |path| super::filter_dirs(path), &mut |entry, contents| {
+        super::walk(path, &mut super::filter_dirs, &mut |entry, contents| {
             let file_name = entry.file_name();
             let entry_path = entry.path();
 

From 0a6af989f60bd84a13cbcb77d2e9d1003ae8af5f Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Tue, 23 Aug 2022 19:04:07 +0200
Subject: [PATCH 04/17] Simplify unicode_downloads.rs

Reduce duplication by moving fetching logic into a dedicated function.
---
 .../src/unicode_download.rs                   | 31 +++++++++----------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/tools/unicode-table-generator/src/unicode_download.rs b/src/tools/unicode-table-generator/src/unicode_download.rs
index 9b2e0a25891c7..714bb53382e70 100644
--- a/src/tools/unicode-table-generator/src/unicode_download.rs
+++ b/src/tools/unicode-table-generator/src/unicode_download.rs
@@ -1,6 +1,6 @@
 use crate::UNICODE_DIRECTORY;
 use std::path::Path;
-use std::process::Command;
+use std::process::{Command, Output};
 
 static URL_PREFIX: &str = "https://www.unicode.org/Public/UCD/latest/ucd/";
 
@@ -9,6 +9,18 @@ static README: &str = "ReadMe.txt";
 static RESOURCES: &[&str] =
     &["DerivedCoreProperties.txt", "PropList.txt", "UnicodeData.txt", "SpecialCasing.txt"];
 
+#[track_caller]
+fn fetch(url: &str) -> Output {
+    let output = Command::new("curl").arg(URL_PREFIX.to_owned() + url).output().unwrap();
+    if !output.status.success() {
+        panic!(
+            "Failed to run curl to fetch {url}: stderr: {}",
+            String::from_utf8_lossy(&output.stderr)
+        );
+    }
+    output
+}
+
 pub fn fetch_latest() {
     let directory = Path::new(UNICODE_DIRECTORY);
     if directory.exists() {
@@ -20,27 +32,14 @@ pub fn fetch_latest() {
     if let Err(e) = std::fs::create_dir_all(directory) {
         panic!("Failed to create {UNICODE_DIRECTORY:?}: {e}");
     }
-    let output = Command::new("curl").arg(URL_PREFIX.to_owned() + README).output().unwrap();
-    if !output.status.success() {
-        panic!(
-            "Failed to run curl to fetch readme: stderr: {}",
-            String::from_utf8_lossy(&output.stderr)
-        );
-    }
+    let output = fetch(README);
     let current = std::fs::read_to_string(directory.join(README)).unwrap_or_default();
     if current.as_bytes() != &output.stdout[..] {
         std::fs::write(directory.join(README), output.stdout).unwrap();
     }
 
     for resource in RESOURCES {
-        let output = Command::new("curl").arg(URL_PREFIX.to_owned() + resource).output().unwrap();
-        if !output.status.success() {
-            panic!(
-                "Failed to run curl to fetch {}: stderr: {}",
-                resource,
-                String::from_utf8_lossy(&output.stderr)
-            );
-        }
+        let output = fetch(resource);
         std::fs::write(directory.join(resource), output.stdout).unwrap();
     }
 }

From 754b3e7567a441288ff7ce7f72280f267044113b Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Tue, 23 Aug 2022 19:04:50 +0200
Subject: [PATCH 05/17] Change hint to correct path

---
 src/tools/unicode-table-generator/src/main.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tools/unicode-table-generator/src/main.rs b/src/tools/unicode-table-generator/src/main.rs
index 4720ee7020f89..2a01b96f05a4f 100644
--- a/src/tools/unicode-table-generator/src/main.rs
+++ b/src/tools/unicode-table-generator/src/main.rs
@@ -220,7 +220,7 @@ fn main() {
     let write_location = std::env::args().nth(1).unwrap_or_else(|| {
         eprintln!("Must provide path to write unicode tables to");
         eprintln!(
-            "e.g. {} library/core/unicode/unicode_data.rs",
+            "e.g. {} library/core/src/unicode/unicode_data.rs",
             std::env::args().next().unwrap_or_default()
         );
         std::process::exit(1);

From a7886506ad109a1d8c823fd3f32ecab2c6dfca3c Mon Sep 17 00:00:00 2001
From: Josh Triplett <josh@joshtriplett.org>
Date: Wed, 24 Aug 2022 14:41:22 +0200
Subject: [PATCH 06/17] Remove some documentation duplicated between `writeln!`
 and `write!`

`writeln!` already includes a reference to `write!` for more
information, so remove duplicated information.
---
 library/core/src/macros/mod.rs | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 3a115a8b8b6c6..0d4cb990d1e97 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -526,25 +526,6 @@ macro_rules! write {
 ///     Ok(())
 /// }
 /// ```
-///
-/// A module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects
-/// implementing either, as objects do not typically implement both. However, the module must
-/// import the traits qualified so their names do not conflict:
-///
-/// ```
-/// use std::fmt::Write as FmtWrite;
-/// use std::io::Write as IoWrite;
-///
-/// fn main() -> Result<(), Box<dyn std::error::Error>> {
-///     let mut s = String::new();
-///     let mut v = Vec::new();
-///
-///     writeln!(&mut s, "{} {}", "abc", 123)?; // uses fmt::Write::write_fmt
-///     writeln!(&mut v, "s = {:?}", s)?; // uses io::Write::write_fmt
-///     assert_eq!(v, b"s = \"abc 123\\n\"\n");
-///     Ok(())
-/// }
-/// ```
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[cfg_attr(not(test), rustc_diagnostic_item = "writeln_macro")]

From 3c8618fd82baa24523246f1380952fc7f42ec30a Mon Sep 17 00:00:00 2001
From: Josh Triplett <josh@joshtriplett.org>
Date: Wed, 24 Aug 2022 14:42:25 +0200
Subject: [PATCH 07/17] Update `write!` docs: can now import traits as `_` to
 avoid conflicts

---
 library/core/src/macros/mod.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 0d4cb990d1e97..8ead64808ca83 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -460,8 +460,8 @@ macro_rules! r#try {
 /// import the traits qualified so their names do not conflict:
 ///
 /// ```
-/// use std::fmt::Write as FmtWrite;
-/// use std::io::Write as IoWrite;
+/// use std::fmt::Write as _;
+/// use std::io::Write as _;
 ///
 /// fn main() -> Result<(), Box<dyn std::error::Error>> {
 ///     let mut s = String::new();

From 589db1f73af1837d633024c297abbe36074d4aca Mon Sep 17 00:00:00 2001
From: Josh Triplett <josh@joshtriplett.org>
Date: Wed, 24 Aug 2022 14:51:56 +0200
Subject: [PATCH 08/17] Expand example to show how to implement qualified trait
 names

---
 library/core/src/macros/mod.rs | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 8ead64808ca83..60d809c54899f 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -474,6 +474,23 @@ macro_rules! r#try {
 /// }
 /// ```
 ///
+/// If you also need the trait names themselves, such as to implement one or both on your types,
+/// import the containing module and then name them with a prefix:
+///
+/// ```
+/// # #![allow(unused_imports)]
+/// use std::fmt::{self, Write as _};
+/// use std::io::{self, Write as _};
+///
+/// struct Example;
+///
+/// impl fmt::Write for Example {
+///     fn write_str(&mut self, _s: &str) -> core::fmt::Result {
+///          unimplemented!();
+///     }
+/// }
+/// ```
+///
 /// Note: This macro can be used in `no_std` setups as well.
 /// In a `no_std` setup you are responsible for the implementation details of the components.
 ///

From ae937cc347b1f1290a9a8208d1896ed366247109 Mon Sep 17 00:00:00 2001
From: Josh Triplett <josh@joshtriplett.org>
Date: Thu, 25 Aug 2022 00:22:40 +0200
Subject: [PATCH 09/17] Clarify comment to fit `as _` better

---
 library/core/src/macros/mod.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 60d809c54899f..0bd9c8e9acfcb 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -457,7 +457,8 @@ macro_rules! r#try {
 ///
 /// A module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects
 /// implementing either, as objects do not typically implement both. However, the module must
-/// import the traits qualified so their names do not conflict:
+/// avoid conflict between the trait names, such as by importing them as `_` or otherwise renaming
+/// them:
 ///
 /// ```
 /// use std::fmt::Write as _;

From ad93272627e216f352f9075f1ca72f4fd8febbed Mon Sep 17 00:00:00 2001
From: Deadbeef <ent3rm4n@gmail.com>
Date: Wed, 20 Apr 2022 14:42:18 +1000
Subject: [PATCH 10/17] Stabilize `const_ptr_offset_from`.

Stabilization has been completed [here](https://github.com/rust-lang/rust/issues/92980#issuecomment-1065644848)
with a FCP.
---
 library/core/src/intrinsics.rs                            | 4 ++--
 library/core/src/lib.rs                                   | 1 -
 library/core/src/ptr/const_ptr.rs                         | 2 +-
 library/core/src/ptr/mut_ptr.rs                           | 2 +-
 src/test/ui/consts/const-eval/issue-91827-extern-types.rs | 1 -
 src/test/ui/consts/offset.rs                              | 1 -
 src/test/ui/consts/offset_from.rs                         | 1 -
 src/test/ui/consts/offset_from_ub.rs                      | 1 -
 8 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs
index 441d238268693..c0066ff62c6f5 100644
--- a/library/core/src/intrinsics.rs
+++ b/library/core/src/intrinsics.rs
@@ -2013,11 +2013,11 @@ extern "rust-intrinsic" {
     pub fn nontemporal_store<T>(ptr: *mut T, val: T);
 
     /// See documentation of `<*const T>::offset_from` for details.
-    #[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "92980")]
+    #[rustc_const_stable(feature = "const_ptr_offset_from", since = "1.65.0")]
     pub fn ptr_offset_from<T>(ptr: *const T, base: *const T) -> isize;
 
     /// See documentation of `<*const T>::sub_ptr` for details.
-    #[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "92980")]
+    #[rustc_const_stable(feature = "const_ptr_offset_from", since = "1.65.0")]
     pub fn ptr_offset_from_unsigned<T>(ptr: *const T, base: *const T) -> usize;
 
     /// See documentation of `<*const T>::guaranteed_eq` for details.
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index 8d04a213f503d..60f38426baedf 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -130,7 +130,6 @@
 #![feature(const_replace)]
 #![feature(const_ptr_as_ref)]
 #![feature(const_ptr_is_null)]
-#![feature(const_ptr_offset_from)]
 #![feature(const_ptr_read)]
 #![feature(const_ptr_write)]
 #![feature(const_raw_ptr_comparison)]
diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs
index c25b159c533a1..08fbb79fa654c 100644
--- a/library/core/src/ptr/const_ptr.rs
+++ b/library/core/src/ptr/const_ptr.rs
@@ -641,7 +641,7 @@ impl<T: ?Sized> *const T {
     /// }
     /// ```
     #[stable(feature = "ptr_offset_from", since = "1.47.0")]
-    #[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "92980")]
+    #[rustc_const_stable(feature = "const_ptr_offset_from", since = "1.65.0")]
     #[inline]
     #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
     pub const unsafe fn offset_from(self, origin: *const T) -> isize
diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs
index fff06b458c7c1..8467469053151 100644
--- a/library/core/src/ptr/mut_ptr.rs
+++ b/library/core/src/ptr/mut_ptr.rs
@@ -824,7 +824,7 @@ impl<T: ?Sized> *mut T {
     /// }
     /// ```
     #[stable(feature = "ptr_offset_from", since = "1.47.0")]
-    #[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "92980")]
+    #[rustc_const_stable(feature = "const_ptr_offset_from", since = "1.65.0")]
     #[inline(always)]
     #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
     pub const unsafe fn offset_from(self, origin: *const T) -> isize
diff --git a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs
index e1f5e8ae1453c..43c99799f7704 100644
--- a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs
+++ b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs
@@ -3,7 +3,6 @@
 // Test that we can handle unsized types with an extern type tail part.
 // Regression test for issue #91827.
 
-#![feature(const_ptr_offset_from)]
 #![feature(extern_types)]
 
 use std::ptr::addr_of;
diff --git a/src/test/ui/consts/offset.rs b/src/test/ui/consts/offset.rs
index f9ddda554fcf0..b2c663fe617a4 100644
--- a/src/test/ui/consts/offset.rs
+++ b/src/test/ui/consts/offset.rs
@@ -1,5 +1,4 @@
 // run-pass
-#![feature(const_ptr_offset_from)]
 use std::ptr;
 
 #[repr(C)]
diff --git a/src/test/ui/consts/offset_from.rs b/src/test/ui/consts/offset_from.rs
index b53718316f3b5..465147041d966 100644
--- a/src/test/ui/consts/offset_from.rs
+++ b/src/test/ui/consts/offset_from.rs
@@ -1,6 +1,5 @@
 // run-pass
 
-#![feature(const_ptr_offset_from)]
 #![feature(const_ptr_sub_ptr)]
 #![feature(ptr_sub_ptr)]
 
diff --git a/src/test/ui/consts/offset_from_ub.rs b/src/test/ui/consts/offset_from_ub.rs
index 1f29a690550bc..264bd631b3ba2 100644
--- a/src/test/ui/consts/offset_from_ub.rs
+++ b/src/test/ui/consts/offset_from_ub.rs
@@ -1,4 +1,3 @@
-#![feature(const_ptr_offset_from)]
 #![feature(core_intrinsics)]
 
 use std::intrinsics::{ptr_offset_from, ptr_offset_from_unsigned};

From 69ad63480820009278c470a67485e3505f03a633 Mon Sep 17 00:00:00 2001
From: Deadbeef <ent3rm4n@gmail.com>
Date: Thu, 12 May 2022 16:48:46 +1000
Subject: [PATCH 11/17] Do not include `const_ptr_sub_ptr` in this
 stabilization

---
 library/core/src/intrinsics.rs       | 2 +-
 src/test/ui/consts/offset_from_ub.rs | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs
index c0066ff62c6f5..e31c226e818be 100644
--- a/library/core/src/intrinsics.rs
+++ b/library/core/src/intrinsics.rs
@@ -2017,7 +2017,7 @@ extern "rust-intrinsic" {
     pub fn ptr_offset_from<T>(ptr: *const T, base: *const T) -> isize;
 
     /// See documentation of `<*const T>::sub_ptr` for details.
-    #[rustc_const_stable(feature = "const_ptr_offset_from", since = "1.65.0")]
+    #[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")]
     pub fn ptr_offset_from_unsigned<T>(ptr: *const T, base: *const T) -> usize;
 
     /// See documentation of `<*const T>::guaranteed_eq` for details.
diff --git a/src/test/ui/consts/offset_from_ub.rs b/src/test/ui/consts/offset_from_ub.rs
index 264bd631b3ba2..51163e650d6aa 100644
--- a/src/test/ui/consts/offset_from_ub.rs
+++ b/src/test/ui/consts/offset_from_ub.rs
@@ -1,3 +1,4 @@
+#![feature(const_ptr_sub_ptr)]
 #![feature(core_intrinsics)]
 
 use std::intrinsics::{ptr_offset_from, ptr_offset_from_unsigned};

From e7b7f8855f97cb66b2b4008888c7ba0e8f2c2db6 Mon Sep 17 00:00:00 2001
From: Michael Howell <michael@notriddle.com>
Date: Thu, 25 Aug 2022 17:41:25 -0700
Subject: [PATCH 12/17] rustdoc: omit start/end tags for empty item description
 blocks

Related to #100952

This is definitely not a complete solution, but it does shrink
keysyms/index.html on smithay from 620K to 516K.
---
 src/librustdoc/html/render/print_item.rs     | 18 ++++++++++++++----
 src/test/rustdoc-gui/item-summary-table.goml |  2 +-
 src/test/rustdoc/short-docblock-codeblock.rs |  4 +---
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 6d0a825fec866..07a8e8f48dc31 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -371,16 +371,21 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
                     }
                     clean::ImportKind::Glob => String::new(),
                 };
+                let stab_tags = stab_tags.unwrap_or_default();
+                let (stab_tags_before, stab_tags_after) = if stab_tags.is_empty() {
+                    ("", "")
+                } else {
+                    ("<div class=\"item-right docblock-short\">", "</div>")
+                };
                 write!(
                     w,
                     "<div class=\"item-left {stab}{add}import-item\"{id}>\
                          <code>{vis}{imp}</code>\
                      </div>\
-                     <div class=\"item-right docblock-short\">{stab_tags}</div>",
+                     {stab_tags_before}{stab_tags}{stab_tags_after}",
                     stab = stab.unwrap_or_default(),
                     vis = myitem.visibility.print_with_space(myitem.item_id, cx),
                     imp = import.print(cx),
-                    stab_tags = stab_tags.unwrap_or_default(),
                 );
                 w.write_str(ITEM_TABLE_ROW_CLOSE);
             }
@@ -412,6 +417,12 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
 
                 let doc_value = myitem.doc_value().unwrap_or_default();
                 w.write_str(ITEM_TABLE_ROW_OPEN);
+                let docs = MarkdownSummaryLine(&doc_value, &myitem.links(cx)).into_string();
+                let (docs_before, docs_after) = if docs.is_empty() {
+                    ("", "")
+                } else {
+                    ("<div class=\"item-right docblock-short\">", "</div>")
+                };
                 write!(
                     w,
                     "<div class=\"item-left {stab}{add}module-item\">\
@@ -420,11 +431,10 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
                         {unsafety_flag}\
                         {stab_tags}\
                      </div>\
-                     <div class=\"item-right docblock-short\">{docs}</div>",
+                     {docs_before}{docs}{docs_after}",
                     name = myitem.name.unwrap(),
                     visibility_emoji = visibility_emoji,
                     stab_tags = extra_info_tags(myitem, item, cx.tcx()),
-                    docs = MarkdownSummaryLine(&doc_value, &myitem.links(cx)).into_string(),
                     class = myitem.type_(),
                     add = add,
                     stab = stab.unwrap_or_default(),
diff --git a/src/test/rustdoc-gui/item-summary-table.goml b/src/test/rustdoc-gui/item-summary-table.goml
index 6bf4e288c4377..4bff32b3d5db1 100644
--- a/src/test/rustdoc-gui/item-summary-table.goml
+++ b/src/test/rustdoc-gui/item-summary-table.goml
@@ -3,4 +3,4 @@ goto: file://|DOC_PATH|/lib2/summary_table/index.html
 // We check that we picked the right item first.
 assert-text: (".item-table .item-left", "Foo")
 // Then we check that its summary is empty.
-assert-text: (".item-table .item-right", "")
+assert-false: ".item-table .item-right"
diff --git a/src/test/rustdoc/short-docblock-codeblock.rs b/src/test/rustdoc/short-docblock-codeblock.rs
index c6b318b0677ce..3c5fa7b36adbf 100644
--- a/src/test/rustdoc/short-docblock-codeblock.rs
+++ b/src/test/rustdoc/short-docblock-codeblock.rs
@@ -1,8 +1,6 @@
 #![crate_name = "foo"]
 
-// @has foo/index.html '//*[@class="item-right docblock-short"]' ""
-// @!has foo/index.html '//*[@class="item-right docblock-short"]' "Some text."
-// @!has foo/index.html '//*[@class="item-right docblock-short"]' "let x = 12;"
+// @count foo/index.html '//*[@class="item-right docblock-short"]' 0
 
 /// ```
 /// let x = 12;

From 832fd237d1cd8455ebe956888532f71e4781b9a2 Mon Sep 17 00:00:00 2001
From: Michael Howell <michael@notriddle.com>
Date: Fri, 26 Aug 2022 07:34:55 -0700
Subject: [PATCH 13/17] rustdoc: remove unused CSS for `hidden-by-*-hider`

This CSS seems to have become obsolete with the move to `<details>` tags,
and its corresponding JavaScript was removed in aee054d05d8b795d35c0b448a4b731b6507aa459
---
 src/librustdoc/html/static/css/rustdoc.css | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index f6a7875fddc8c..8459c980911cc 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1581,12 +1581,6 @@ kbd {
 	cursor: default;
 }
 
-.hidden-by-impl-hider,
-.hidden-by-usual-hider {
-	/* important because of conflicting rule for small screens */
-	display: none !important;
-}
-
 #implementations-list > h3 > span.in-band {
 	width: 100%;
 }

From 25eb52ff6900a43b0ddc809692c6ceaf8b563b61 Mon Sep 17 00:00:00 2001
From: Michael Howell <michael@notriddle.com>
Date: Fri, 26 Aug 2022 08:27:31 -0700
Subject: [PATCH 14/17] rustdoc: remove incorrect CSS selector `.impl-items
 table td`

Fixes #100994

This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480.
The bug can be seen at <https://doc.rust-lang.org/1.27.0/alloc/slice/trait.SliceIndex.html#foreign-impls>.

This rule was added to help with a `<table>` that was used for displaying the
function signature [src] lockup. That lockup was changed in
34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9 to use flexbox instead, leaving this
selector unused (at least, for its original purpose).
---
 src/librustdoc/html/static/css/rustdoc.css |  2 +-
 src/test/rustdoc-gui/docblock-table.goml   |  4 ++++
 src/test/rustdoc-gui/src/test_docs/lib.rs  | 26 ++++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 src/test/rustdoc-gui/docblock-table.goml

diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index f6a7875fddc8c..2b9c61b6524e8 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -777,7 +777,7 @@ pre, .rustdoc.source .example-wrap {
 .content .docblock >.impl-items table td {
 	padding: 0;
 }
-.content .docblock > .impl-items .table-display, .impl-items table td {
+.content .docblock > .impl-items .table-display {
 	border: none;
 }
 
diff --git a/src/test/rustdoc-gui/docblock-table.goml b/src/test/rustdoc-gui/docblock-table.goml
new file mode 100644
index 0000000000000..7263156ab2bb3
--- /dev/null
+++ b/src/test/rustdoc-gui/docblock-table.goml
@@ -0,0 +1,4 @@
+goto: file://|DOC_PATH|/test_docs/doc_block_table/struct.DocBlockTable.html#method.func
+
+compare-elements-css: (".impl-items .docblock table th", ".top-doc .docblock table th", ["border"])
+compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock table td", ["border"])
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index 1b26aaecb5ef3..a02d5934cc245 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -293,3 +293,29 @@ pub mod details {
     /// </details>
     pub struct Details;
 }
+
+pub mod doc_block_table {
+
+    pub trait DocBlockTableTrait {
+        fn func();
+    }
+
+    /// Struct doc.
+    ///
+    /// | header1                  | header2                  |
+    /// |--------------------------|--------------------------|
+    /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
+    pub struct DocBlockTable {}
+
+    impl DocBlockTableTrait for DocBlockTable {
+        /// Trait impl func doc for struct.
+        ///
+        /// | header1                  | header2                  |
+        /// |--------------------------|--------------------------|
+        /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
+        fn func() {
+            println!();
+        }
+    }
+
+}

From 20012ea4eb486356b53ef398d6f76f99588a81a3 Mon Sep 17 00:00:00 2001
From: Camille GILLOT <gillot.camille@gmail.com>
Date: Mon, 22 Aug 2022 21:23:09 +0200
Subject: [PATCH 15/17] Merge implementations of HIR fn_decl and fn_sig.

---
 compiler/rustc_hir/src/hir.rs                 |  9 ++++---
 compiler/rustc_middle/src/hir/map/mod.rs      | 26 ++-----------------
 .../rustc_mir_transform/src/coverage/mod.rs   |  2 +-
 .../wrong_number_of_generic_args.rs           |  3 +--
 4 files changed, 9 insertions(+), 31 deletions(-)

diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index ca1705f26b540..a069c49b0cc1e 100644
--- a/compiler/rustc_hir/src/hir.rs
+++ b/compiler/rustc_hir/src/hir.rs
@@ -3216,7 +3216,7 @@ impl<'hir> OwnerNode<'hir> {
         }
     }
 
-    pub fn fn_decl(&self) -> Option<&FnDecl<'hir>> {
+    pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
         match self {
             OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
             | OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
@@ -3400,19 +3400,20 @@ impl<'hir> Node<'hir> {
         }
     }
 
-    pub fn fn_decl(&self) -> Option<&'hir FnDecl<'hir>> {
+    pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
         match self {
             Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
             | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
             | Node::Item(Item { kind: ItemKind::Fn(fn_sig, _, _), .. }) => Some(fn_sig.decl),
-            Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_decl, _, _), .. }) => {
+            Node::Expr(Expr { kind: ExprKind::Closure(Closure { fn_decl, .. }), .. })
+            | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_decl, _, _), .. }) => {
                 Some(fn_decl)
             }
             _ => None,
         }
     }
 
-    pub fn fn_sig(&self) -> Option<&'hir FnSig<'hir>> {
+    pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
         match self {
             Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
             | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs
index 79e6804a28992..bd468d45d82a2 100644
--- a/compiler/rustc_middle/src/hir/map/mod.rs
+++ b/compiler/rustc_middle/src/hir/map/mod.rs
@@ -17,28 +17,6 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol};
 use rustc_span::Span;
 use rustc_target::spec::abi::Abi;
 
-fn fn_decl<'hir>(node: Node<'hir>) -> Option<&'hir FnDecl<'hir>> {
-    match node {
-        Node::Item(Item { kind: ItemKind::Fn(sig, _, _), .. })
-        | Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(sig, _), .. })
-        | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(sig, _), .. }) => Some(&sig.decl),
-        Node::Expr(Expr { kind: ExprKind::Closure(Closure { fn_decl, .. }), .. })
-        | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_decl, ..), .. }) => {
-            Some(fn_decl)
-        }
-        _ => None,
-    }
-}
-
-pub fn fn_sig<'hir>(node: Node<'hir>) -> Option<&'hir FnSig<'hir>> {
-    match &node {
-        Node::Item(Item { kind: ItemKind::Fn(sig, _, _), .. })
-        | Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(sig, _), .. })
-        | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(sig, _), .. }) => Some(sig),
-        _ => None,
-    }
-}
-
 #[inline]
 pub fn associated_body<'hir>(node: Node<'hir>) -> Option<BodyId> {
     match node {
@@ -384,7 +362,7 @@ impl<'hir> Map<'hir> {
 
     pub fn fn_decl_by_hir_id(self, hir_id: HirId) -> Option<&'hir FnDecl<'hir>> {
         if let Some(node) = self.find(hir_id) {
-            fn_decl(node)
+            node.fn_decl()
         } else {
             bug!("no node for hir_id `{}`", hir_id)
         }
@@ -392,7 +370,7 @@ impl<'hir> Map<'hir> {
 
     pub fn fn_sig_by_hir_id(self, hir_id: HirId) -> Option<&'hir FnSig<'hir>> {
         if let Some(node) = self.find(hir_id) {
-            fn_sig(node)
+            node.fn_sig()
         } else {
             bug!("no node for hir_id `{}`", hir_id)
         }
diff --git a/compiler/rustc_mir_transform/src/coverage/mod.rs b/compiler/rustc_mir_transform/src/coverage/mod.rs
index 2619626a5675f..e72d016d7ac91 100644
--- a/compiler/rustc_mir_transform/src/coverage/mod.rs
+++ b/compiler/rustc_mir_transform/src/coverage/mod.rs
@@ -541,7 +541,7 @@ fn fn_sig_and_body<'tcx>(
     // to HIR for it.
     let hir_node = tcx.hir().get_if_local(def_id).expect("expected DefId is local");
     let fn_body_id = hir::map::associated_body(hir_node).expect("HIR node is a function with body");
-    (hir::map::fn_sig(hir_node), tcx.hir().body(fn_body_id))
+    (hir_node.fn_sig(), tcx.hir().body(fn_body_id))
 }
 
 fn get_body_span<'tcx>(
diff --git a/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs b/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs
index 99729391e02b0..f654d6e560c80 100644
--- a/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs
+++ b/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs
@@ -4,7 +4,6 @@ use rustc_errors::{
     MultiSpan,
 };
 use rustc_hir as hir;
-use rustc_middle::hir::map::fn_sig;
 use rustc_middle::ty::{self as ty, AssocItems, AssocKind, TyCtxt};
 use rustc_session::Session;
 use rustc_span::def_id::DefId;
@@ -368,7 +367,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
         &self,
         num_params_to_take: usize,
     ) -> String {
-        let fn_sig = self.tcx.hir().get_if_local(self.def_id).and_then(fn_sig);
+        let fn_sig = self.tcx.hir().get_if_local(self.def_id).and_then(hir::Node::fn_sig);
         let is_used_in_input = |def_id| {
             fn_sig.map_or(false, |fn_sig| {
                 fn_sig.decl.inputs.iter().any(|ty| match ty.kind {

From 52582d301d8ffbf0787ad4dd426f0ec7dab8f76f Mon Sep 17 00:00:00 2001
From: Michael Howell <michael@notriddle.com>
Date: Fri, 26 Aug 2022 14:49:06 -0700
Subject: [PATCH 16/17] rustdoc: remove empty extern_crates and
 type="text/javascript" on script

Like #101023, this removes an attribute with a default value.
---
 src/librustdoc/html/render/print_item.rs | 6 ++++--
 src/librustdoc/html/static/js/main.js    | 6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 912601dda20b1..f258af114ade7 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -987,7 +987,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
     // So C's HTML will have something like this:
     //
     // ```html
-    // <script type="text/javascript" src="/implementors/A/trait.Foo.js"
+    // <script src="/implementors/A/trait.Foo.js"
     //     data-ignore-extern-crates="A,B" async></script>
     // ```
     //
@@ -1013,9 +1013,11 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
         .map(|cnum| cx.shared.tcx.crate_name(cnum).to_string())
         .collect::<Vec<_>>()
         .join(",");
+    let (extern_before, extern_after) =
+        if extern_crates.is_empty() { ("", "") } else { (" data-ignore-extern-crates=\"", "\"") };
     write!(
         w,
-        "<script type=\"text/javascript\" src=\"{src}\" data-ignore-extern-crates=\"{extern_crates}\" async></script>",
+        "<script src=\"{src}\"{extern_before}{extern_crates}{extern_after} async></script>",
         src = js_src_path.finish(),
     );
 }
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index 5dec610b30c7b..7f61c95e794b0 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -528,9 +528,9 @@ function loadCss(cssFileName) {
         // We don't want to include impls from this JS file, when the HTML already has them.
         // The current crate should always be ignored. Other crates that should also be
         // ignored are included in the attribute `data-ignore-extern-crates`.
-        const ignoreExternCrates = document
-            .querySelector("script[data-ignore-extern-crates]")
-            .getAttribute("data-ignore-extern-crates");
+        const script = document
+            .querySelector("script[data-ignore-extern-crates]");
+        const ignoreExternCrates = script ? script.getAttribute("data-ignore-extern-crates") : "";
         for (const lib of libs) {
             if (lib === window.currentCrate || ignoreExternCrates.indexOf(lib) !== -1) {
                 continue;

From a74f45383384a39ac265062bf7b4b59d65a509eb Mon Sep 17 00:00:00 2001
From: Guillaume Gomez <guillaume.gomez@huawei.com>
Date: Sat, 27 Aug 2022 00:37:04 +0200
Subject: [PATCH 17/17] Merge duplicated CSS rules

---
 src/librustdoc/html/static/css/rustdoc.css    | 33 +++++--------------
 src/librustdoc/html/static/css/themes/ayu.css |  5 ---
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 38cdcd61e88cb..e1ece8ad9f2e9 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -364,11 +364,6 @@ li {
 	margin-left: 0px;
 }
 
-nav.sub {
-	position: relative;
-	font-size: 1rem;
-}
-
 .sub-container {
 	display: flex;
 	flex-direction: row;
@@ -638,9 +633,6 @@ h2.location a {
 }
 .docblock-short p {
 	display: inline;
-}
-
-.docblock-short p {
 	overflow: hidden;
 	text-overflow: ellipsis;
 	margin: 0;
@@ -820,6 +812,8 @@ pre, .rustdoc.source .example-wrap {
 }
 
 nav.sub {
+	position: relative;
+	font-size: 1rem;
 	flex-grow: 1;
 	margin-bottom: 25px;
 }
@@ -919,6 +913,7 @@ table,
 	position: relative;
 	display: flex;
 	height: 34px;
+	margin-top: 4px;
 }
 .search-container > * {
 	height: 100%;
@@ -990,9 +985,6 @@ so that we can apply CSS-filters to change the arrow color in themes */
 #crate-search > option {
 	font-size: 1rem;
 }
-.search-container {
-	margin-top: 4px;
-}
 .search-input {
 	/* Override Normalize.css: it has a rule that sets
 	   -webkit-appearance: textfield for search inputs. That
@@ -1188,6 +1180,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
 	padding-left: 12px;
 	padding-right: 2px;
 	position: initial;
+	float: right;
 }
 
 .impl-items .srclink, .impl .srclink, .methods .srclink {
@@ -1196,10 +1189,6 @@ so that we can apply CSS-filters to change the arrow color in themes */
 	font-size: 1rem;
 }
 
-.rightside {
-	float: right;
-}
-
 td.summary-column {
 	width: 100%;
 }
@@ -1226,7 +1215,7 @@ a.test-arrow {
 .example-wrap:hover .test-arrow {
 	visibility: visible;
 }
-a.test-arrow:hover{
+a.test-arrow:hover {
 	text-decoration: none;
 }
 
@@ -1494,10 +1483,6 @@ pre.rust {
 	outline: none;
 }
 
-#copy-path {
-	height: 34px;
-	background-color: var(--main-background-color);
-}
 #settings-menu > a, #help-button > button, #copy-path {
 	padding: 5px;
 	width: 33px;
@@ -1555,7 +1540,8 @@ input:checked + .slider {
 }
 
 #copy-path {
-	background: initial;
+	height: 34px;
+	background-color: var(--main-background-color);
 	margin-left: 10px;
 	padding: 0;
 	padding-left: 2px;
@@ -1841,10 +1827,6 @@ in storage.js plus the media query with (min-width: 701px)
 		display: none;
 	}
 
-	.sidebar-elems {
-		margin-top: 1em;
-	}
-
 	.sidebar {
 		position: fixed;
 		top: 45px;
@@ -1938,6 +1920,7 @@ in storage.js plus the media query with (min-width: 701px)
 	}
 
 	.sidebar-elems {
+		margin-top: 1em;
 		background-color: var(--sidebar-background-color);
 	}
 
diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css
index 8591f22d6de60..1efa67a44b5a0 100644
--- a/src/librustdoc/html/static/css/themes/ayu.css
+++ b/src/librustdoc/html/static/css/themes/ayu.css
@@ -153,9 +153,6 @@ a {
 .sidebar h3 a {
 	color: white;
 }
-.search-results a {
-	color: #0096cf;
-}
 body.source .example-wrap pre.rust a {
 	background: #333;
 }
@@ -359,7 +356,6 @@ h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type)
 .content span.constant,.content a.constant,.block a.current.constant,.content span.static,
 .content a.static, .block a.current.static {}
 .content span.keyword,.content a.keyword,.block a.current.keyword {}
-pre.rust .comment {}
 .content span.traitalias,.content a.traitalias,.block a.current.traitalias {}
 .content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,
 .block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,
@@ -367,7 +363,6 @@ pre.rust .comment {}
 pre.rust .kw {}
 pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute {}
 .content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype {}
-pre.rust .doccomment {}
 .stab.deprecated {}
 .content a.attr,.content a.derive,.content a.macro {}
 .stab.portability {}