Skip to content

Commit e27da14

Browse files
committed
Auto merge of rust-lang#3207 - rust-lang:rustup-2023-12-04, r=RalfJung
Automatic Rustup
2 parents 487d999 + 8174045 commit e27da14

File tree

66 files changed

+876
-326
lines changed

Some content is hidden

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

66 files changed

+876
-326
lines changed

Cargo.lock

+55-34
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ dependencies = [
3737

3838
[[package]]
3939
name = "ahash"
40-
version = "0.8.3"
40+
version = "0.8.6"
4141
source = "registry+https://github.com/rust-lang/crates.io-index"
42-
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
42+
checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
4343
dependencies = [
4444
"cfg-if",
4545
"once_cell",
4646
"version_check",
47+
"zerocopy",
4748
]
4849

4950
[[package]]
@@ -222,7 +223,7 @@ dependencies = [
222223
"proc-macro2",
223224
"quote",
224225
"serde",
225-
"syn 2.0.29",
226+
"syn 2.0.32",
226227
]
227228

228229
[[package]]
@@ -525,7 +526,7 @@ dependencies = [
525526
"heck",
526527
"proc-macro2",
527528
"quote",
528-
"syn 2.0.29",
529+
"syn 2.0.32",
529530
]
530531

531532
[[package]]
@@ -552,7 +553,7 @@ dependencies = [
552553
"regex",
553554
"rustc_tools_util",
554555
"serde",
555-
"syn 2.0.29",
556+
"syn 2.0.32",
556557
"tempfile",
557558
"termize",
558559
"tester",
@@ -964,7 +965,7 @@ dependencies = [
964965
"proc-macro2",
965966
"quote",
966967
"strsim",
967-
"syn 2.0.29",
968+
"syn 2.0.32",
968969
]
969970

970971
[[package]]
@@ -986,7 +987,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
986987
dependencies = [
987988
"darling_core 0.20.3",
988989
"quote",
989-
"syn 2.0.29",
990+
"syn 2.0.32",
990991
]
991992

992993
[[package]]
@@ -1001,7 +1002,7 @@ version = "0.1.76"
10011002
dependencies = [
10021003
"itertools",
10031004
"quote",
1004-
"syn 2.0.29",
1005+
"syn 2.0.32",
10051006
]
10061007

10071008
[[package]]
@@ -1068,7 +1069,7 @@ dependencies = [
10681069
"darling 0.20.3",
10691070
"proc-macro2",
10701071
"quote",
1071-
"syn 2.0.29",
1072+
"syn 2.0.32",
10721073
]
10731074

10741075
[[package]]
@@ -1157,7 +1158,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
11571158
dependencies = [
11581159
"proc-macro2",
11591160
"quote",
1160-
"syn 2.0.29",
1161+
"syn 2.0.32",
11611162
]
11621163

11631164
[[package]]
@@ -1489,7 +1490,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
14891490
dependencies = [
14901491
"proc-macro2",
14911492
"quote",
1492-
"syn 2.0.29",
1493+
"syn 2.0.32",
14931494
]
14941495

14951496
[[package]]
@@ -1647,9 +1648,9 @@ dependencies = [
16471648

16481649
[[package]]
16491650
name = "hashbrown"
1650-
version = "0.14.2"
1651+
version = "0.14.3"
16511652
source = "registry+https://github.com/rust-lang/crates.io-index"
1652-
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
1653+
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
16531654
dependencies = [
16541655
"ahash",
16551656
"allocator-api2",
@@ -1912,7 +1913,7 @@ checksum = "2060258edfcfe32ca7058849bf0f146cb5c59aadbedf480333c0d0002f97bc99"
19121913
dependencies = [
19131914
"proc-macro2",
19141915
"quote",
1915-
"syn 2.0.29",
1916+
"syn 2.0.32",
19161917
]
19171918

19181919
[[package]]
@@ -2085,9 +2086,9 @@ dependencies = [
20852086

20862087
[[package]]
20872088
name = "jobserver"
2088-
version = "0.1.26"
2089+
version = "0.1.27"
20892090
source = "registry+https://github.com/rust-lang/crates.io-index"
2090-
checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2"
2091+
checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d"
20912092
dependencies = [
20922093
"libc",
20932094
]
@@ -2675,7 +2676,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
26752676
dependencies = [
26762677
"proc-macro2",
26772678
"quote",
2678-
"syn 2.0.29",
2679+
"syn 2.0.32",
26792680
]
26802681

26812682
[[package]]
@@ -2892,7 +2893,7 @@ dependencies = [
28922893
"pest_meta",
28932894
"proc-macro2",
28942895
"quote",
2895-
"syn 2.0.29",
2896+
"syn 2.0.32",
28962897
]
28972898

28982899
[[package]]
@@ -3868,7 +3869,7 @@ dependencies = [
38683869
"fluent-syntax",
38693870
"proc-macro2",
38703871
"quote",
3871-
"syn 2.0.29",
3872+
"syn 2.0.32",
38723873
"unic-langid",
38733874
]
38743875

@@ -3999,7 +4000,7 @@ version = "0.0.0"
39994000
dependencies = [
40004001
"proc-macro2",
40014002
"quote",
4002-
"syn 2.0.29",
4003+
"syn 2.0.32",
40034004
"synstructure",
40044005
]
40054006

@@ -4145,7 +4146,7 @@ version = "0.0.0"
41454146
dependencies = [
41464147
"proc-macro2",
41474148
"quote",
4148-
"syn 2.0.29",
4149+
"syn 2.0.32",
41494150
"synstructure",
41504151
]
41514152

@@ -4729,7 +4730,7 @@ dependencies = [
47294730
"proc-macro2",
47304731
"quote",
47314732
"serde",
4732-
"syn 2.0.29",
4733+
"syn 2.0.32",
47334734
]
47344735

47354736
[[package]]
@@ -4892,7 +4893,7 @@ checksum = "dc59dfdcbad1437773485e0367fea4b090a2e0a16d9ffc46af47764536a298ec"
48924893
dependencies = [
48934894
"proc-macro2",
48944895
"quote",
4895-
"syn 2.0.29",
4896+
"syn 2.0.32",
48964897
]
48974898

48984899
[[package]]
@@ -5183,9 +5184,9 @@ dependencies = [
51835184

51845185
[[package]]
51855186
name = "syn"
5186-
version = "2.0.29"
5187+
version = "2.0.32"
51875188
source = "registry+https://github.com/rust-lang/crates.io-index"
5188-
checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
5189+
checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2"
51895190
dependencies = [
51905191
"proc-macro2",
51915192
"quote",
@@ -5200,7 +5201,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06"
52005201
dependencies = [
52015202
"proc-macro2",
52025203
"quote",
5203-
"syn 2.0.29",
5204+
"syn 2.0.32",
52045205
"unicode-xid",
52055206
]
52065207

@@ -5379,7 +5380,7 @@ checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b"
53795380
dependencies = [
53805381
"proc-macro2",
53815382
"quote",
5382-
"syn 2.0.29",
5383+
"syn 2.0.32",
53835384
]
53845385

53855386
[[package]]
@@ -5600,7 +5601,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
56005601
dependencies = [
56015602
"proc-macro2",
56025603
"quote",
5603-
"syn 2.0.29",
5604+
"syn 2.0.32",
56045605
]
56055606

56065607
[[package]]
@@ -5994,7 +5995,7 @@ dependencies = [
59945995
"once_cell",
59955996
"proc-macro2",
59965997
"quote",
5997-
"syn 2.0.29",
5998+
"syn 2.0.32",
59985999
"wasm-bindgen-shared",
59996000
]
60006001

@@ -6028,7 +6029,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
60286029
dependencies = [
60296030
"proc-macro2",
60306031
"quote",
6031-
"syn 2.0.29",
6032+
"syn 2.0.32",
60326033
"wasm-bindgen-backend",
60336034
"wasm-bindgen-shared",
60346035
]
@@ -6097,7 +6098,7 @@ checksum = "970efb0b6849eb8a87a898f586af7cc167567b070014c7434514c0bde0ca341c"
60976098
dependencies = [
60986099
"proc-macro2",
60996100
"rayon",
6100-
"syn 2.0.29",
6101+
"syn 2.0.32",
61016102
"windows-metadata",
61026103
]
61036104

@@ -6339,10 +6340,30 @@ checksum = "d5e19fb6ed40002bab5403ffa37e53e0e56f914a4450c8765f533018db1db35f"
63396340
dependencies = [
63406341
"proc-macro2",
63416342
"quote",
6342-
"syn 2.0.29",
6343+
"syn 2.0.32",
63436344
"synstructure",
63446345
]
63456346

6347+
[[package]]
6348+
name = "zerocopy"
6349+
version = "0.7.28"
6350+
source = "registry+https://github.com/rust-lang/crates.io-index"
6351+
checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e"
6352+
dependencies = [
6353+
"zerocopy-derive",
6354+
]
6355+
6356+
[[package]]
6357+
name = "zerocopy-derive"
6358+
version = "0.7.28"
6359+
source = "registry+https://github.com/rust-lang/crates.io-index"
6360+
checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b"
6361+
dependencies = [
6362+
"proc-macro2",
6363+
"quote",
6364+
"syn 2.0.32",
6365+
]
6366+
63466367
[[package]]
63476368
name = "zerofrom"
63486369
version = "0.1.3"
@@ -6360,7 +6381,7 @@ checksum = "e6a647510471d372f2e6c2e6b7219e44d8c574d24fdc11c610a61455782f18c3"
63606381
dependencies = [
63616382
"proc-macro2",
63626383
"quote",
6363-
"syn 2.0.29",
6384+
"syn 2.0.32",
63646385
"synstructure",
63656386
]
63666387

@@ -6383,7 +6404,7 @@ checksum = "acabf549809064225ff8878baedc4ce3732ac3b07e7c7ce6e5c2ccdbc485c324"
63836404
dependencies = [
63846405
"proc-macro2",
63856406
"quote",
6386-
"syn 2.0.29",
6407+
"syn 2.0.32",
63876408
]
63886409

63896410
[[package]]

compiler/rustc_codegen_ssa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ar_archive_writer = "0.1.5"
99
bitflags = "1.2.1"
1010
cc = "1.0.69"
1111
itertools = "0.11"
12-
jobserver = "0.1.22"
12+
jobserver = "0.1.27"
1313
pathdiff = "0.2.0"
1414
regex = "1.4"
1515
rustc_arena = { path = "../rustc_arena" }

compiler/rustc_const_eval/src/interpret/machine.rs

+15-14
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ use rustc_middle::mir;
1212
use rustc_middle::ty::layout::TyAndLayout;
1313
use rustc_middle::ty::{self, TyCtxt};
1414
use rustc_span::def_id::DefId;
15-
use rustc_target::abi::Size;
15+
use rustc_target::abi::{Align, Size};
1616
use rustc_target::spec::abi::Abi as CallAbi;
1717

1818
use super::{
19-
AllocBytes, AllocId, AllocRange, Allocation, ConstAllocation, FnArg, Frame, ImmTy, InterpCx,
20-
InterpResult, MPlaceTy, MemoryKind, OpTy, PlaceTy, Pointer, Provenance,
19+
AllocBytes, AllocId, AllocKind, AllocRange, Allocation, ConstAllocation, FnArg, Frame, ImmTy,
20+
InterpCx, InterpResult, MPlaceTy, MemoryKind, Misalignment, OpTy, PlaceTy, Pointer, Provenance,
2121
};
2222

2323
/// Data returned by Machine::stack_pop,
@@ -143,11 +143,18 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
143143
/// Whether memory accesses should be alignment-checked.
144144
fn enforce_alignment(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool;
145145

146-
/// Whether, when checking alignment, we should look at the actual address and thus support
147-
/// custom alignment logic based on whatever the integer address happens to be.
148-
///
149-
/// If this returns true, Provenance::OFFSET_IS_ADDR must be true.
150-
fn use_addr_for_alignment_check(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool;
146+
/// Gives the machine a chance to detect more misalignment than the built-in checks would catch.
147+
#[inline(always)]
148+
fn alignment_check(
149+
_ecx: &InterpCx<'mir, 'tcx, Self>,
150+
_alloc_id: AllocId,
151+
_alloc_align: Align,
152+
_alloc_kind: AllocKind,
153+
_offset: Size,
154+
_align: Align,
155+
) -> Option<Misalignment> {
156+
None
157+
}
151158

152159
/// Whether to enforce the validity invariant for a specific layout.
153160
fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>, layout: TyAndLayout<'tcx>) -> bool;
@@ -519,12 +526,6 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
519526
type FrameExtra = ();
520527
type Bytes = Box<[u8]>;
521528

522-
#[inline(always)]
523-
fn use_addr_for_alignment_check(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
524-
// We do not support `use_addr`.
525-
false
526-
}
527-
528529
#[inline(always)]
529530
fn ignore_optional_overflow_checks(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
530531
false

compiler/rustc_const_eval/src/interpret/memory.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ impl<T: fmt::Display> fmt::Display for MemoryKind<T> {
5858
}
5959

6060
/// The return value of `get_alloc_info` indicates the "kind" of the allocation.
61+
#[derive(Copy, Clone, PartialEq, Debug)]
6162
pub enum AllocKind {
6263
/// A regular live data allocation.
6364
LiveData,
@@ -473,8 +474,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
473474
match self.ptr_try_get_alloc_id(ptr) {
474475
Err(addr) => offset_misalignment(addr, align),
475476
Ok((alloc_id, offset, _prov)) => {
476-
let (_size, alloc_align, _kind) = self.get_alloc_info(alloc_id);
477-
if M::use_addr_for_alignment_check(self) {
477+
let (_size, alloc_align, kind) = self.get_alloc_info(alloc_id);
478+
if let Some(misalign) =
479+
M::alignment_check(self, alloc_id, alloc_align, kind, offset, align)
480+
{
481+
Some(misalign)
482+
} else if M::Provenance::OFFSET_IS_ADDR {
478483
// `use_addr_for_alignment_check` can only be true if `OFFSET_IS_ADDR` is true.
479484
offset_misalignment(ptr.addr().bytes(), align)
480485
} else {

0 commit comments

Comments
 (0)