Skip to content

Commit 8bfae59

Browse files
authored
Merge branch 'rust-lang:master' into patch-1
2 parents 6f68f81 + 33855f8 commit 8bfae59

File tree

1,484 files changed

+16174
-8650
lines changed

Some content is hidden

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

1,484 files changed

+16174
-8650
lines changed

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
path = src/tools/rustc-perf
4848
url = https://github.com/rust-lang/rustc-perf.git
4949
shallow = true
50+
[submodule "src/tools/enzyme"]
51+
path = src/tools/enzyme
52+
url = https://github.com/EnzymeAD/Enzyme.git
53+
shallow = true

.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

+16-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",
@@ -4166,6 +4167,7 @@ dependencies = [
41664167
"rustc_errors",
41674168
"rustc_feature",
41684169
"rustc_fluent_macro",
4170+
"rustc_index",
41694171
"rustc_lexer",
41704172
"rustc_macros",
41714173
"rustc_session",
@@ -4431,7 +4433,7 @@ name = "rustc_target"
44314433
version = "0.0.0"
44324434
dependencies = [
44334435
"bitflags 2.6.0",
4434-
"object 0.36.3",
4436+
"object 0.36.4",
44354437
"rustc_abi",
44364438
"rustc_data_structures",
44374439
"rustc_feature",
@@ -5849,7 +5851,7 @@ dependencies = [
58495851
"lexopt",
58505852
"tempfile",
58515853
"wasi-preview1-component-adapter-provider",
5852-
"wasmparser 0.216.0",
5854+
"wasmparser",
58535855
"wat",
58545856
"wit-component",
58555857
"wit-parser",
@@ -5869,7 +5871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
58695871
checksum = "04c23aebea22c8a75833ae08ed31ccc020835b12a41999e58c31464271b94a88"
58705872
dependencies = [
58715873
"leb128",
5872-
"wasmparser 0.216.0",
5874+
"wasmparser",
58735875
]
58745876

58755877
[[package]]
@@ -5885,16 +5887,7 @@ dependencies = [
58855887
"serde_json",
58865888
"spdx",
58875889
"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",
5890+
"wasmparser",
58985891
]
58995892

59005893
[[package]]
@@ -6228,7 +6221,7 @@ dependencies = [
62286221
"serde_json",
62296222
"wasm-encoder",
62306223
"wasm-metadata",
6231-
"wasmparser 0.216.0",
6224+
"wasmparser",
62326225
"wit-parser",
62336226
]
62346227

@@ -6247,7 +6240,7 @@ dependencies = [
62476240
"serde_derive",
62486241
"serde_json",
62496242
"unicode-xid",
6250-
"wasmparser 0.216.0",
6243+
"wasmparser",
62516244
]
62526245

62536246
[[package]]

RELEASES.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ Compiler
3434
- [Add Tier 3 `std` Xtensa targets:](https://github.com/rust-lang/rust/pull/126380/) `xtensa-esp32-espidf`, `xtensa-esp32s2-espidf`, `xtensa-esp32s3-espidf`
3535
- [Add Tier 3 i686 Redox OS target:](https://github.com/rust-lang/rust/pull/126192/) `i686-unknown-redox`
3636
- [Promote `arm64ec-pc-windows-msvc` to Tier 2.](https://github.com/rust-lang/rust/pull/126039/)
37-
- [Promote `wasm32-wasip2` to Tier 2.](https://github.com/rust-lang/rust/pull/126967/)
3837
- [Promote `loongarch64-unknown-linux-musl` to Tier 2 with host tools.](https://github.com/rust-lang/rust/pull/126298/)
3938
- [Enable full tools and profiler for LoongArch Linux targets.](https://github.com/rust-lang/rust/pull/127078/)
4039
- [Unconditionally warn on usage of `wasm32-wasi`.](https://github.com/rust-lang/rust/pull/126662/) (see compatibility note below)
@@ -100,6 +99,9 @@ Compatibility Notes
10099
The reason is that these types have different roles: `std::panic::PanicHookInfo` is the argument to the [panic hook](https://doc.rust-lang.org/stable/std/panic/fn.set_hook.html) in std context (where panics can have an arbitrary payload), while `core::panic::PanicInfo` is the argument to the [`#[panic_handler]`](https://doc.rust-lang.org/nomicon/panic-handler.html) in no_std context (where panics always carry a formatted *message*). Separating these types allows us to add more useful methods to these types, such as `std::panic::PanicHookInfo::payload_as_str()` and `core::panic::PanicInfo::message()`.
101100

102101
* The new sort implementations may panic if a type's implementation of [`Ord`](https://doc.rust-lang.org/std/cmp/trait.Ord.html) (or the given comparison function) does not implement a [total order](https://en.wikipedia.org/wiki/Total_order) as the trait requires. `Ord`'s supertraits (`PartialOrd`, `Eq`, and `PartialEq`) must also be consistent. The previous implementations would not "notice" any problem, but the new implementations have a good chance of detecting inconsistencies, throwing a panic rather than returning knowingly unsorted data.
102+
* [In very rare cases, a change in the internal evaluation order of the trait
103+
solver may result in new fatal overflow errors.](https://github.com/rust-lang/rust/pull/126128)
104+
103105

104106
<a id="1.81.0-Internal-Changes"></a>
105107

@@ -112,6 +114,14 @@ tools.
112114

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

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

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/src/mut_visit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ fn visit_lazy_tts<T: MutVisitor>(vis: &mut T, lazy_tts: &mut Option<LazyAttrToke
752752
pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
753753
let Token { kind, span } = t;
754754
match kind {
755-
token::Ident(name, _ /*raw*/) | token::Lifetime(name) => {
755+
token::Ident(name, _is_raw) | token::Lifetime(name, _is_raw) => {
756756
let mut ident = Ident::new(*name, *span);
757757
vis.visit_ident(&mut ident);
758758
*name = ident.name;
@@ -762,7 +762,7 @@ pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
762762
token::NtIdent(ident, _is_raw) => {
763763
vis.visit_ident(ident);
764764
}
765-
token::NtLifetime(ident) => {
765+
token::NtLifetime(ident, _is_raw) => {
766766
vis.visit_ident(ident);
767767
}
768768
token::Interpolated(nt) => {

compiler/rustc_ast/src/token.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ pub enum TokenKind {
331331
/// Do not forget about `NtLifetime` when you want to match on lifetime identifiers.
332332
/// It's recommended to use `Token::(lifetime,uninterpolate,uninterpolated_span)` to
333333
/// treat regular and interpolated lifetime identifiers in the same way.
334-
Lifetime(Symbol),
334+
Lifetime(Symbol, IdentIsRaw),
335335
/// This identifier (and its span) is the lifetime passed to the
336336
/// declarative macro. The span in the surrounding `Token` is the span of
337337
/// the `lifetime` metavariable in the macro's RHS.
338-
NtLifetime(Ident),
338+
NtLifetime(Ident, IdentIsRaw),
339339

340340
/// An embedded AST node, as produced by a macro. This only exists for
341341
/// historical reasons. We'd like to get rid of it, for multiple reasons.
@@ -458,7 +458,7 @@ impl Token {
458458
/// if they keep spans or perform edition checks.
459459
pub fn uninterpolated_span(&self) -> Span {
460460
match self.kind {
461-
NtIdent(ident, _) | NtLifetime(ident) => ident.span,
461+
NtIdent(ident, _) | NtLifetime(ident, _) => ident.span,
462462
Interpolated(ref nt) => nt.use_span(),
463463
_ => self.span,
464464
}
@@ -661,7 +661,9 @@ impl Token {
661661
pub fn uninterpolate(&self) -> Cow<'_, Token> {
662662
match self.kind {
663663
NtIdent(ident, is_raw) => Cow::Owned(Token::new(Ident(ident.name, is_raw), ident.span)),
664-
NtLifetime(ident) => Cow::Owned(Token::new(Lifetime(ident.name), ident.span)),
664+
NtLifetime(ident, is_raw) => {
665+
Cow::Owned(Token::new(Lifetime(ident.name, is_raw), ident.span))
666+
}
665667
_ => Cow::Borrowed(self),
666668
}
667669
}
@@ -679,11 +681,11 @@ impl Token {
679681

680682
/// Returns a lifetime identifier if this token is a lifetime.
681683
#[inline]
682-
pub fn lifetime(&self) -> Option<Ident> {
684+
pub fn lifetime(&self) -> Option<(Ident, IdentIsRaw)> {
683685
// We avoid using `Token::uninterpolate` here because it's slow.
684686
match self.kind {
685-
Lifetime(name) => Some(Ident::new(name, self.span)),
686-
NtLifetime(ident) => Some(ident),
687+
Lifetime(name, is_raw) => Some((Ident::new(name, self.span), is_raw)),
688+
NtLifetime(ident, is_raw) => Some((ident, is_raw)),
687689
_ => None,
688690
}
689691
}
@@ -865,7 +867,7 @@ impl Token {
865867
_ => return None,
866868
},
867869
SingleQuote => match joint.kind {
868-
Ident(name, IdentIsRaw::No) => Lifetime(Symbol::intern(&format!("'{name}"))),
870+
Ident(name, is_raw) => Lifetime(Symbol::intern(&format!("'{name}")), is_raw),
869871
_ => return None,
870872
},
871873

compiler/rustc_ast/src/tokenstream.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,11 @@ impl TokenStream {
482482
token::NtIdent(ident, is_raw) => {
483483
TokenTree::Token(Token::new(token::Ident(ident.name, is_raw), ident.span), spacing)
484484
}
485-
token::NtLifetime(ident) => TokenTree::Delimited(
485+
token::NtLifetime(ident, is_raw) => TokenTree::Delimited(
486486
DelimSpan::from_single(token.span),
487487
DelimSpacing::new(Spacing::JointHidden, spacing),
488488
Delimiter::Invisible,
489-
TokenStream::token_alone(token::Lifetime(ident.name), ident.span),
489+
TokenStream::token_alone(token::Lifetime(ident.name, is_raw), ident.span),
490490
),
491491
token::Interpolated(ref nt) => TokenTree::Delimited(
492492
DelimSpan::from_single(token.span),

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),

0 commit comments

Comments
 (0)