Skip to content

Commit

Permalink
Auto merge of rust-lang#97246 - GuillaumeGomez:rollup-btcok8x, r=Guil…
Browse files Browse the repository at this point in the history
…laumeGomez

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
  • Loading branch information
bors committed May 21, 2022
2 parents 5f33adc + 28730ac commit 3b9cf89
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 8 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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> {
Expand Down
12 changes: 10 additions & 2 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
8 changes: 6 additions & 2 deletions library/core/src/str/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/download-ci-llvm-stamp
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions src/librustdoc/html/static/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
],
}
};
28 changes: 27 additions & 1 deletion src/test/ui/weird-exprs.rs
Original file line number Diff line number Diff line change
@@ -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"]

Expand Down Expand Up @@ -115,7 +117,7 @@ fn union() {
}

fn special_characters() {
let val = !((|(..):(_,_),__@_|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})//
let val = !((|(..):(_,_),(|__@_|__)|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})//
;
assert!(!val);
}
Expand Down Expand Up @@ -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));
Expand All @@ -189,5 +213,7 @@ pub fn main() {
i_yield();
match_nested_if();
monkey_barrel();
𝚌𝚘𝚗𝚝𝚒𝚗𝚞𝚎();
function();
bathroom_stall();
}

0 comments on commit 3b9cf89

Please sign in to comment.