Skip to content

Commit 0903724

Browse files
committed
Auto merge of #3862 - rust-lang:rustup-2024-09-06, r=RalfJung
Automatic Rustup
2 parents 18d358c + 2fccb4b commit 0903724

File tree

740 files changed

+5686
-2557
lines changed

Some content is hidden

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

740 files changed

+5686
-2557
lines changed

.mailmap

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ boolean_coercion <[email protected]>
8181
8282
bors <[email protected]> bors[bot] <26634292+bors[bot]@users.noreply.github.com>
8383
bors <[email protected]> bors[bot] <bors[bot]@users.noreply.github.com>
84+
8485
Braden Nelson <[email protected]>
8586
Brandon Sanderson <[email protected]> Brandon Sanderson <[email protected]>
8687
Brett Cannon <[email protected]> Brett Cannon <[email protected]>
@@ -146,6 +147,7 @@ David Klein <[email protected]>
146147
147148
David Ross <[email protected]>
148149
150+
149151
150152
151153
dependabot[bot] <dependabot[bot]@users.noreply.github.com> <27856297+dependabot-preview[bot]@users.noreply.github.com>

Cargo.lock

+15-23
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ version = "0.4.2"
199199
source = "registry+https://github.com/rust-lang/crates.io-index"
200200
checksum = "01667f6f40216b9a0b2945e05fed5f1ad0ab6470e69cb9378001e37b1c0668e4"
201201
dependencies = [
202-
"object 0.36.3",
202+
"object 0.36.4",
203203
]
204204

205205
[[package]]
@@ -2453,17 +2453,17 @@ dependencies = [
24532453

24542454
[[package]]
24552455
name = "object"
2456-
version = "0.36.3"
2456+
version = "0.36.4"
24572457
source = "registry+https://github.com/rust-lang/crates.io-index"
2458-
checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9"
2458+
checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a"
24592459
dependencies = [
24602460
"crc32fast",
24612461
"flate2",
24622462
"hashbrown",
24632463
"indexmap",
24642464
"memchr",
24652465
"ruzstd 0.7.0",
2466-
"wasmparser 0.215.0",
2466+
"wasmparser",
24672467
]
24682468

24692469
[[package]]
@@ -3129,11 +3129,11 @@ dependencies = [
31293129
"build_helper",
31303130
"gimli 0.31.0",
31313131
"libc",
3132-
"object 0.36.3",
3132+
"object 0.36.4",
31333133
"regex",
31343134
"serde_json",
31353135
"similar",
3136-
"wasmparser 0.216.0",
3136+
"wasmparser",
31373137
]
31383138

31393139
[[package]]
@@ -3408,7 +3408,7 @@ dependencies = [
34083408
"itertools",
34093409
"libc",
34103410
"measureme",
3411-
"object 0.36.3",
3411+
"object 0.36.4",
34123412
"rustc-demangle",
34133413
"rustc_ast",
34143414
"rustc_attr",
@@ -3447,7 +3447,7 @@ dependencies = [
34473447
"itertools",
34483448
"jobserver",
34493449
"libc",
3450-
"object 0.36.3",
3450+
"object 0.36.4",
34513451
"pathdiff",
34523452
"regex",
34533453
"rustc_arena",
@@ -3569,6 +3569,7 @@ dependencies = [
35693569
"rustc_hir_pretty",
35703570
"rustc_hir_typeck",
35713571
"rustc_incremental",
3572+
"rustc_index",
35723573
"rustc_infer",
35733574
"rustc_interface",
35743575
"rustc_lint",
@@ -4431,7 +4432,7 @@ name = "rustc_target"
44314432
version = "0.0.0"
44324433
dependencies = [
44334434
"bitflags 2.6.0",
4434-
"object 0.36.3",
4435+
"object 0.36.4",
44354436
"rustc_abi",
44364437
"rustc_data_structures",
44374438
"rustc_feature",
@@ -5849,7 +5850,7 @@ dependencies = [
58495850
"lexopt",
58505851
"tempfile",
58515852
"wasi-preview1-component-adapter-provider",
5852-
"wasmparser 0.216.0",
5853+
"wasmparser",
58535854
"wat",
58545855
"wit-component",
58555856
"wit-parser",
@@ -5869,7 +5870,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
58695870
checksum = "04c23aebea22c8a75833ae08ed31ccc020835b12a41999e58c31464271b94a88"
58705871
dependencies = [
58715872
"leb128",
5872-
"wasmparser 0.216.0",
5873+
"wasmparser",
58735874
]
58745875

58755876
[[package]]
@@ -5885,16 +5886,7 @@ dependencies = [
58855886
"serde_json",
58865887
"spdx",
58875888
"wasm-encoder",
5888-
"wasmparser 0.216.0",
5889-
]
5890-
5891-
[[package]]
5892-
name = "wasmparser"
5893-
version = "0.215.0"
5894-
source = "registry+https://github.com/rust-lang/crates.io-index"
5895-
checksum = "53fbde0881f24199b81cf49b6ff8f9c145ac8eb1b7fc439adb5c099734f7d90e"
5896-
dependencies = [
5897-
"bitflags 2.6.0",
5889+
"wasmparser",
58985890
]
58995891

59005892
[[package]]
@@ -6228,7 +6220,7 @@ dependencies = [
62286220
"serde_json",
62296221
"wasm-encoder",
62306222
"wasm-metadata",
6231-
"wasmparser 0.216.0",
6223+
"wasmparser",
62326224
"wit-parser",
62336225
]
62346226

@@ -6247,7 +6239,7 @@ dependencies = [
62476239
"serde_derive",
62486240
"serde_json",
62496241
"unicode-xid",
6250-
"wasmparser 0.216.0",
6242+
"wasmparser",
62516243
]
62526244

62536245
[[package]]

RELEASES.md

+8
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ tools.
112112

113113
- [Add a Rust-for Linux `auto` CI job to check kernel builds.](https://github.com/rust-lang/rust/pull/125209/)
114114

115+
Version 1.80.1 (2024-08-08)
116+
===========================
117+
118+
<a id="1.80.1"></a>
119+
120+
- [Fix miscompilation in the jump threading MIR optimization when comparing floats](https://github.com/rust-lang/rust/pull/128271)
121+
- [Revert changes to the `dead_code` lint from 1.80.0](https://github.com/rust-lang/rust/pull/128618)
122+
115123
Version 1.80.0 (2024-07-25)
116124
==========================
117125

compiler/rustc/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ features = ['unprefixed_malloc_on_supported_platforms']
3030
jemalloc = ['dep:jemalloc-sys']
3131
llvm = ['rustc_driver_impl/llvm']
3232
max_level_info = ['rustc_driver_impl/max_level_info']
33+
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
3334
rustc_use_parallel_compiler = ['rustc_driver_impl/rustc_use_parallel_compiler']
3435
# tidy-alphabetical-end

compiler/rustc_abi/src/layout.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -968,8 +968,8 @@ fn univariant<
968968
let mut align = if pack.is_some() { dl.i8_align } else { dl.aggregate_align };
969969
let mut max_repr_align = repr.align;
970970
let mut inverse_memory_index: IndexVec<u32, FieldIdx> = fields.indices().collect();
971-
let optimize = !repr.inhibit_struct_field_reordering();
972-
if optimize && fields.len() > 1 {
971+
let optimize_field_order = !repr.inhibit_struct_field_reordering();
972+
if optimize_field_order && fields.len() > 1 {
973973
let end = if let StructKind::MaybeUnsized = kind { fields.len() - 1 } else { fields.len() };
974974
let optimizing = &mut inverse_memory_index.raw[..end];
975975
let fields_excluding_tail = &fields.raw[..end];
@@ -1176,7 +1176,7 @@ fn univariant<
11761176
// If field 5 has offset 0, offsets[0] is 5, and memory_index[5] should be 0.
11771177
// Field 5 would be the first element, so memory_index is i:
11781178
// Note: if we didn't optimize, it's already right.
1179-
let memory_index = if optimize {
1179+
let memory_index = if optimize_field_order {
11801180
inverse_memory_index.invert_bijective_mapping()
11811181
} else {
11821182
debug_assert!(inverse_memory_index.iter().copied().eq(fields.indices()));
@@ -1189,6 +1189,9 @@ fn univariant<
11891189
}
11901190
let mut layout_of_single_non_zst_field = None;
11911191
let mut abi = Abi::Aggregate { sized };
1192+
1193+
let optimize_abi = !repr.inhibit_newtype_abi_optimization();
1194+
11921195
// Try to make this a Scalar/ScalarPair.
11931196
if sized && size.bytes() > 0 {
11941197
// We skip *all* ZST here and later check if we are good in terms of alignment.
@@ -1205,7 +1208,7 @@ fn univariant<
12051208
match field.abi {
12061209
// For plain scalars, or vectors of them, we can't unpack
12071210
// newtypes for `#[repr(C)]`, as that affects C ABIs.
1208-
Abi::Scalar(_) | Abi::Vector { .. } if optimize => {
1211+
Abi::Scalar(_) | Abi::Vector { .. } if optimize_abi => {
12091212
abi = field.abi;
12101213
}
12111214
// But scalar pairs are Rust-specific and get

compiler/rustc_abi/src/lib.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,17 @@ bitflags! {
4343
const IS_SIMD = 1 << 1;
4444
const IS_TRANSPARENT = 1 << 2;
4545
// Internal only for now. If true, don't reorder fields.
46+
// On its own it does not prevent ABI optimizations.
4647
const IS_LINEAR = 1 << 3;
47-
// If true, the type's layout can be randomized using
48-
// the seed stored in `ReprOptions.field_shuffle_seed`
48+
// If true, the type's crate has opted into layout randomization.
49+
// Other flags can still inhibit reordering and thus randomization.
50+
// The seed stored in `ReprOptions.field_shuffle_seed`.
4951
const RANDOMIZE_LAYOUT = 1 << 4;
5052
// Any of these flags being set prevent field reordering optimisation.
51-
const IS_UNOPTIMISABLE = ReprFlags::IS_C.bits()
53+
const FIELD_ORDER_UNOPTIMIZABLE = ReprFlags::IS_C.bits()
5254
| ReprFlags::IS_SIMD.bits()
5355
| ReprFlags::IS_LINEAR.bits();
56+
const ABI_UNOPTIMIZABLE = ReprFlags::IS_C.bits() | ReprFlags::IS_SIMD.bits();
5457
}
5558
}
5659

@@ -139,10 +142,14 @@ impl ReprOptions {
139142
self.c() || self.int.is_some()
140143
}
141144

145+
pub fn inhibit_newtype_abi_optimization(&self) -> bool {
146+
self.flags.intersects(ReprFlags::ABI_UNOPTIMIZABLE)
147+
}
148+
142149
/// Returns `true` if this `#[repr()]` guarantees a fixed field order,
143150
/// e.g. `repr(C)` or `repr(<int>)`.
144151
pub fn inhibit_struct_field_reordering(&self) -> bool {
145-
self.flags.intersects(ReprFlags::IS_UNOPTIMISABLE) || self.int.is_some()
152+
self.flags.intersects(ReprFlags::FIELD_ORDER_UNOPTIMIZABLE) || self.int.is_some()
146153
}
147154

148155
/// Returns `true` if this type is valid for reordering and `-Z randomize-layout`

compiler/rustc_ast_lowering/src/delegation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
7272
fn has_self(&self, def_id: DefId, span: Span) -> bool {
7373
if let Some(local_sig_id) = def_id.as_local() {
7474
// The value may be missing due to recursive delegation.
75-
// Error will be emmited later during HIR ty lowering.
75+
// Error will be emitted later during HIR ty lowering.
7676
self.resolver.delegation_fn_sigs.get(&local_sig_id).map_or(false, |sig| sig.has_self)
7777
} else {
7878
match self.tcx.def_kind(def_id) {
@@ -139,7 +139,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
139139
fn param_count(&self, sig_id: DefId) -> (usize, bool /*c_variadic*/) {
140140
if let Some(local_sig_id) = sig_id.as_local() {
141141
// Map may be filled incorrectly due to recursive delegation.
142-
// Error will be emmited later during HIR ty lowering.
142+
// Error will be emitted later during HIR ty lowering.
143143
match self.resolver.delegation_fn_sigs.get(&local_sig_id) {
144144
Some(sig) => (sig.param_count, sig.c_variadic),
145145
None => (0, false),

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
11791179
for field in &variant.fields {
11801180
// In practice unless there are more than one field with the same type, we'll be
11811181
// suggesting a single field at a type, because we don't aggregate multiple borrow
1182-
// checker errors involving the functional record update sytnax into a single one.
1182+
// checker errors involving the functional record update syntax into a single one.
11831183
let field_ty = field.ty(self.infcx.tcx, args);
11841184
let ident = field.ident(self.infcx.tcx);
11851185
if field_ty == ty && fields.iter().all(|field| field.ident.name != ident.name) {

compiler/rustc_borrowck/src/type_check/liveness/trace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<'a, 'me, 'typeck, 'flow, 'tcx> LivenessResults<'a, 'me, 'typeck, 'flow, 'tc
218218
// This collect is more necessary than immediately apparent
219219
// because these facts go into `add_drop_live_facts_for()`,
220220
// which also writes to `all_facts`, and so this is genuinely
221-
// a simulatneous overlapping mutable borrow.
221+
// a simultaneous overlapping mutable borrow.
222222
// FIXME for future hackers: investigate whether this is
223223
// actually necessary; these facts come from Polonius
224224
// and probably maybe plausibly does not need to go back in.

compiler/rustc_codegen_llvm/src/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ impl<'ll> CodegenCx<'ll, '_> {
390390
let val_llty = self.val_ty(v);
391391

392392
let g = self.get_static_inner(def_id, val_llty);
393-
let llty = self.val_ty(g);
393+
let llty = llvm::LLVMGlobalGetValueType(g);
394394

395395
let g = if val_llty == llty {
396396
g

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ fn prepare_usage_sets<'tcx>(tcx: TyCtxt<'tcx>) -> UsageSets<'tcx> {
422422
(instance.def_id(), body)
423423
});
424424

425-
// Functions whose coverage statments were found inlined into other functions.
425+
// Functions whose coverage statements were found inlined into other functions.
426426
let mut used_via_inlining = FxHashSet::default();
427427
// Functions that were instrumented, but had all of their coverage statements
428428
// removed by later MIR transforms (e.g. UnreachablePropagation).

compiler/rustc_codegen_llvm/src/intrinsic.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
187187
Some(instance),
188188
)
189189
}
190-
sym::likely => {
191-
self.call_intrinsic("llvm.expect.i1", &[args[0].immediate(), self.const_bool(true)])
192-
}
190+
sym::likely => self.expect(args[0].immediate(), true),
193191
sym::is_val_statically_known => {
194192
let intrinsic_type = args[0].layout.immediate_llvm_type(self.cx);
195193
let kind = self.type_kind(intrinsic_type);
@@ -210,8 +208,7 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
210208
self.const_bool(false)
211209
}
212210
}
213-
sym::unlikely => self
214-
.call_intrinsic("llvm.expect.i1", &[args[0].immediate(), self.const_bool(false)]),
211+
sym::unlikely => self.expect(args[0].immediate(), false),
215212
sym::select_unpredictable => {
216213
let cond = args[0].immediate();
217214
assert_eq!(args[1].layout, args[2].layout);
@@ -604,11 +601,17 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
604601
}
605602

606603
fn assume(&mut self, val: Self::Value) {
607-
self.call_intrinsic("llvm.assume", &[val]);
604+
if self.cx.sess().opts.optimize != rustc_session::config::OptLevel::No {
605+
self.call_intrinsic("llvm.assume", &[val]);
606+
}
608607
}
609608

610609
fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value {
611-
self.call_intrinsic("llvm.expect.i1", &[cond, self.const_bool(expected)])
610+
if self.cx.sess().opts.optimize != rustc_session::config::OptLevel::No {
611+
self.call_intrinsic("llvm.expect.i1", &[cond, self.const_bool(expected)])
612+
} else {
613+
cond
614+
}
612615
}
613616

614617
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Value) -> Self::Value {

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,7 @@ unsafe extern "C" {
974974
pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
975975
pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
976976
pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
977+
pub fn LLVMGlobalGetValueType(Global: &Value) -> &Type;
977978

978979
// Operations on global variables
979980
pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ fn push_const_param<'tcx>(tcx: TyCtxt<'tcx>, ct: ty::Const<'tcx>, output: &mut S
701701
match ty.kind() {
702702
ty::Int(ity) => {
703703
// FIXME: directly extract the bits from a valtree instead of evaluating an
704-
// alreay evaluated `Const` in order to get the bits.
704+
// already evaluated `Const` in order to get the bits.
705705
let bits = ct.eval_bits(tcx, ty::ParamEnv::reveal_all());
706706
let val = Integer::from_int_ty(&tcx, *ity).size().sign_extend(bits) as i128;
707707
write!(output, "{val}")

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
382382
scalar: abi::Scalar,
383383
backend_ty: Bx::Type,
384384
) {
385-
if matches!(self.cx.sess().opts.optimize, OptLevel::No | OptLevel::Less)
385+
if matches!(self.cx.sess().opts.optimize, OptLevel::No)
386386
// For now, the critical niches are all over `Int`eger values.
387387
// Should floating-point values or pointers ever get more complex
388388
// niches, then this code will probably want to handle them too.

compiler/rustc_codegen_ssa/src/mir/statement.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use rustc_middle::mir::{self, NonDivergingIntrinsic};
22
use rustc_middle::span_bug;
3-
use rustc_session::config::OptLevel;
43
use tracing::instrument;
54

65
use super::{FunctionCx, LocalRef};
@@ -68,10 +67,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
6867
self.codegen_coverage(bx, kind, statement.source_info.scope);
6968
}
7069
mir::StatementKind::Intrinsic(box NonDivergingIntrinsic::Assume(ref op)) => {
71-
if !matches!(bx.tcx().sess.opts.optimize, OptLevel::No | OptLevel::Less) {
72-
let op_val = self.codegen_operand(bx, op);
73-
bx.assume(op_val.immediate());
74-
}
70+
let op_val = self.codegen_operand(bx, op);
71+
bx.assume(op_val.immediate());
7572
}
7673
mir::StatementKind::Intrinsic(box NonDivergingIntrinsic::CopyNonOverlapping(
7774
mir::CopyNonOverlapping { ref count, ref src, ref dst },

0 commit comments

Comments
 (0)