about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-21 11:28:48 +0000
committerbors <bors@rust-lang.org>2022-05-21 11:28:48 +0000
commit3b9cf893d0cd1236b988ac2401869eadc39eff76 (patch)
tree3cae4e5ba5719ee47cd3afba72b09b4155421220
parent5f33adce1bfe01e4c0c8754400bf782a95af88c9 (diff)
parent28730acdbe1f8f1d51066c02b418d737b8d15338 (diff)
downloadrust-3b9cf893d0cd1236b988ac2401869eadc39eff76.tar.gz
rust-3b9cf893d0cd1236b988ac2401869eadc39eff76.zip
Auto merge of #97246 - GuillaumeGomez:rollup-btcok8x, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #97190 (Add implicit call to from_str via parse in documentation)
 - #97218 (Add eslint checks)
 - #97219 (make ptr::invalid not the same as a regular int2ptr cast)
 - #97223 (Remove quadratic behaviour from -Zunpretty=hir-tree.)
 - #97232 (typo)
 - #97237 (Add some more weird-exprs)
 - #97238 (Bump LLVM fetched from CI to fix run-make)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
-rw-r--r--compiler/rustc_ast/src/ptr.rs2
-rw-r--r--compiler/rustc_hir/src/hir.rs13
-rw-r--r--library/core/src/ptr/mod.rs12
-rw-r--r--library/core/src/str/traits.rs8
-rw-r--r--src/bootstrap/dist.rs3
-rw-r--r--src/bootstrap/download-ci-llvm-stamp2
-rw-r--r--src/librustdoc/html/static/.eslintrc.js8
-rw-r--r--src/test/ui/weird-exprs.rs28
8 files changed, 68 insertions, 8 deletions
diff --git a/compiler/rustc_ast/src/ptr.rs b/compiler/rustc_ast/src/ptr.rs
index 89a0857992e..bab85a3019d 100644
--- a/compiler/rustc_ast/src/ptr.rs
+++ b/compiler/rustc_ast/src/ptr.rs
@@ -10,7 +10,7 @@
 //!
 //! * **Immutability**: `P<T>` disallows mutating its inner `T`, unlike `Box<T>`
 //!   (unless it contains an `Unsafe` interior, but that may be denied later).
-//!   This mainly prevents mistakes, but can also enforces a kind of "purity".
+//!   This mainly prevents mistakes, but also enforces a kind of "purity".
 //!
 //! * **Efficiency**: folding can reuse allocation space for `P<T>` and `Vec<T>`,
 //!   the latter even when the input and output types differ (as it would be the
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index 2e077ae2440..1a0cac8fe79 100644
--- a/compiler/rustc_hir/src/hir.rs
+++ b/compiler/rustc_hir/src/hir.rs
@@ -796,7 +796,6 @@ impl<'tcx> AttributeMap<'tcx> {
 /// Map of all HIR nodes inside the current owner.
 /// These nodes are mapped by `ItemLocalId` alongside the index of their parent node.
 /// The HIR tree, including bodies, is pre-hashed.
-#[derive(Debug)]
 pub struct OwnerNodes<'tcx> {
     /// Pre-computed hash of the full HIR.
     pub hash_including_bodies: Fingerprint,
@@ -822,6 +821,18 @@ impl<'tcx> OwnerNodes<'tcx> {
     }
 }
 
+impl fmt::Debug for OwnerNodes<'_> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.debug_struct("OwnerNodes")
+            .field("node", &self.nodes[ItemLocalId::from_u32(0)])
+            .field("bodies", &self.bodies)
+            .field("local_id_to_def_id", &self.local_id_to_def_id)
+            .field("hash_without_bodies", &self.hash_without_bodies)
+            .field("hash_including_bodies", &self.hash_including_bodies)
+            .finish()
+    }
+}
+
 /// Full information resulting from lowering an AST node.
 #[derive(Debug, HashStable_Generic)]
 pub struct OwnerInfo<'hir> {
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs
index ba8b0670147..dc229c9ff9b 100644
--- a/library/core/src/ptr/mod.rs
+++ b/library/core/src/ptr/mod.rs
@@ -555,7 +555,11 @@ pub const fn null_mut<T>() -> *mut T {
 #[unstable(feature = "strict_provenance", issue = "95228")]
 pub const fn invalid<T>(addr: usize) -> *const T {
     // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
-    addr as *const T
+    // We use transmute rather than a cast so tools like Miri can tell that this
+    // is *not* the same as from_exposed_addr.
+    // SAFETY: every valid integer is also a valid pointer (as long as you don't dereference that
+    // pointer).
+    unsafe { mem::transmute(addr) }
 }
 
 /// Creates an invalid mutable pointer with the given address.
@@ -582,7 +586,11 @@ pub const fn invalid<T>(addr: usize) -> *const T {
 #[unstable(feature = "strict_provenance", issue = "95228")]
 pub const fn invalid_mut<T>(addr: usize) -> *mut T {
     // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
-    addr as *mut T
+    // We use transmute rather than a cast so tools like Miri can tell that this
+    // is *not* the same as from_exposed_addr.
+    // SAFETY: every valid integer is also a valid pointer (as long as you don't dereference that
+    // pointer).
+    unsafe { mem::transmute(addr) }
 }
 
 /// Convert an address back to a pointer, picking up a previously 'exposed' provenance.
diff --git a/library/core/src/str/traits.rs b/library/core/src/str/traits.rs
index 8b6b4fa02f8..32c31803a51 100644
--- a/library/core/src/str/traits.rs
+++ b/library/core/src/str/traits.rs
@@ -530,8 +530,12 @@ unsafe impl const SliceIndex<str> for ops::RangeToInclusive<usize> {
 ///     }
 /// }
 ///
-/// let p = Point::from_str("(1,2)");
-/// assert_eq!(p.unwrap(), Point{ x: 1, y: 2} )
+/// let expected = Ok(Point { x: 1, y: 2 });
+/// // Explicit call
+/// assert_eq!(Point::from_str("(1,2)"), expected);
+/// // Implicit calls, through parse
+/// assert_eq!("(1,2)".parse(), expected);
+/// assert_eq!("(1,2)".parse::<Point>(), expected);
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait FromStr: Sized {
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 16727f4398d..a6fb72c03f3 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -2038,6 +2038,9 @@ impl Step for RustDev {
         tarball.set_overlay(OverlayKind::LLVM);
 
         let src_bindir = builder.llvm_out(target).join("bin");
+        // If updating this list, you likely want to change
+        // src/bootstrap/download-ci-llvm-stamp as well, otherwise local users
+        // will not pick up the extra file until LLVM gets bumped.
         for bin in &[
             "llvm-config",
             "llvm-ar",
diff --git a/src/bootstrap/download-ci-llvm-stamp b/src/bootstrap/download-ci-llvm-stamp
index 20a98111beb..19504a51a58 100644
--- a/src/bootstrap/download-ci-llvm-stamp
+++ b/src/bootstrap/download-ci-llvm-stamp
@@ -1,4 +1,4 @@
 Change this file to make users of the `download-ci-llvm` configuration download
 a new version of LLVM from CI, even if the LLVM submodule hasn’t changed.
 
-Last change is for: https://github.com/rust-lang/rust/pull/94023
+Last change is for: https://github.com/rust-lang/rust/pull/96867
diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js
index 9d4c45b8a62..cb163d540e0 100644
--- a/src/librustdoc/html/static/.eslintrc.js
+++ b/src/librustdoc/html/static/.eslintrc.js
@@ -38,5 +38,13 @@ module.exports = {
             "error",
             { "before": true, "after": true }
         ],
+        "arrow-spacing": [
+            "error",
+            { "before": true, "after": true }
+        ],
+        "key-spacing": [
+            "error",
+            { "beforeColon": false, "afterColon": true, "mode": "strict" }
+        ],
     }
 };
diff --git a/src/test/ui/weird-exprs.rs b/src/test/ui/weird-exprs.rs
index 42acd30a0ff..4066bcf3bad 100644
--- a/src/test/ui/weird-exprs.rs
+++ b/src/test/ui/weird-exprs.rs
@@ -1,11 +1,13 @@
 // run-pass
 
 #![feature(generators)]
+#![feature(unboxed_closures, fn_traits)]
 
 #![allow(non_camel_case_types)]
 #![allow(dead_code)]
 #![allow(unreachable_code)]
 #![allow(unused_braces, unused_must_use, unused_parens)]
+#![allow(uncommon_codepoints, confusable_idents)]
 
 #![recursion_limit = "256"]
 
@@ -115,7 +117,7 @@ fn union() {
 }
 
 fn special_characters() {
-    let val = !((|(..):(_,_),__@_|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})//
+    let val = !((|(..):(_,_),(|__@_|__)|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})//
     ;
     assert!(!val);
 }
@@ -164,6 +166,28 @@ fn monkey_barrel() {
     assert_eq!(val, ());
 }
 
+fn 𝚌𝚘𝚗𝚝𝚒𝚗𝚞𝚎() {
+    type 𝚕𝚘𝚘𝚙 = i32;
+    fn 𝚋𝚛𝚎𝚊𝚔() -> 𝚕𝚘𝚘𝚙 {
+        let 𝚛𝚎𝚝𝚞𝚛𝚗 = 42;
+        return 𝚛𝚎𝚝𝚞𝚛𝚗;
+    }
+    assert_eq!(loop {
+        break 𝚋𝚛𝚎𝚊𝚔 ();
+    }, 42);
+}
+
+fn function() {
+    struct foo;
+    impl FnOnce<()> for foo {
+        type Output = foo;
+        extern "rust-call" fn call_once(self, _args: ()) -> Self::Output {
+            foo
+        }
+    }
+    let foo = foo () ()() ()()() ()()()() ()()()()();
+}
+
 fn bathroom_stall() {
     let mut i = 1;
     matches!(2, _|_|_|_|_|_ if (i+=1) != (i+=1));
@@ -189,5 +213,7 @@ pub fn main() {
     i_yield();
     match_nested_if();
     monkey_barrel();
+    𝚌𝚘𝚗𝚝𝚒𝚗𝚞𝚎();
+    function();
     bathroom_stall();
 }