Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustup #3901

Merged
merged 31 commits into from
Sep 21, 2024
Merged

Rustup #3901

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f9d2e9d
Update tests for hidden references to mutable static
obeis Aug 24, 2024
bdeca95
Rollup merge of #130380 - Zalathar:counters, r=jieyouxu
matthiaskrgr Sep 17, 2024
7e71052
Auto merge of #130456 - matthiaskrgr:rollup-h2qvk1f, r=matthiaskrgr
bors Sep 17, 2024
e3d53c7
Auto merge of #130145 - fee1-dead-contrib:repeatn, r=lcnr,workingjubilee
bors Sep 17, 2024
201df2b
Auto merge of #130455 - compiler-errors:inline-ordering, r=saethlin
bors Sep 17, 2024
011bb8e
Auto merge of #129073 - compiler-errors:receiver-variance, r=lcnr
bors Sep 17, 2024
2239fbc
Rollup merge of #129674 - matthewpipie:rc-arc-new-cyclic-in, r=dtolnay
matthiaskrgr Sep 17, 2024
72d739a
Rollup merge of #130452 - randomPoison:trusty-update-maintainers, r=e…
matthiaskrgr Sep 17, 2024
92c1434
Rollup merge of #130467 - RalfJung:miri-sync, r=RalfJung
matthiaskrgr Sep 17, 2024
ee1fd30
Rollup merge of #130477 - tmandry:revert-llvm-20-lto, r=tmandry
matthiaskrgr Sep 17, 2024
5c7f412
Auto merge of #130483 - matthiaskrgr:rollup-q1r0g0y, r=matthiaskrgr
bors Sep 17, 2024
d45325c
Auto merge of #130454 - durin42:llvm-20-notrunc, r=workingjubilee
bors Sep 18, 2024
1197206
Auto merge of #129845 - scottmcm:redo-layout, r=Noratrieb
bors Sep 18, 2024
1b00a09
Auto merge of #129491 - StackOverflowExcept1on:master, r=m-ou-se
bors Sep 18, 2024
81a556b
Adapt test to new layout
adwinwhite Sep 19, 2024
500984b
Auto merge of #130511 - bjoernager:const-char-encode-utf8, r=dtolnay
bors Sep 19, 2024
606e73f
Make the intention of the miri test more clear
adwinwhite Sep 19, 2024
1cdcb63
Auto merge of #130069 - GuillaumeGomez:gen-scraped-buttons, r=notriddle
bors Sep 19, 2024
65927f5
Auto merge of #130508 - adwinwhite:niche-not-depend-on-order, r=the8472
bors Sep 20, 2024
ff3b2d0
Auto merge of #130506 - nnethercote:rustc_codegen_llvm-cleanups, r=ji…
bors Sep 20, 2024
c3a1291
Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errors
bors Sep 20, 2024
7ca0cde
Rollup merge of #128209 - beetrees:no-macos-10.10, r=jieyouxu
GuillaumeGomez Sep 20, 2024
531c55f
Rollup merge of #130526 - eholk:pin-reborrow, r=compiler-errors
GuillaumeGomez Sep 20, 2024
112545b
Rollup merge of #130611 - bjoernager:const-char-encode-utf8, r=dtolnay
GuillaumeGomez Sep 20, 2024
d3ca348
Rollup merge of #130619 - GuillaumeGomez:scraped-examples-height, r=n…
GuillaumeGomez Sep 20, 2024
07c9363
Rollup merge of #130624 - theemathas:vec_as_non_null, r=Noratrieb
GuillaumeGomez Sep 20, 2024
fca26f8
Auto merge of #130631 - GuillaumeGomez:rollup-jpgy1iv, r=GuillaumeGomez
bors Sep 20, 2024
fab01c1
Auto merge of #130632 - weihanglo:update-cargo, r=weihanglo
bors Sep 20, 2024
6ca1cbd
Preparing for merge from rustc
RalfJung Sep 21, 2024
e06b473
Merge from rustc
RalfJung Sep 21, 2024
6357a75
fmt (with a huge diff for some reason)
RalfJung Sep 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion miri-script/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::env;
use std::iter;

use anyhow::{bail, Result};
use anyhow::{Result, bail};

pub struct Args {
args: iter::Peekable<env::Args>,
Expand Down
6 changes: 3 additions & 3 deletions miri-script/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ use std::path::PathBuf;
use std::process;
use std::time::Duration;

use anyhow::{anyhow, bail, Context, Result};
use anyhow::{Context, Result, anyhow, bail};
use path_macro::path;
use walkdir::WalkDir;
use xshell::{cmd, Shell};
use xshell::{Shell, cmd};

use crate::util::*;
use crate::Command;
use crate::util::*;

/// Used for rustc syncs.
const JOSH_FILTER: &str =
Expand Down
2 changes: 1 addition & 1 deletion miri-script/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod util;

use std::ops::Range;

use anyhow::{anyhow, bail, Context, Result};
use anyhow::{Context, Result, anyhow, bail};

#[derive(Clone, Debug)]
pub enum Command {
Expand Down
4 changes: 2 additions & 2 deletions miri-script/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
use std::{env, iter, thread};

use anyhow::{anyhow, bail, Context, Result};
use anyhow::{Context, Result, anyhow, bail};
use dunce::canonicalize;
use path_macro::path;
use xshell::{cmd, Cmd, Shell};
use xshell::{Cmd, Shell, cmd};

pub fn miri_dir() -> std::io::Result<PathBuf> {
const MIRI_SCRIPT_ROOT_DIR: &str = env!("CARGO_MANIFEST_DIR");
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e2dc1a1c0f97a90319181a721ab317210307617a
c0838c8ebec23fb87855bb6de3a287981cb1df98
2 changes: 1 addition & 1 deletion src/alloc_addresses/reuse_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rand::Rng;

use rustc_target::abi::{Align, Size};

use crate::{concurrency::VClock, MemoryKind, MiriConfig, ThreadId};
use crate::{MemoryKind, MiriConfig, ThreadId, concurrency::VClock};

const MAX_POOL_SIZE: usize = 64;

Expand Down
22 changes: 10 additions & 12 deletions src/borrow_tracker/stacked_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ use std::mem;

use rustc_data_structures::fx::FxHashSet;
use rustc_middle::mir::{Mutability, RetagKind};
use rustc_middle::ty::{self, layout::HasParamEnv, Ty};
use rustc_middle::ty::{self, Ty, layout::HasParamEnv};
use rustc_target::abi::{Abi, Size};

use crate::borrow_tracker::{
stacked_borrows::diagnostics::{AllocHistory, DiagnosticCx, DiagnosticCxBuilder},
GlobalStateInner, ProtectorKind,
stacked_borrows::diagnostics::{AllocHistory, DiagnosticCx, DiagnosticCxBuilder},
};
use crate::concurrency::data_race::{NaReadType, NaWriteType};
use crate::*;
Expand Down Expand Up @@ -913,11 +913,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
new_perm: NewPermission,
) -> InterpResult<'tcx> {
let val = self.ecx.read_immediate(&self.ecx.place_to_op(place)?)?;
let val = self.ecx.sb_retag_reference(
&val,
new_perm,
RetagInfo { cause: self.retag_cause, in_field: self.in_field },
)?;
let val = self.ecx.sb_retag_reference(&val, new_perm, RetagInfo {
cause: self.retag_cause,
in_field: self.in_field,
})?;
self.ecx.write_immediate(*val, place)?;
Ok(())
}
Expand Down Expand Up @@ -1003,11 +1002,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
access: Some(AccessKind::Write),
protector: Some(ProtectorKind::StrongProtector),
};
this.sb_retag_place(
place,
new_perm,
RetagInfo { cause: RetagCause::InPlaceFnPassing, in_field: false },
)
this.sb_retag_place(place, new_perm, RetagInfo {
cause: RetagCause::InPlaceFnPassing,
in_field: false,
})
}

/// Mark the given tag as exposed. It was found on a pointer with the given AllocId.
Expand Down
4 changes: 2 additions & 2 deletions src/borrow_tracker/stacked_borrows/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use std::ops::Range;
use rustc_data_structures::fx::FxHashSet;
use tracing::trace;

use crate::ProvenanceExtra;
use crate::borrow_tracker::{
stacked_borrows::{Item, Permission},
AccessKind, BorTag,
stacked_borrows::{Item, Permission},
};
use crate::ProvenanceExtra;

/// Exactly what cache size we should use is a difficult trade-off. There will always be some
/// workload which has a `BorTag` working set which exceeds the size of the cache, and ends up
Expand Down
2 changes: 1 addition & 1 deletion src/borrow_tracker/tree_borrows/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use std::ops::Range;
use rustc_data_structures::fx::FxHashMap;
use rustc_span::{Span, SpanData};

use crate::borrow_tracker::ProtectorKind;
use crate::borrow_tracker::tree_borrows::{
perms::{PermTransition, Permission},
tree::LocationState,
unimap::UniIndex,
};
use crate::borrow_tracker::ProtectorKind;
use crate::*;

/// Cause of an access: either a real access or one
Expand Down
2 changes: 1 addition & 1 deletion src/borrow_tracker/tree_borrows/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc_middle::{
mir::{Mutability, RetagKind},
ty::{self, layout::HasParamEnv, Ty},
ty::{self, Ty, layout::HasParamEnv},
};
use rustc_span::def_id::DefId;
use rustc_target::abi::{Abi, Size};
Expand Down
24 changes: 10 additions & 14 deletions src/borrow_tracker/tree_borrows/perms.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::cmp::{Ordering, PartialOrd};
use std::fmt;

use crate::AccessKind;
use crate::borrow_tracker::tree_borrows::diagnostics::TransitionError;
use crate::borrow_tracker::tree_borrows::tree::AccessRelatedness;
use crate::AccessKind;

/// The activation states of a pointer.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -345,18 +345,14 @@ pub mod diagnostics {
use super::*;
impl fmt::Display for PermissionPriv {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"{}",
match self {
ReservedFrz { conflicted: false } => "Reserved",
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
ReservedIM => "Reserved (interior mutable)",
Active => "Active",
Frozen => "Frozen",
Disabled => "Disabled",
}
)
write!(f, "{}", match self {
ReservedFrz { conflicted: false } => "Reserved",
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
ReservedIM => "Reserved (interior mutable)",
Active => "Active",
Frozen => "Frozen",
Disabled => "Disabled",
})
}
}

Expand Down Expand Up @@ -551,7 +547,7 @@ impl Permission {
#[cfg(test)]
mod propagation_optimization_checks {
pub use super::*;
use crate::borrow_tracker::tree_borrows::exhaustive::{precondition, Exhaustive};
use crate::borrow_tracker::tree_borrows::exhaustive::{Exhaustive, precondition};

impl Exhaustive for PermissionPriv {
fn exhaustive() -> Box<dyn Iterator<Item = Self>> {
Expand Down
36 changes: 15 additions & 21 deletions src/borrow_tracker/tree_borrows/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ use rustc_span::Span;
use rustc_target::abi::Size;

use crate::borrow_tracker::tree_borrows::{
Permission,
diagnostics::{self, NodeDebugInfo, TbError, TransitionError},
perms::PermTransition,
unimap::{UniEntry, UniIndex, UniKeyMap, UniValMap},
Permission,
};
use crate::borrow_tracker::{GlobalState, ProtectorKind};
use crate::*;
Expand Down Expand Up @@ -587,16 +587,13 @@ impl Tree {
let mut debug_info = NodeDebugInfo::new(root_tag, root_default_perm, span);
// name the root so that all allocations contain one named pointer
debug_info.add_name("root of the allocation");
nodes.insert(
root_idx,
Node {
tag: root_tag,
parent: None,
children: SmallVec::default(),
default_initial_perm: root_default_perm,
debug_info,
},
);
nodes.insert(root_idx, Node {
tag: root_tag,
parent: None,
children: SmallVec::default(),
default_initial_perm: root_default_perm,
debug_info,
});
nodes
};
let rperms = {
Expand Down Expand Up @@ -626,16 +623,13 @@ impl<'tcx> Tree {
let idx = self.tag_mapping.insert(new_tag);
let parent_idx = self.tag_mapping.get(&parent_tag).unwrap();
// Create the node
self.nodes.insert(
idx,
Node {
tag: new_tag,
parent: Some(parent_idx),
children: SmallVec::default(),
default_initial_perm,
debug_info: NodeDebugInfo::new(new_tag, default_initial_perm, span),
},
);
self.nodes.insert(idx, Node {
tag: new_tag,
parent: Some(parent_idx),
children: SmallVec::default(),
default_initial_perm,
debug_info: NodeDebugInfo::new(new_tag, default_initial_perm, span),
});
// Register new_tag as a child of parent_tag
self.nodes.get_mut(parent_idx).unwrap().children.push(idx);
// Initialize perms
Expand Down
2 changes: 1 addition & 1 deletion src/borrow_tracker/tree_borrows/tree/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![cfg(test)]

use super::*;
use crate::borrow_tracker::tree_borrows::exhaustive::{precondition, Exhaustive};
use crate::borrow_tracker::tree_borrows::exhaustive::{Exhaustive, precondition};
use std::fmt;

impl Exhaustive for LocationState {
Expand Down
22 changes: 9 additions & 13 deletions src/concurrency/sync.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::any::Any;
use std::collections::{hash_map::Entry, VecDeque};
use std::collections::{VecDeque, hash_map::Entry};
use std::ops::Not;
use std::time::Duration;

Expand Down Expand Up @@ -283,12 +283,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
data: Option<Box<dyn Any>>,
) -> InterpResult<'tcx, MutexId> {
let this = self.eval_context_mut();
this.create_id(
lock,
offset,
|ecx| &mut ecx.machine.sync.mutexes,
Mutex { data, ..Default::default() },
)
this.create_id(lock, offset, |ecx| &mut ecx.machine.sync.mutexes, Mutex {
data,
..Default::default()
})
}

/// Lazily create a new mutex.
Expand Down Expand Up @@ -355,12 +353,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
data: Option<Box<dyn Any>>,
) -> InterpResult<'tcx, CondvarId> {
let this = self.eval_context_mut();
this.create_id(
condvar,
offset,
|ecx| &mut ecx.machine.sync.condvars,
Condvar { data, ..Default::default() },
)
this.create_id(condvar, offset, |ecx| &mut ecx.machine.sync.condvars, Condvar {
data,
..Default::default()
})
}

fn condvar_get_or_create_id(
Expand Down
2 changes: 1 addition & 1 deletion src/concurrency/vector_clock.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rustc_index::Idx;
use rustc_span::{Span, SpanData, DUMMY_SP};
use rustc_span::{DUMMY_SP, Span, SpanData};
use smallvec::SmallVec;
use std::{
cmp::Ordering,
Expand Down
2 changes: 1 addition & 1 deletion src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fmt::{self, Write};
use std::num::NonZero;

use rustc_errors::{Diag, DiagMessage, Level};
use rustc_span::{SpanData, Symbol, DUMMY_SP};
use rustc_span::{DUMMY_SP, SpanData, Symbol};
use rustc_target::abi::{Align, Size};

use crate::borrow_tracker::stacked_borrows::diagnostics::TagHistory;
Expand Down
3 changes: 1 addition & 2 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_hir::def::Namespace;
use rustc_hir::def_id::DefId;
use rustc_middle::ty::{
self,
self, Ty, TyCtxt,
layout::{LayoutCx, LayoutOf},
Ty, TyCtxt,
};
use rustc_target::spec::abi::Abi;

Expand Down
9 changes: 4 additions & 5 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use std::time::Duration;

use rand::RngCore;

use rustc_apfloat::ieee::{Double, Half, Quad, Single};
use rustc_apfloat::Float;
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
use rustc_hir::{
def::{DefKind, Namespace},
def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE},
Safety,
def::{DefKind, Namespace},
def_id::{CRATE_DEF_INDEX, CrateNum, DefId, LOCAL_CRATE},
};
use rustc_index::IndexVec;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
Expand All @@ -21,9 +21,8 @@ use rustc_middle::middle::exported_symbols::ExportedSymbol;
use rustc_middle::mir;
use rustc_middle::ty::layout::{FnAbiOf, MaybeResult};
use rustc_middle::ty::{
self,
self, FloatTy, IntTy, Ty, TyCtxt, UintTy,
layout::{LayoutOf, TyAndLayout},
FloatTy, IntTy, Ty, TyCtxt, UintTy,
};
use rustc_session::config::CrateType;
use rustc_span::{Span, Symbol};
Expand Down
4 changes: 2 additions & 2 deletions src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use rustc_middle::{
mir,
ty::{self, FloatTy},
};
use rustc_span::{sym, Symbol};
use rustc_span::{Symbol, sym};
use rustc_target::abi::Size;

use crate::*;
use atomic::EvalContextExt as _;
use helpers::{check_arg_count, ToHost, ToSoft};
use helpers::{ToHost, ToSoft, check_arg_count};
use simd::EvalContextExt as _;

impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
Expand Down
4 changes: 2 additions & 2 deletions src/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use either::Either;
use rustc_apfloat::{Float, Round};
use rustc_middle::ty::layout::{HasParamEnv, LayoutOf};
use rustc_middle::{mir, ty, ty::FloatTy};
use rustc_span::{sym, Symbol};
use rustc_span::{Symbol, sym};
use rustc_target::abi::{Endian, HasDataLayout};

use crate::helpers::{bool_to_simd_element, check_arg_count, simd_element_to_bool, ToHost, ToSoft};
use crate::helpers::{ToHost, ToSoft, bool_to_simd_element, check_arg_count, simd_element_to_bool};
use crate::*;

#[derive(Copy, Clone)]
Expand Down
Loading