diff --git a/compiler/rustc_ast/src/ptr.rs b/compiler/rustc_ast/src/ptr.rs index 89a0857992e49..bab85a3019d61 100644 --- a/compiler/rustc_ast/src/ptr.rs +++ b/compiler/rustc_ast/src/ptr.rs @@ -10,7 +10,7 @@ //! //! * **Immutability**: `P` disallows mutating its inner `T`, unlike `Box` //! (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` and `Vec`, //! 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 2e077ae244072..1a0cac8fe79a9 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 ba8b0670147ae..dc229c9ff9b44 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -555,7 +555,11 @@ pub const fn null_mut() -> *mut T { #[unstable(feature = "strict_provenance", issue = "95228")] pub const fn invalid(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(addr: usize) -> *const T { #[unstable(feature = "strict_provenance", issue = "95228")] pub const fn invalid_mut(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 8b6b4fa02f833..32c31803a5115 100644 --- a/library/core/src/str/traits.rs +++ b/library/core/src/str/traits.rs @@ -530,8 +530,12 @@ unsafe impl const SliceIndex for ops::RangeToInclusive { /// } /// } /// -/// 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::(), 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 16727f4398dff..a6fb72c03f3dd 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 20a98111bebaa..19504a51a584b 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 9d4c45b8a6251..cb163d540e0a8 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 42acd30a0ff6a..4066bcf3badd7 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(); }