Skip to content

Commit f856ddd

Browse files
committed
Auto merge of #3303 - rust-lang:rustup-2024-02-17, r=saethlin
Automatic Rustup
2 parents 454f054 + f9c8ad5 commit f856ddd

File tree

10 files changed

+22
-22
lines changed

10 files changed

+22
-22
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0f806a9812b62c36bdab08d33c14cf2d3ecf4355
1+
4316d0c6252cb1f833e582dfa68adb98efd5ddfb

src/bin/miri.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(generic_nonzero)]
12
#![feature(rustc_private, stmt_expr_attributes)]
23
#![allow(
34
clippy::manual_range_contains,
@@ -19,7 +20,7 @@ extern crate rustc_session;
1920
extern crate tracing;
2021

2122
use std::env::{self, VarError};
22-
use std::num::NonZeroU64;
23+
use std::num::NonZero;
2324
use std::path::PathBuf;
2425
use std::str::FromStr;
2526

@@ -524,7 +525,7 @@ fn main() {
524525
}
525526
}
526527
} else if let Some(param) = arg.strip_prefix("-Zmiri-track-alloc-id=") {
527-
let ids: Vec<miri::AllocId> = match parse_comma_list::<NonZeroU64>(param) {
528+
let ids: Vec<miri::AllocId> = match parse_comma_list::<NonZero<u64>>(param) {
528529
Ok(ids) => ids.into_iter().map(miri::AllocId).collect(),
529530
Err(err) =>
530531
show_error!(

src/borrow_tracker/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::cell::RefCell;
22
use std::fmt;
3-
use std::num::NonZeroU64;
3+
use std::num::NonZero;
44

55
use smallvec::SmallVec;
66

@@ -12,22 +12,22 @@ use crate::*;
1212
pub mod stacked_borrows;
1313
pub mod tree_borrows;
1414

15-
pub type CallId = NonZeroU64;
15+
pub type CallId = NonZero<u64>;
1616

1717
/// Tracking pointer provenance
1818
#[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
19-
pub struct BorTag(NonZeroU64);
19+
pub struct BorTag(NonZero<u64>);
2020

2121
impl BorTag {
2222
pub fn new(i: u64) -> Option<Self> {
23-
NonZeroU64::new(i).map(BorTag)
23+
NonZero::new(i).map(BorTag)
2424
}
2525

2626
pub fn get(&self) -> u64 {
2727
self.0.get()
2828
}
2929

30-
pub fn inner(&self) -> NonZeroU64 {
30+
pub fn inner(&self) -> NonZero<u64> {
3131
self.0
3232
}
3333

@@ -183,7 +183,7 @@ impl GlobalStateInner {
183183
borrow_tracker_method,
184184
next_ptr_tag: BorTag::one(),
185185
base_ptr_tags: FxHashMap::default(),
186-
next_call_id: NonZeroU64::new(1).unwrap(),
186+
next_call_id: NonZero::new(1).unwrap(),
187187
protected_tags: FxHashMap::default(),
188188
tracked_pointer_tags,
189189
tracked_call_ids,
@@ -205,7 +205,7 @@ impl GlobalStateInner {
205205
if self.tracked_call_ids.contains(&call_id) {
206206
machine.emit_diagnostic(NonHaltingDiagnostic::CreatedCallId(call_id));
207207
}
208-
self.next_call_id = NonZeroU64::new(call_id.get() + 1).unwrap();
208+
self.next_call_id = NonZero::new(call_id.get() + 1).unwrap();
209209
FrameState { call_id, protected_tags: SmallVec::new() }
210210
}
211211

src/concurrency/init_once.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::collections::VecDeque;
2-
use std::num::NonZeroU32;
32

43
use rustc_index::Idx;
54
use rustc_middle::ty::layout::TyAndLayout;

src/concurrency/sync.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::collections::{hash_map::Entry, VecDeque};
2-
use std::num::NonZeroU32;
32
use std::ops::Not;
43

54
use rustc_data_structures::fx::FxHashMap;
@@ -24,12 +23,12 @@ macro_rules! declare_id {
2423
/// 0 is used to indicate that the id was not yet assigned and,
2524
/// therefore, is not a valid identifier.
2625
#[derive(Clone, Copy, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]
27-
pub struct $name(NonZeroU32);
26+
pub struct $name(std::num::NonZero<u32>);
2827

2928
impl SyncId for $name {
3029
// Panics if `id == 0`.
3130
fn from_u32(id: u32) -> Self {
32-
Self(NonZeroU32::new(id).unwrap())
31+
Self(std::num::NonZero::new(id).unwrap())
3332
}
3433
fn to_u32(&self) -> u32 {
3534
self.0.get()
@@ -42,11 +41,11 @@ macro_rules! declare_id {
4241
// therefore, need to shift by one when converting from an index
4342
// into a vector.
4443
let shifted_idx = u32::try_from(idx).unwrap().checked_add(1).unwrap();
45-
$name(NonZeroU32::new(shifted_idx).unwrap())
44+
$name(std::num::NonZero::new(shifted_idx).unwrap())
4645
}
4746
fn index(self) -> usize {
4847
// See the comment in `Self::new`.
49-
// (This cannot underflow because self is NonZeroU32.)
48+
// (This cannot underflow because `self.0` is `NonZero<u32>`.)
5049
usize::try_from(self.0.get() - 1).unwrap()
5150
}
5251
}

src/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::fmt::{self, Write};
2-
use std::num::NonZeroU64;
2+
use std::num::NonZero;
33

44
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage, Level};
55
use rustc_span::{SpanData, Symbol, DUMMY_SP};
@@ -110,7 +110,7 @@ pub enum NonHaltingDiagnostic {
110110
/// (new_tag, new_perm, (alloc_id, base_offset, orig_tag))
111111
///
112112
/// new_perm is `None` for base tags.
113-
CreatedPointerTag(NonZeroU64, Option<String>, Option<(AllocId, AllocRange, ProvenanceExtra)>),
113+
CreatedPointerTag(NonZero<u64>, Option<String>, Option<(AllocId, AllocRange, ProvenanceExtra)>),
114114
/// This `Item` was popped from the borrow stack. The string explains the reason.
115115
PoppedPointerTag(Item, String),
116116
CreatedCallId(CallId),

src/helpers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::cmp;
22
use std::iter;
3-
use std::num::NonZeroUsize;
3+
use std::num::NonZero;
44
use std::time::Duration;
55

66
use rustc_apfloat::ieee::{Double, Single};
@@ -572,7 +572,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
572572
fn visit_union(
573573
&mut self,
574574
_v: &MPlaceTy<'tcx, Provenance>,
575-
_fields: NonZeroUsize,
575+
_fields: NonZero<usize>,
576576
) -> InterpResult<'tcx> {
577577
bug!("we should have already handled unions in `visit_value`")
578578
}

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![feature(rustc_private)]
22
#![feature(cell_update)]
33
#![feature(float_gamma)]
4+
#![feature(generic_nonzero)]
45
#![feature(map_try_insert)]
56
#![feature(never_type)]
67
#![feature(try_blocks)]

src/shims/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
475475
let [id, show_unnamed] = this.check_shim(abi, Abi::Rust, link_name, args)?;
476476
let id = this.read_scalar(id)?.to_u64()?;
477477
let show_unnamed = this.read_scalar(show_unnamed)?.to_bool()?;
478-
if let Some(id) = std::num::NonZeroU64::new(id) {
478+
if let Some(id) = std::num::NonZero::new(id) {
479479
this.print_borrow_state(AllocId(id), show_unnamed)?;
480480
}
481481
}

tests/pass/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() {
3737
let mut saw_false = false;
3838

3939
for _ in 0..50 {
40-
if unsafe { intrinsics::is_val_statically_known(0) } {
40+
if intrinsics::is_val_statically_known(0) {
4141
saw_true = true;
4242
} else {
4343
saw_false = true;

0 commit comments

Comments
 (0)