Skip to content

Commit 3b9cf89

Browse files
committed
Auto merge of rust-lang#97246 - GuillaumeGomez:rollup-btcok8x, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - rust-lang#97190 (Add implicit call to from_str via parse in documentation) - rust-lang#97218 (Add eslint checks) - rust-lang#97219 (make ptr::invalid not the same as a regular int2ptr cast) - rust-lang#97223 (Remove quadratic behaviour from -Zunpretty=hir-tree.) - rust-lang#97232 (typo) - rust-lang#97237 (Add some more weird-exprs) - rust-lang#97238 (Bump LLVM fetched from CI to fix run-make) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5f33adc + 28730ac commit 3b9cf89

File tree

8 files changed

+68
-8
lines changed

8 files changed

+68
-8
lines changed

compiler/rustc_ast/src/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//!
1111
//! * **Immutability**: `P<T>` disallows mutating its inner `T`, unlike `Box<T>`
1212
//! (unless it contains an `Unsafe` interior, but that may be denied later).
13-
//! This mainly prevents mistakes, but can also enforces a kind of "purity".
13+
//! This mainly prevents mistakes, but also enforces a kind of "purity".
1414
//!
1515
//! * **Efficiency**: folding can reuse allocation space for `P<T>` and `Vec<T>`,
1616
//! the latter even when the input and output types differ (as it would be the

compiler/rustc_hir/src/hir.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,6 @@ impl<'tcx> AttributeMap<'tcx> {
796796
/// Map of all HIR nodes inside the current owner.
797797
/// These nodes are mapped by `ItemLocalId` alongside the index of their parent node.
798798
/// The HIR tree, including bodies, is pre-hashed.
799-
#[derive(Debug)]
800799
pub struct OwnerNodes<'tcx> {
801800
/// Pre-computed hash of the full HIR.
802801
pub hash_including_bodies: Fingerprint,
@@ -822,6 +821,18 @@ impl<'tcx> OwnerNodes<'tcx> {
822821
}
823822
}
824823

824+
impl fmt::Debug for OwnerNodes<'_> {
825+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
826+
f.debug_struct("OwnerNodes")
827+
.field("node", &self.nodes[ItemLocalId::from_u32(0)])
828+
.field("bodies", &self.bodies)
829+
.field("local_id_to_def_id", &self.local_id_to_def_id)
830+
.field("hash_without_bodies", &self.hash_without_bodies)
831+
.field("hash_including_bodies", &self.hash_including_bodies)
832+
.finish()
833+
}
834+
}
835+
825836
/// Full information resulting from lowering an AST node.
826837
#[derive(Debug, HashStable_Generic)]
827838
pub struct OwnerInfo<'hir> {

library/core/src/ptr/mod.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,11 @@ pub const fn null_mut<T>() -> *mut T {
555555
#[unstable(feature = "strict_provenance", issue = "95228")]
556556
pub const fn invalid<T>(addr: usize) -> *const T {
557557
// FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
558-
addr as *const T
558+
// We use transmute rather than a cast so tools like Miri can tell that this
559+
// is *not* the same as from_exposed_addr.
560+
// SAFETY: every valid integer is also a valid pointer (as long as you don't dereference that
561+
// pointer).
562+
unsafe { mem::transmute(addr) }
559563
}
560564

561565
/// Creates an invalid mutable pointer with the given address.
@@ -582,7 +586,11 @@ pub const fn invalid<T>(addr: usize) -> *const T {
582586
#[unstable(feature = "strict_provenance", issue = "95228")]
583587
pub const fn invalid_mut<T>(addr: usize) -> *mut T {
584588
// FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
585-
addr as *mut T
589+
// We use transmute rather than a cast so tools like Miri can tell that this
590+
// is *not* the same as from_exposed_addr.
591+
// SAFETY: every valid integer is also a valid pointer (as long as you don't dereference that
592+
// pointer).
593+
unsafe { mem::transmute(addr) }
586594
}
587595

588596
/// Convert an address back to a pointer, picking up a previously 'exposed' provenance.

library/core/src/str/traits.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,12 @@ unsafe impl const SliceIndex<str> for ops::RangeToInclusive<usize> {
530530
/// }
531531
/// }
532532
///
533-
/// let p = Point::from_str("(1,2)");
534-
/// assert_eq!(p.unwrap(), Point{ x: 1, y: 2} )
533+
/// let expected = Ok(Point { x: 1, y: 2 });
534+
/// // Explicit call
535+
/// assert_eq!(Point::from_str("(1,2)"), expected);
536+
/// // Implicit calls, through parse
537+
/// assert_eq!("(1,2)".parse(), expected);
538+
/// assert_eq!("(1,2)".parse::<Point>(), expected);
535539
/// ```
536540
#[stable(feature = "rust1", since = "1.0.0")]
537541
pub trait FromStr: Sized {

src/bootstrap/dist.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2038,6 +2038,9 @@ impl Step for RustDev {
20382038
tarball.set_overlay(OverlayKind::LLVM);
20392039

20402040
let src_bindir = builder.llvm_out(target).join("bin");
2041+
// If updating this list, you likely want to change
2042+
// src/bootstrap/download-ci-llvm-stamp as well, otherwise local users
2043+
// will not pick up the extra file until LLVM gets bumped.
20412044
for bin in &[
20422045
"llvm-config",
20432046
"llvm-ar",

src/bootstrap/download-ci-llvm-stamp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Change this file to make users of the `download-ci-llvm` configuration download
22
a new version of LLVM from CI, even if the LLVM submodule hasn’t changed.
33

4-
Last change is for: https://github.com/rust-lang/rust/pull/94023
4+
Last change is for: https://github.com/rust-lang/rust/pull/96867

src/librustdoc/html/static/.eslintrc.js

+8
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,13 @@ module.exports = {
3838
"error",
3939
{ "before": true, "after": true }
4040
],
41+
"arrow-spacing": [
42+
"error",
43+
{ "before": true, "after": true }
44+
],
45+
"key-spacing": [
46+
"error",
47+
{ "beforeColon": false, "afterColon": true, "mode": "strict" }
48+
],
4149
}
4250
};

src/test/ui/weird-exprs.rs

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// run-pass
22

33
#![feature(generators)]
4+
#![feature(unboxed_closures, fn_traits)]
45

56
#![allow(non_camel_case_types)]
67
#![allow(dead_code)]
78
#![allow(unreachable_code)]
89
#![allow(unused_braces, unused_must_use, unused_parens)]
10+
#![allow(uncommon_codepoints, confusable_idents)]
911

1012
#![recursion_limit = "256"]
1113

@@ -115,7 +117,7 @@ fn union() {
115117
}
116118

117119
fn special_characters() {
118-
let val = !((|(..):(_,_),__@_|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})//
120+
let val = !((|(..):(_,_),(|__@_|__)|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})//
119121
;
120122
assert!(!val);
121123
}
@@ -164,6 +166,28 @@ fn monkey_barrel() {
164166
assert_eq!(val, ());
165167
}
166168

169+
fn 𝚌𝚘𝚗𝚝𝚒𝚗𝚞𝚎() {
170+
type 𝚕𝚘𝚘𝚙 = i32;
171+
fn 𝚋𝚛𝚎𝚊𝚔() -> 𝚕𝚘𝚘𝚙 {
172+
let 𝚛𝚎𝚝𝚞𝚛𝚗 = 42;
173+
return 𝚛𝚎𝚝𝚞𝚛𝚗;
174+
}
175+
assert_eq!(loop {
176+
break 𝚋𝚛𝚎𝚊𝚔 ();
177+
}, 42);
178+
}
179+
180+
fn function() {
181+
struct foo;
182+
impl FnOnce<()> for foo {
183+
type Output = foo;
184+
extern "rust-call" fn call_once(self, _args: ()) -> Self::Output {
185+
foo
186+
}
187+
}
188+
let foo = foo () ()() ()()() ()()()() ()()()()();
189+
}
190+
167191
fn bathroom_stall() {
168192
let mut i = 1;
169193
matches!(2, _|_|_|_|_|_ if (i+=1) != (i+=1));
@@ -189,5 +213,7 @@ pub fn main() {
189213
i_yield();
190214
match_nested_if();
191215
monkey_barrel();
216+
𝚌𝚘𝚗𝚝𝚒𝚗𝚞𝚎();
217+
function();
192218
bathroom_stall();
193219
}

0 commit comments

Comments
 (0)