Skip to content

Commit eeba34e

Browse files
author
The rustc-josh-sync Cronjob Bot
committed
Merge ref 'd36f96412516' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: d36f964125163c2e698de5559efefb8217b8b7f0 Filtered ref: 92461731ae79cfe5044e4826160665b77c0363a2 This merge was created using https://github.com/rust-lang/josh-sync.
2 parents 58b50b7 + fe2e0d5 commit eeba34e

File tree

102 files changed

+599
-180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+599
-180
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ jobs:
6969
sudo apt update
7070
# Install needed packages
7171
sudo apt install $(echo "libatomic1: zlib1g-dev:" | sed 's/:/:${{ matrix.multiarch }}/g')
72-
- name: Install rustup on Windows ARM
73-
if: ${{ matrix.os == 'windows-11-arm' }}
74-
run: |
75-
curl -LOs https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe
76-
./rustup-init.exe -y --no-modify-path
77-
echo "$USERPROFILE/.cargo/bin" >> "$GITHUB_PATH"
7872
- uses: ./.github/workflows/setup
7973
with:
8074
toolchain_flags: "--host ${{ matrix.host_target }}"
@@ -169,7 +163,13 @@ jobs:
169163
run: rustup toolchain install nightly --profile minimal
170164
- name: Install rustup-toolchain-install-master
171165
run: cargo install -f rustup-toolchain-install-master
172-
- name: Push changes to a branch and create PR
166+
# Create a token for the next step so it can create a PR that actually runs CI.
167+
- uses: actions/create-github-app-token@v2
168+
id: app-token
169+
with:
170+
app-id: ${{ vars.APP_CLIENT_ID }}
171+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
172+
- name: pull changes from rustc and create PR
173173
run: |
174174
# Make it easier to see what happens.
175175
set -x
@@ -198,9 +198,9 @@ jobs:
198198
BRANCH="rustup-$(date -u +%Y-%m-%d)"
199199
git switch -c $BRANCH
200200
git push -u origin $BRANCH
201-
gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.'
201+
gh pr create -B master --title 'Automatic Rustup' --body "Update \`rustc\` to https://github.com/rust-lang/rust/commit/$(cat rust-version)."
202202
env:
203-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
203+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
204204

205205
cron-fail-notify:
206206
name: cronjob failure notification

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ native-lib = ["dep:libffi", "dep:libloading", "dep:capstone", "dep:ipc-channel",
7878

7979
[lints.rust.unexpected_cfgs]
8080
level = "warn"
81+
check-cfg = ['cfg(bootstrap)']
8182

8283
# Be aware that this file is inside a workspace when used via the
8384
# submodule in the rustc repo. That means there are many cargo features

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
733dab558992d902d6d17576de1da768094e2cf3
1+
f605b57042ffeb320d7ae44490113a827139b766

src/borrow_tracker/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl GlobalStateInner {
260260
kind: MemoryKind,
261261
machine: &MiriMachine<'_>,
262262
) -> AllocState {
263-
let _span = enter_trace_span!(borrow_tracker::new_allocation, ?id, ?alloc_size, ?kind);
263+
let _trace = enter_trace_span!(borrow_tracker::new_allocation, ?id, ?alloc_size, ?kind);
264264
match self.borrow_tracker_method {
265265
BorrowTrackerMethod::StackedBorrows =>
266266
AllocState::StackedBorrows(Box::new(RefCell::new(Stacks::new_allocation(
@@ -281,7 +281,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
281281
kind: RetagKind,
282282
val: &ImmTy<'tcx>,
283283
) -> InterpResult<'tcx, ImmTy<'tcx>> {
284-
let _span = enter_trace_span!(borrow_tracker::retag_ptr_value, ?kind, ?val.layout);
284+
let _trace = enter_trace_span!(borrow_tracker::retag_ptr_value, ?kind, ?val.layout);
285285
let this = self.eval_context_mut();
286286
let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method;
287287
match method {
@@ -295,7 +295,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
295295
kind: RetagKind,
296296
place: &PlaceTy<'tcx>,
297297
) -> InterpResult<'tcx> {
298-
let _span = enter_trace_span!(borrow_tracker::retag_place_contents, ?kind, ?place);
298+
let _trace = enter_trace_span!(borrow_tracker::retag_place_contents, ?kind, ?place);
299299
let this = self.eval_context_mut();
300300
let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method;
301301
match method {
@@ -305,7 +305,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
305305
}
306306

307307
fn protect_place(&mut self, place: &MPlaceTy<'tcx>) -> InterpResult<'tcx, MPlaceTy<'tcx>> {
308-
let _span = enter_trace_span!(borrow_tracker::protect_place, ?place);
308+
let _trace = enter_trace_span!(borrow_tracker::protect_place, ?place);
309309
let this = self.eval_context_mut();
310310
let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method;
311311
match method {
@@ -315,7 +315,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
315315
}
316316

317317
fn expose_tag(&self, alloc_id: AllocId, tag: BorTag) -> InterpResult<'tcx> {
318-
let _span =
318+
let _trace =
319319
enter_trace_span!(borrow_tracker::expose_tag, alloc_id = alloc_id.0, tag = tag.0);
320320
let this = self.eval_context_ref();
321321
let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method;
@@ -360,7 +360,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
360360
&self,
361361
frame: &Frame<'tcx, Provenance, FrameExtra<'tcx>>,
362362
) -> InterpResult<'tcx> {
363-
let _span = enter_trace_span!(borrow_tracker::on_stack_pop);
363+
let _trace = enter_trace_span!(borrow_tracker::on_stack_pop);
364364
let this = self.eval_context_ref();
365365
let borrow_tracker = this.machine.borrow_tracker.as_ref().unwrap();
366366
// The body of this loop needs `borrow_tracker` immutably
@@ -438,7 +438,7 @@ impl AllocState {
438438
range: AllocRange,
439439
machine: &MiriMachine<'tcx>,
440440
) -> InterpResult<'tcx> {
441-
let _span = enter_trace_span!(borrow_tracker::before_memory_read, alloc_id = alloc_id.0);
441+
let _trace = enter_trace_span!(borrow_tracker::before_memory_read, alloc_id = alloc_id.0);
442442
match self {
443443
AllocState::StackedBorrows(sb) =>
444444
sb.borrow_mut().before_memory_read(alloc_id, prov_extra, range, machine),
@@ -460,7 +460,7 @@ impl AllocState {
460460
range: AllocRange,
461461
machine: &MiriMachine<'tcx>,
462462
) -> InterpResult<'tcx> {
463-
let _span = enter_trace_span!(borrow_tracker::before_memory_write, alloc_id = alloc_id.0);
463+
let _trace = enter_trace_span!(borrow_tracker::before_memory_write, alloc_id = alloc_id.0);
464464
match self {
465465
AllocState::StackedBorrows(sb) =>
466466
sb.get_mut().before_memory_write(alloc_id, prov_extra, range, machine),
@@ -482,7 +482,7 @@ impl AllocState {
482482
size: Size,
483483
machine: &MiriMachine<'tcx>,
484484
) -> InterpResult<'tcx> {
485-
let _span =
485+
let _trace =
486486
enter_trace_span!(borrow_tracker::before_memory_deallocation, alloc_id = alloc_id.0);
487487
match self {
488488
AllocState::StackedBorrows(sb) =>
@@ -493,7 +493,7 @@ impl AllocState {
493493
}
494494

495495
pub fn remove_unreachable_tags(&self, tags: &FxHashSet<BorTag>) {
496-
let _span = enter_trace_span!(borrow_tracker::remove_unreachable_tags);
496+
let _trace = enter_trace_span!(borrow_tracker::remove_unreachable_tags);
497497
match self {
498498
AllocState::StackedBorrows(sb) => sb.borrow_mut().remove_unreachable_tags(tags),
499499
AllocState::TreeBorrows(tb) => tb.borrow_mut().remove_unreachable_tags(tags),
@@ -508,7 +508,7 @@ impl AllocState {
508508
tag: BorTag,
509509
alloc_id: AllocId, // diagnostics
510510
) -> InterpResult<'tcx> {
511-
let _span = enter_trace_span!(
511+
let _trace = enter_trace_span!(
512512
borrow_tracker::release_protector,
513513
alloc_id = alloc_id.0,
514514
tag = tag.0
@@ -523,7 +523,7 @@ impl AllocState {
523523

524524
impl VisitProvenance for AllocState {
525525
fn visit_provenance(&self, visit: &mut VisitWith<'_>) {
526-
let _span = enter_trace_span!(borrow_tracker::visit_provenance);
526+
let _trace = enter_trace_span!(borrow_tracker::visit_provenance);
527527
match self {
528528
AllocState::StackedBorrows(sb) => sb.visit_provenance(visit),
529529
AllocState::TreeBorrows(tb) => tb.visit_provenance(visit),

src/diagnostics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ pub fn report_error<'tcx>(
282282
},
283283
TreeBorrowsUb { title: _, details, history } => {
284284
let mut helps = vec![
285-
note!("this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental")
285+
note!("this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental"),
286+
note!("see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information"),
286287
];
287288
for m in details {
288289
helps.push(note!("{m}"));

src/helpers.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ pub enum AccessKind {
3232
///
3333
/// A `None` namespace indicates we are looking for a module.
3434
fn try_resolve_did(tcx: TyCtxt<'_>, path: &[&str], namespace: Option<Namespace>) -> Option<DefId> {
35+
let _trace = enter_trace_span!("try_resolve_did", ?path);
36+
3537
/// Yield all children of the given item, that have the given name.
3638
fn find_children<'tcx: 'a, 'a>(
3739
tcx: TyCtxt<'tcx>,
@@ -133,7 +135,6 @@ pub fn iter_exported_symbols<'tcx>(
133135
let exported = tcx.def_kind(def_id).has_codegen_attrs() && {
134136
let codegen_attrs = tcx.codegen_fn_attrs(def_id);
135137
codegen_attrs.contains_extern_indicator()
136-
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
137138
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_COMPILER)
138139
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER)
139140
};

src/machine.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ use rand::rngs::StdRng;
1212
use rand::{Rng, SeedableRng};
1313
use rustc_abi::{Align, ExternAbi, Size};
1414
use rustc_apfloat::{Float, FloatConvert};
15-
use rustc_hir::attrs::InlineAttr;
1615
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1716
#[allow(unused)]
1817
use rustc_data_structures::static_assert_size;
18+
use rustc_hir::attrs::InlineAttr;
19+
use rustc_middle::middle::codegen_fn_attrs::TargetFeatureKind;
1920
use rustc_middle::mir;
2021
use rustc_middle::query::TyCtxtAt;
2122
use rustc_middle::ty::layout::{
@@ -280,16 +281,16 @@ impl interpret::Provenance for Provenance {
280281
Ok(())
281282
}
282283

283-
fn join(left: Option<Self>, right: Option<Self>) -> Option<Self> {
284+
fn join(left: Self, right: Self) -> Option<Self> {
284285
match (left, right) {
285286
// If both are the *same* concrete tag, that is the result.
286287
(
287-
Some(Provenance::Concrete { alloc_id: left_alloc, tag: left_tag }),
288-
Some(Provenance::Concrete { alloc_id: right_alloc, tag: right_tag }),
289-
) if left_alloc == right_alloc && left_tag == right_tag => left,
288+
Provenance::Concrete { alloc_id: left_alloc, tag: left_tag },
289+
Provenance::Concrete { alloc_id: right_alloc, tag: right_tag },
290+
) if left_alloc == right_alloc && left_tag == right_tag => Some(left),
290291
// If one side is a wildcard, the best possible outcome is that it is equal to the other
291292
// one, and we use that.
292-
(Some(Provenance::Wildcard), o) | (o, Some(Provenance::Wildcard)) => o,
293+
(Provenance::Wildcard, o) | (o, Provenance::Wildcard) => Some(o),
293294
// Otherwise, fall back to `None`.
294295
_ => None,
295296
}
@@ -1076,7 +1077,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
10761077
.target_features
10771078
.iter()
10781079
.filter(|&feature| {
1079-
!feature.implied && !ecx.tcx.sess.target_features.contains(&feature.name)
1080+
feature.kind != TargetFeatureKind::Implied && !ecx.tcx.sess.target_features.contains(&feature.name)
10801081
})
10811082
.fold(String::new(), |mut s, feature| {
10821083
if !s.is_empty() {
@@ -1111,6 +1112,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
11111112
) -> InterpResult<'tcx, Option<(&'tcx mir::Body<'tcx>, ty::Instance<'tcx>)>> {
11121113
// For foreign items, try to see if we can emulate them.
11131114
if ecx.tcx.is_foreign_item(instance.def_id()) {
1115+
let _trace = enter_trace_span!("emulate_foreign_item");
11141116
// An external function call that does not have a MIR body. We either find MIR elsewhere
11151117
// or emulate its effect.
11161118
// This will be Ok(None) if we're emulating the intrinsic entirely within Miri (no need
@@ -1123,6 +1125,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
11231125
}
11241126

11251127
// Otherwise, load the MIR.
1128+
let _trace = enter_trace_span!("load_mir");
11261129
interp_ok(Some((ecx.load_mir(instance.def, None)?, instance)))
11271130
}
11281131

@@ -1394,6 +1397,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
13941397
GlobalDataRaceHandler::Genmc(genmc_ctx) =>
13951398
genmc_ctx.memory_load(machine, ptr.addr(), range.size)?,
13961399
GlobalDataRaceHandler::Vclocks(_data_race) => {
1400+
let _trace = enter_trace_span!(data_race::before_memory_read);
13971401
let AllocDataRaceHandler::Vclocks(data_race, weak_memory) = &alloc_extra.data_race
13981402
else {
13991403
unreachable!();
@@ -1429,6 +1433,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
14291433
genmc_ctx.memory_store(machine, ptr.addr(), range.size)?;
14301434
}
14311435
GlobalDataRaceHandler::Vclocks(_global_state) => {
1436+
let _trace = enter_trace_span!(data_race::before_memory_write);
14321437
let AllocDataRaceHandler::Vclocks(data_race, weak_memory) =
14331438
&mut alloc_extra.data_race
14341439
else {
@@ -1465,6 +1470,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
14651470
GlobalDataRaceHandler::Genmc(genmc_ctx) =>
14661471
genmc_ctx.handle_dealloc(machine, ptr.addr(), size, align, kind)?,
14671472
GlobalDataRaceHandler::Vclocks(_global_state) => {
1473+
let _trace = enter_trace_span!(data_race::before_memory_deallocation);
14681474
let data_race = alloc_extra.data_race.as_vclocks_mut().unwrap();
14691475
data_race.write(
14701476
alloc_id,
@@ -1675,6 +1681,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
16751681
local: mir::Local,
16761682
) -> InterpResult<'tcx> {
16771683
if let Some(data_race) = &frame.extra.data_race {
1684+
let _trace = enter_trace_span!(data_race::after_local_read);
16781685
data_race.local_read(local, &ecx.machine);
16791686
}
16801687
interp_ok(())
@@ -1686,6 +1693,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
16861693
storage_live: bool,
16871694
) -> InterpResult<'tcx> {
16881695
if let Some(data_race) = &ecx.frame().extra.data_race {
1696+
let _trace = enter_trace_span!(data_race::after_local_write);
16891697
data_race.local_write(local, storage_live, &ecx.machine);
16901698
}
16911699
interp_ok(())
@@ -1708,6 +1716,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
17081716
if let Some(data_race) =
17091717
&machine.threads.active_thread_stack().last().unwrap().extra.data_race
17101718
{
1719+
let _trace = enter_trace_span!(data_race::after_local_moved_to_memory);
17111720
data_race.local_moved_to_memory(
17121721
local,
17131722
alloc_info.data_race.as_vclocks_mut().unwrap(),

src/operator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
5757
let ptr = left.to_scalar().to_pointer(this)?;
5858
// We do the actual operation with usize-typed scalars.
5959
let left = ImmTy::from_uint(ptr.addr().bytes(), this.machine.layouts.usize);
60-
let result = this.binary_op(bin_op, &left, &right)?;
60+
let result = this.binary_op(bin_op, &left, right)?;
6161
// Construct a new pointer with the provenance of `ptr` (the LHS).
6262
let result_ptr = Pointer::new(
6363
ptr.provenance,

src/shims/extern_static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'tcx> MiriMachine<'tcx> {
6262
}
6363
"android" => {
6464
Self::null_ptr_extern_statics(ecx, &["bsd_signal"])?;
65-
Self::weak_symbol_extern_statics(ecx, &["signal", "getrandom"])?;
65+
Self::weak_symbol_extern_statics(ecx, &["signal", "getrandom", "gettid"])?;
6666
}
6767
"windows" => {
6868
// "_tls_used"

0 commit comments

Comments
 (0)