about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-02-28 01:15:16 +0000
committerbors <bors@rust-lang.org>2021-02-28 01:15:16 +0000
commit130b2ab0ed272f93dd5d019e72ac1fd4b4a77323 (patch)
tree2f473a556bbf5bad361cc84af6a1ac0f57d0b7f6
parent94736c434ee154b30e2ec22ec112b79e3f6c5884 (diff)
parent7847f690fd5d2a92cad833564fc05305d85c5634 (diff)
Auto merge of #82611 - Dylan-DPC:rollup-l7xlpks, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #81856 (Suggest character encoding is incorrect when encountering random null bytes)
 - #82395 (Add missing "see its documentation for more" stdio)
 - #82401 (Remove a redundant macro)
 - #82498 (Use log level to control partitioning debug output)
 - #82534 (Link crtbegin/crtend on musl to terminate .eh_frame)
 - #82537 (Update measureme dependency to the latest version)
 - #82561 (doc: cube root, not cubic root)
 - #82563 (Fix intra-doc handling of `Self` in enum)
 - #82584 (Add ARIA role to sidebar toggle in Rustdoc)
 - #82596 (clarify RW lock's priority gotcha)
 - #82607 (Add a getter for Frame.loc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
-rw-r--r--Cargo.lock16
-rw-r--r--compiler/rustc_codegen_llvm/Cargo.toml2
-rw-r--r--compiler/rustc_data_structures/Cargo.toml2
-rw-r--r--compiler/rustc_middle/Cargo.toml2
-rw-r--r--compiler/rustc_mir/src/interpret/eval_context.rs10
-rw-r--r--compiler/rustc_mir/src/monomorphize/partitioning/mod.rs21
-rw-r--r--compiler/rustc_parse/src/lexer/mod.rs3
-rw-r--r--compiler/rustc_target/src/spec/crt_objects.rs21
-rw-r--r--compiler/rustc_typeck/src/check/method/suggest.rs18
-rw-r--r--library/std/src/f32.rs2
-rw-r--r--library/std/src/f64.rs2
-rw-r--r--library/std/src/io/stdio.rs4
-rw-r--r--library/std/src/sync/rwlock.rs4
-rw-r--r--src/bootstrap/compile.rs6
-rw-r--r--src/librustdoc/html/layout.rs2
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs8
-rw-r--r--src/test/rustdoc/intra-doc/issue-82209.rs11
-rw-r--r--src/test/ui/parser/issue-66473.stderrbin2660 -> 5260 bytes
-rw-r--r--src/test/ui/parser/issue-68629.stderrbin1441 -> 1831 bytes
-rw-r--r--src/test/ui/parser/issue-68730.stderrbin966 -> 1226 bytes
-rw-r--r--src/test/ui/parser/utf16-be-without-bom.rsbin0 -> 125 bytes
-rw-r--r--src/test/ui/parser/utf16-be-without-bom.stderrbin0 -> 3537 bytes
-rw-r--r--src/test/ui/parser/utf16-le-without-bom.rsbin0 -> 126 bytes
-rw-r--r--src/test/ui/parser/utf16-le-without-bom.stderrbin0 -> 3500 bytes
-rw-r--r--src/tools/tidy/src/deps.rs1
25 files changed, 102 insertions, 33 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b3b4284a564..6e95fd6af27 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2149,11 +2149,14 @@ dependencies = [
 
 [[package]]
 name = "measureme"
-version = "9.0.0"
+version = "9.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22bf8d885d073610aee20e7fa205c4341ed32a761dbde96da5fd96301a8d3e82"
+checksum = "4a98e07fe802486895addb2b5467f33f205e82c426bfaf350f5d8109b137767c"
 dependencies = [
+ "log",
+ "memmap",
  "parking_lot",
+ "perf-event-open-sys",
  "rustc-hash",
  "smallvec 1.6.1",
 ]
@@ -2551,6 +2554,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
 
 [[package]]
+name = "perf-event-open-sys"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce9bedf5da2c234fdf2391ede2b90fabf585355f33100689bc364a3ea558561a"
+dependencies = [
+ "libc",
+]
+
+[[package]]
 name = "pest"
 version = "2.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml
index 260edd9570b..4999cb3c7ab 100644
--- a/compiler/rustc_codegen_llvm/Cargo.toml
+++ b/compiler/rustc_codegen_llvm/Cargo.toml
@@ -12,7 +12,7 @@ doctest = false
 bitflags = "1.0"
 cstr = "0.2"
 libc = "0.2"
-measureme = "9.0.0"
+measureme = "9.1.0"
 snap = "1"
 tracing = "0.1"
 rustc_middle = { path = "../rustc_middle" }
diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml
index e3476517de5..818c4364256 100644
--- a/compiler/rustc_data_structures/Cargo.toml
+++ b/compiler/rustc_data_structures/Cargo.toml
@@ -25,7 +25,7 @@ rustc-hash = "1.1.0"
 smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
 rustc_index = { path = "../rustc_index", package = "rustc_index" }
 bitflags = "1.2.1"
-measureme = "9.0.0"
+measureme = "9.1.0"
 libc = "0.2"
 stacker = "0.1.12"
 tempfile = "3.0.5"
diff --git a/compiler/rustc_middle/Cargo.toml b/compiler/rustc_middle/Cargo.toml
index 7de398a1898..06742331655 100644
--- a/compiler/rustc_middle/Cargo.toml
+++ b/compiler/rustc_middle/Cargo.toml
@@ -28,6 +28,6 @@ rustc_ast = { path = "../rustc_ast" }
 rustc_span = { path = "../rustc_span" }
 chalk-ir = "0.55.0"
 smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
-measureme = "9.0.0"
+measureme = "9.1.0"
 rustc_session = { path = "../rustc_session" }
 rustc_type_ir = { path = "../rustc_type_ir" }
diff --git a/compiler/rustc_mir/src/interpret/eval_context.rs b/compiler/rustc_mir/src/interpret/eval_context.rs
index 1ba87358b1c..6b796eb3721 100644
--- a/compiler/rustc_mir/src/interpret/eval_context.rs
+++ b/compiler/rustc_mir/src/interpret/eval_context.rs
@@ -226,6 +226,16 @@ impl<'mir, 'tcx, Tag> Frame<'mir, 'tcx, Tag> {
 }
 
 impl<'mir, 'tcx, Tag, Extra> Frame<'mir, 'tcx, Tag, Extra> {
+    /// Get the current location within the Frame.
+    ///
+    /// If this is `Err`, we are not currently executing any particular statement in
+    /// this frame (can happen e.g. during frame initialization, and during unwinding on
+    /// frames without cleanup code).
+    /// We basically abuse `Result` as `Either`.
+    pub fn current_loc(&self) -> Result<mir::Location, Span> {
+        self.loc
+    }
+
     /// Return the `SourceInfo` of the current instruction.
     pub fn current_source_info(&self) -> Option<&mir::SourceInfo> {
         self.loc.ok().map(|loc| self.body.source_info(loc))
diff --git a/compiler/rustc_mir/src/monomorphize/partitioning/mod.rs b/compiler/rustc_mir/src/monomorphize/partitioning/mod.rs
index b9fcd32250d..b68a8104fba 100644
--- a/compiler/rustc_mir/src/monomorphize/partitioning/mod.rs
+++ b/compiler/rustc_mir/src/monomorphize/partitioning/mod.rs
@@ -239,17 +239,22 @@ where
     I: Iterator<Item = &'a CodegenUnit<'tcx>>,
     'tcx: 'a,
 {
-    if cfg!(debug_assertions) {
-        debug!("{}", label);
+    let dump = move || {
+        use std::fmt::Write;
+
+        let s = &mut String::new();
+        let _ = writeln!(s, "{}", label);
         for cgu in cgus {
-            debug!("CodegenUnit {} estimated size {} :", cgu.name(), cgu.size_estimate());
+            let _ =
+                writeln!(s, "CodegenUnit {} estimated size {} :", cgu.name(), cgu.size_estimate());
 
             for (mono_item, linkage) in cgu.items() {
                 let symbol_name = mono_item.symbol_name(tcx).name;
                 let symbol_hash_start = symbol_name.rfind('h');
                 let symbol_hash = symbol_hash_start.map_or("<no hash>", |i| &symbol_name[i..]);
 
-                debug!(
+                let _ = writeln!(
+                    s,
                     " - {} [{:?}] [{}] estimated size {}",
                     mono_item,
                     linkage,
@@ -258,9 +263,13 @@ where
                 );
             }
 
-            debug!("");
+            let _ = writeln!(s, "");
         }
-    }
+
+        std::mem::take(s)
+    };
+
+    debug!("{}", dump());
 }
 
 #[inline(never)] // give this a place in the profiler
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs
index 4a638ec3f80..4bf870eb7ce 100644
--- a/compiler/rustc_parse/src/lexer/mod.rs
+++ b/compiler/rustc_parse/src/lexer/mod.rs
@@ -268,6 +268,9 @@ impl<'a> StringReader<'a> {
                 // tokens like `<<` from `rustc_lexer`, and then add fancier error recovery to it,
                 // as there will be less overall work to do this way.
                 let token = unicode_chars::check_for_substitution(self, start, c, &mut err);
+                if c == '\x00' {
+                    err.help("source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used");
+                }
                 err.emit();
                 token?
             }
diff --git a/compiler/rustc_target/src/spec/crt_objects.rs b/compiler/rustc_target/src/spec/crt_objects.rs
index 32da16a2d8c..51a48147e6b 100644
--- a/compiler/rustc_target/src/spec/crt_objects.rs
+++ b/compiler/rustc_target/src/spec/crt_objects.rs
@@ -64,17 +64,24 @@ pub(super) fn all(obj: &str) -> CrtObjects {
 
 pub(super) fn pre_musl_fallback() -> CrtObjects {
     new(&[
-        (LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o"]),
-        (LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o"]),
-        (LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o"]),
-        (LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o"]),
-        (LinkOutputKind::DynamicDylib, &["crti.o"]),
-        (LinkOutputKind::StaticDylib, &["crti.o"]),
+        (LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]),
+        (LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o", "crtbeginS.o"]),
+        (LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]),
+        (LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o", "crtbeginS.o"]),
+        (LinkOutputKind::DynamicDylib, &["crti.o", "crtbeginS.o"]),
+        (LinkOutputKind::StaticDylib, &["crti.o", "crtbeginS.o"]),
     ])
 }
 
 pub(super) fn post_musl_fallback() -> CrtObjects {
-    all("crtn.o")
+    new(&[
+        (LinkOutputKind::DynamicNoPicExe, &["crtend.o", "crtn.o"]),
+        (LinkOutputKind::DynamicPicExe, &["crtendS.o", "crtn.o"]),
+        (LinkOutputKind::StaticNoPicExe, &["crtend.o", "crtn.o"]),
+        (LinkOutputKind::StaticPicExe, &["crtendS.o", "crtn.o"]),
+        (LinkOutputKind::DynamicDylib, &["crtendS.o", "crtn.o"]),
+        (LinkOutputKind::StaticDylib, &["crtendS.o", "crtn.o"]),
+    ])
 }
 
 pub(super) fn pre_mingw_fallback() -> CrtObjects {
diff --git a/compiler/rustc_typeck/src/check/method/suggest.rs b/compiler/rustc_typeck/src/check/method/suggest.rs
index 721e8ec54f0..e6c551ff4d4 100644
--- a/compiler/rustc_typeck/src/check/method/suggest.rs
+++ b/compiler/rustc_typeck/src/check/method/suggest.rs
@@ -517,21 +517,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 }
 
                 if self.is_fn_ty(&rcvr_ty, span) {
-                    macro_rules! report_function {
-                        ($span:expr, $name:expr) => {
-                            err.note(&format!(
-                                "`{}` is a function, perhaps you wish to call it",
-                                $name
-                            ));
-                        };
+                    fn report_function<T: std::fmt::Display>(
+                        err: &mut DiagnosticBuilder<'_>,
+                        name: T,
+                    ) {
+                        err.note(
+                            &format!("`{}` is a function, perhaps you wish to call it", name,),
+                        );
                     }
 
                     if let SelfSource::MethodCall(expr) = source {
                         if let Ok(expr_string) = tcx.sess.source_map().span_to_snippet(expr.span) {
-                            report_function!(expr.span, expr_string);
+                            report_function(&mut err, expr_string);
                         } else if let ExprKind::Path(QPath::Resolved(_, ref path)) = expr.kind {
                             if let Some(segment) = path.segments.last() {
-                                report_function!(expr.span, segment.ident);
+                                report_function(&mut err, segment.ident);
                             }
                         }
                     }
diff --git a/library/std/src/f32.rs b/library/std/src/f32.rs
index f51b2c24621..c16d27fa1f5 100644
--- a/library/std/src/f32.rs
+++ b/library/std/src/f32.rs
@@ -503,7 +503,7 @@ impl f32 {
         unsafe { cmath::fdimf(self, other) }
     }
 
-    /// Returns the cubic root of a number.
+    /// Returns the cube root of a number.
     ///
     /// # Examples
     ///
diff --git a/library/std/src/f64.rs b/library/std/src/f64.rs
index 8c41e448686..4c95df5ffe0 100644
--- a/library/std/src/f64.rs
+++ b/library/std/src/f64.rs
@@ -505,7 +505,7 @@ impl f64 {
         unsafe { cmath::fdim(self, other) }
     }
 
-    /// Returns the cubic root of a number.
+    /// Returns the cube root of a number.
     ///
     /// # Examples
     ///
diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs
index d1f9049c8fa..1e72c9e0611 100644
--- a/library/std/src/io/stdio.rs
+++ b/library/std/src/io/stdio.rs
@@ -497,7 +497,7 @@ pub struct Stdout {
 /// A locked reference to the [`Stdout`] handle.
 ///
 /// This handle implements the [`Write`] trait, and is constructed via
-/// the [`Stdout::lock`] method.
+/// the [`Stdout::lock`] method. See its documentation for more.
 ///
 /// ### Note: Windows Portability Consideration
 /// When operating in a console, the Windows implementation of this stream does not support
@@ -711,7 +711,7 @@ pub struct Stderr {
 /// A locked reference to the [`Stderr`] handle.
 ///
 /// This handle implements the [`Write`] trait and is constructed via
-/// the [`Stderr::lock`] method.
+/// the [`Stderr::lock`] method. See its documentation for more.
 ///
 /// ### Note: Windows Portability Consideration
 /// When operating in a console, the Windows implementation of this stream does not support
diff --git a/library/std/src/sync/rwlock.rs b/library/std/src/sync/rwlock.rs
index d967779ce36..0298f59228c 100644
--- a/library/std/src/sync/rwlock.rs
+++ b/library/std/src/sync/rwlock.rs
@@ -23,7 +23,9 @@ use crate::sys_common::rwlock as sys;
 ///
 /// The priority policy of the lock is dependent on the underlying operating
 /// system's implementation, and this type does not guarantee that any
-/// particular policy will be used.
+/// particular policy will be used. In particular, a writer which is waiting to
+/// acquire the lock in `write` might or might not block concurrent calls to
+/// `read`.
 ///
 /// The type parameter `T` represents the data that this lock protects. It is
 /// required that `T` satisfies [`Send`] to be shared across threads and
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 7d5e3d05b11..859e38dc346 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -189,6 +189,12 @@ fn copy_self_contained_objects(
                 DependencyType::TargetSelfContained,
             );
         }
+        for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] {
+            let src = compiler_file(builder, builder.cc(target), target, obj);
+            let target = libdir_self_contained.join(obj);
+            builder.copy(&src, &target);
+            target_deps.push((target, DependencyType::TargetSelfContained));
+        }
     } else if target.ends_with("-wasi") {
         let srcdir = builder.wasi_root(target).unwrap().join("lib/wasm32-wasi");
         for &obj in &["crt1.o", "crt1-reactor.o"] {
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index e5a686bd07d..73c106f5ae0 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -75,7 +75,7 @@ crate fn render<T: Print, S: Print>(
     <![endif]-->\
     {before_content}\
     <nav class=\"sidebar\">\
-        <div class=\"sidebar-menu\">&#9776;</div>\
+        <div class=\"sidebar-menu\" role=\"button\">&#9776;</div>\
         {logo}\
         {sidebar}\
     </nav>\
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 6d9e3d0b9ea..c047f8729ad 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -838,6 +838,14 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
         debug!("looking for the `Self` type");
         let self_id = if item.is_fake() {
             None
+        // Checking if the item is a field in an enum variant
+        } else if (matches!(self.cx.tcx.def_kind(item.def_id), DefKind::Field)
+            && matches!(
+                self.cx.tcx.def_kind(self.cx.tcx.parent(item.def_id).unwrap()),
+                DefKind::Variant
+            ))
+        {
+            self.cx.tcx.parent(item.def_id).and_then(|item_id| self.cx.tcx.parent(item_id))
         } else if matches!(
             self.cx.tcx.def_kind(item.def_id),
             DefKind::AssocConst
diff --git a/src/test/rustdoc/intra-doc/issue-82209.rs b/src/test/rustdoc/intra-doc/issue-82209.rs
new file mode 100644
index 00000000000..76618cdce4c
--- /dev/null
+++ b/src/test/rustdoc/intra-doc/issue-82209.rs
@@ -0,0 +1,11 @@
+#![crate_name = "foo"]
+#![deny(broken_intra_doc_links)]
+pub enum Foo {
+    Bar {
+        abc: i32,
+        /// [Self::Bar::abc]
+        xyz: i32,
+    },
+}
+
+// @has foo/enum.Foo.html '//a/@href' '../foo/enum.Foo.html#variant.Bar.field.abc'
diff --git a/src/test/ui/parser/issue-66473.stderr b/src/test/ui/parser/issue-66473.stderr
index b370b125cfe..8a16d7f9551 100644
--- a/src/test/ui/parser/issue-66473.stderr
+++ b/src/test/ui/parser/issue-66473.stderr
Binary files differdiff --git a/src/test/ui/parser/issue-68629.stderr b/src/test/ui/parser/issue-68629.stderr
index a7885ecec56..19c9ef30f90 100644
--- a/src/test/ui/parser/issue-68629.stderr
+++ b/src/test/ui/parser/issue-68629.stderr
Binary files differdiff --git a/src/test/ui/parser/issue-68730.stderr b/src/test/ui/parser/issue-68730.stderr
index 9f8833e17fe..8602abacabd 100644
--- a/src/test/ui/parser/issue-68730.stderr
+++ b/src/test/ui/parser/issue-68730.stderr
Binary files differdiff --git a/src/test/ui/parser/utf16-be-without-bom.rs b/src/test/ui/parser/utf16-be-without-bom.rs
new file mode 100644
index 00000000000..22aa1971787
--- /dev/null
+++ b/src/test/ui/parser/utf16-be-without-bom.rs
Binary files differdiff --git a/src/test/ui/parser/utf16-be-without-bom.stderr b/src/test/ui/parser/utf16-be-without-bom.stderr
new file mode 100644
index 00000000000..768d2c53164
--- /dev/null
+++ b/src/test/ui/parser/utf16-be-without-bom.stderr
Binary files differdiff --git a/src/test/ui/parser/utf16-le-without-bom.rs b/src/test/ui/parser/utf16-le-without-bom.rs
new file mode 100644
index 00000000000..3c1049929e1
--- /dev/null
+++ b/src/test/ui/parser/utf16-le-without-bom.rs
Binary files differdiff --git a/src/test/ui/parser/utf16-le-without-bom.stderr b/src/test/ui/parser/utf16-le-without-bom.stderr
new file mode 100644
index 00000000000..4f4b91e39ed
--- /dev/null
+++ b/src/test/ui/parser/utf16-le-without-bom.stderr
Binary files differdiff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index f8e0bcc357d..651b478e794 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -132,6 +132,7 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
     "parking_lot",
     "parking_lot_core",
     "pathdiff",
+    "perf-event-open-sys",
     "pkg-config",
     "polonius-engine",
     "ppv-lite86",