Skip to content

Commit ca51c1e

Browse files
committed
Auto merge of rust-lang#18364 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2 parents fa815a1 + efc2ba2 commit ca51c1e

File tree

741 files changed

+11340
-7363
lines changed

Some content is hidden

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

741 files changed

+11340
-7363
lines changed

.github/workflows/ci.yml

+17
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ jobs:
104104
with:
105105
fetch-depth: 2
106106

107+
# Free up disk space on Linux by removing preinstalled components that
108+
# we do not need. We do this to enable some of the less resource
109+
# intensive jobs to run on free runners, which however also have
110+
# less disk space.
111+
- name: free up disk space
112+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
113+
if: contains(matrix.os, 'ubuntu')
114+
with:
115+
# Removing packages with APT saves ~5 GiB, but takes several
116+
# minutes (and potentially removes important packages).
117+
large-packages: false
118+
107119
# Rust Log Analyzer can't currently detect the PR number of a GitHub
108120
# Actions build on its own, so a hint in the log message is needed to
109121
# point it in the right direction.
@@ -194,6 +206,11 @@ jobs:
194206
- name: create github artifacts
195207
run: src/ci/scripts/create-doc-artifacts.sh
196208

209+
- name: print disk usage
210+
run: |
211+
echo "disk usage:"
212+
df -h
213+
197214
- name: upload artifacts to github
198215
uses: actions/upload-artifact@v4
199216
with:

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ build/
5757
/src/tools/x/target
5858
# Created by default with `src/ci/docker/run.sh`
5959
/obj/
60+
# Created by nix dev shell / .envrc
61+
src/tools/nix-dev-shell/flake.lock
6062

6163
## ICE reports
6264
rustc-ice-*.txt

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ Jakub Adam Wieczorek <[email protected]>
256256
Jakub Adam Wieczorek <[email protected]> <[email protected]>
257257
Jakub Adam Wieczorek <[email protected]> <[email protected]>
258258
Jakub Adam Wieczorek <[email protected]> <[email protected]>
259+
259260
James [Undefined] <[email protected]>
260261
261262

Cargo.lock

+24-47
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ dependencies = [
377377
"cargo_metadata",
378378
"directories",
379379
"rustc-build-sysroot",
380-
"rustc_tools_util 0.4.0",
380+
"rustc_tools_util",
381381
"rustc_version",
382382
"serde",
383383
"serde_json",
@@ -537,7 +537,7 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
537537

538538
[[package]]
539539
name = "clippy"
540-
version = "0.1.83"
540+
version = "0.1.84"
541541
dependencies = [
542542
"anstream",
543543
"cargo_metadata",
@@ -550,9 +550,11 @@ dependencies = [
550550
"if_chain",
551551
"itertools",
552552
"parking_lot",
553+
"pulldown-cmark 0.11.3",
553554
"quote",
554555
"regex",
555-
"rustc_tools_util 0.3.0",
556+
"rinja",
557+
"rustc_tools_util",
556558
"serde",
557559
"serde_json",
558560
"syn 2.0.79",
@@ -566,7 +568,7 @@ dependencies = [
566568

567569
[[package]]
568570
name = "clippy_config"
569-
version = "0.1.83"
571+
version = "0.1.84"
570572
dependencies = [
571573
"itertools",
572574
"serde",
@@ -582,20 +584,19 @@ dependencies = [
582584
"clap",
583585
"indoc",
584586
"itertools",
585-
"opener 0.6.1",
587+
"opener",
586588
"shell-escape",
587589
"walkdir",
588590
]
589591

590592
[[package]]
591593
name = "clippy_lints"
592-
version = "0.1.83"
594+
version = "0.1.84"
593595
dependencies = [
594596
"arrayvec",
595597
"cargo_metadata",
596598
"clippy_config",
597599
"clippy_utils",
598-
"declare_clippy_lint",
599600
"itertools",
600601
"quine-mc_cluskey",
601602
"regex",
@@ -613,7 +614,7 @@ dependencies = [
613614

614615
[[package]]
615616
name = "clippy_utils"
616-
version = "0.1.83"
617+
version = "0.1.84"
617618
dependencies = [
618619
"arrayvec",
619620
"clippy_config",
@@ -919,15 +920,6 @@ dependencies = [
919920
"winapi",
920921
]
921922

922-
[[package]]
923-
name = "declare_clippy_lint"
924-
version = "0.1.83"
925-
dependencies = [
926-
"itertools",
927-
"quote",
928-
"syn 2.0.79",
929-
]
930-
931923
[[package]]
932924
name = "deranged"
933925
version = "0.3.11"
@@ -1915,7 +1907,7 @@ dependencies = [
19151907
"anyhow",
19161908
"clap",
19171909
"fs-err",
1918-
"rustc-hash 1.1.0",
1910+
"rustc-hash 2.0.0",
19191911
"rustdoc-json-types",
19201912
"serde",
19211913
"serde_json",
@@ -2163,7 +2155,7 @@ dependencies = [
21632155
"log",
21642156
"memchr",
21652157
"once_cell",
2166-
"opener 0.7.2",
2158+
"opener",
21672159
"pulldown-cmark 0.10.3",
21682160
"regex",
21692161
"serde",
@@ -2501,17 +2493,6 @@ dependencies = [
25012493
"stable_deref_trait",
25022494
]
25032495

2504-
[[package]]
2505-
name = "opener"
2506-
version = "0.6.1"
2507-
source = "registry+https://github.com/rust-lang/crates.io-index"
2508-
checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788"
2509-
dependencies = [
2510-
"bstr",
2511-
"normpath",
2512-
"winapi",
2513-
]
2514-
25152496
[[package]]
25162497
name = "opener"
25172498
version = "0.7.2"
@@ -2879,6 +2860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
28792860
checksum = "679341d22c78c6c649893cbd6c3278dcbe9fc4faa62fea3a9296ae2b50c14625"
28802861
dependencies = [
28812862
"bitflags 2.6.0",
2863+
"getopts",
28822864
"memchr",
28832865
"pulldown-cmark-escape 0.11.0",
28842866
"unicase",
@@ -3532,7 +3514,7 @@ dependencies = [
35323514
"memmap2",
35333515
"parking_lot",
35343516
"portable-atomic",
3535-
"rustc-hash 1.1.0",
3517+
"rustc-hash 2.0.0",
35363518
"rustc-rayon",
35373519
"rustc-stable-hash",
35383520
"rustc_arena",
@@ -4229,7 +4211,7 @@ dependencies = [
42294211
name = "rustc_pattern_analysis"
42304212
version = "0.0.0"
42314213
dependencies = [
4232-
"rustc-hash 1.1.0",
4214+
"rustc-hash 2.0.0",
42334215
"rustc_apfloat",
42344216
"rustc_arena",
42354217
"rustc_data_structures",
@@ -4460,12 +4442,6 @@ dependencies = [
44604442
"tracing",
44614443
]
44624444

4463-
[[package]]
4464-
name = "rustc_tools_util"
4465-
version = "0.3.0"
4466-
source = "registry+https://github.com/rust-lang/crates.io-index"
4467-
checksum = "8ba09476327c4b70ccefb6180f046ef588c26a24cf5d269a9feba316eb4f029f"
4468-
44694445
[[package]]
44704446
name = "rustc_tools_util"
44714447
version = "0.4.0"
@@ -4608,6 +4584,7 @@ dependencies = [
46084584
"rustdoc-json-types",
46094585
"serde",
46104586
"serde_json",
4587+
"sha2",
46114588
"smallvec",
46124589
"tempfile",
46134590
"threadpool",
@@ -4632,7 +4609,7 @@ name = "rustdoc-json-types"
46324609
version = "0.1.0"
46334610
dependencies = [
46344611
"bincode",
4635-
"rustc-hash 1.1.0",
4612+
"rustc-hash 2.0.0",
46364613
"serde",
46374614
"serde_json",
46384615
]
@@ -5262,7 +5239,7 @@ dependencies = [
52625239
"ignore",
52635240
"miropt-test-tools",
52645241
"regex",
5265-
"rustc-hash 1.1.0",
5242+
"rustc-hash 2.0.0",
52665243
"semver",
52675244
"similar",
52685245
"termcolor",
@@ -5593,13 +5570,6 @@ dependencies = [
55935570
"version_check",
55945571
]
55955572

5596-
[[package]]
5597-
name = "unicode-bdd"
5598-
version = "0.1.0"
5599-
dependencies = [
5600-
"ucd-parse",
5601-
]
5602-
56035573
[[package]]
56045574
name = "unicode-bidi"
56055575
version = "0.3.15"
@@ -5649,6 +5619,13 @@ version = "1.12.0"
56495619
source = "registry+https://github.com/rust-lang/crates.io-index"
56505620
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
56515621

5622+
[[package]]
5623+
name = "unicode-table-generator"
5624+
version = "0.1.0"
5625+
dependencies = [
5626+
"ucd-parse",
5627+
]
5628+
56525629
[[package]]
56535630
name = "unicode-width"
56545631
version = "0.1.14"

compiler/rustc_abi/src/callconv.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@ mod abi {
33
pub(crate) use crate::Variants;
44
}
55

6+
#[cfg(feature = "nightly")]
67
use rustc_macros::HashStable_Generic;
78

8-
use crate::{Abi, Align, FieldsShape, HasDataLayout, Size, TyAbiInterface, TyAndLayout};
9+
#[cfg(feature = "nightly")]
10+
use crate::{Abi, FieldsShape, TyAbiInterface, TyAndLayout};
11+
use crate::{Align, HasDataLayout, Size};
912

10-
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
13+
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
14+
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
1115
pub enum RegKind {
1216
Integer,
1317
Float,
1418
Vector,
1519
}
1620

17-
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
21+
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
22+
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
1823
pub struct Reg {
1924
pub kind: RegKind,
2025
pub size: Size,
@@ -108,15 +113,8 @@ impl HomogeneousAggregate {
108113
}
109114
}
110115

116+
#[cfg(feature = "nightly")]
111117
impl<'a, Ty> TyAndLayout<'a, Ty> {
112-
/// Returns `true` if this is an aggregate type (including a ScalarPair!)
113-
pub fn is_aggregate(&self) -> bool {
114-
match self.abi {
115-
Abi::Uninhabited | Abi::Scalar(_) | Abi::Vector { .. } => false,
116-
Abi::ScalarPair(..) | Abi::Aggregate { .. } => true,
117-
}
118-
}
119-
120118
/// Returns `Homogeneous` if this layout is an aggregate containing fields of
121119
/// only a single type (e.g., `(u32, u32)`). Such aggregates are often
122120
/// special-cased in ABIs.

compiler/rustc_abi/src/layout.rs

+37-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ use crate::{
1111
Variants, WrappingRange,
1212
};
1313

14+
#[cfg(feature = "nightly")]
1415
mod ty;
1516

17+
#[cfg(feature = "nightly")]
1618
pub use ty::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};
1719

1820
// A variant is absent if it's uninhabited and only has ZST fields.
@@ -39,7 +41,7 @@ enum NicheBias {
3941
End,
4042
}
4143

42-
#[derive(Copy, Clone, Debug)]
44+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
4345
pub enum LayoutCalculatorError<F> {
4446
/// An unsized type was found in a location where a sized type was expected.
4547
///
@@ -54,6 +56,36 @@ pub enum LayoutCalculatorError<F> {
5456

5557
/// A union had no fields.
5658
EmptyUnion,
59+
60+
/// The fields or variants have irreconcilable reprs
61+
ReprConflict,
62+
}
63+
64+
impl<F> LayoutCalculatorError<F> {
65+
pub fn without_payload(&self) -> LayoutCalculatorError<()> {
66+
match self {
67+
LayoutCalculatorError::UnexpectedUnsized(_) => {
68+
LayoutCalculatorError::UnexpectedUnsized(())
69+
}
70+
LayoutCalculatorError::SizeOverflow => LayoutCalculatorError::SizeOverflow,
71+
LayoutCalculatorError::EmptyUnion => LayoutCalculatorError::EmptyUnion,
72+
LayoutCalculatorError::ReprConflict => LayoutCalculatorError::ReprConflict,
73+
}
74+
}
75+
76+
/// Format an untranslated diagnostic for this type
77+
///
78+
/// Intended for use by rust-analyzer, as neither it nor `rustc_abi` depend on fluent infra.
79+
pub fn fallback_fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
80+
f.write_str(match self {
81+
LayoutCalculatorError::UnexpectedUnsized(_) => {
82+
"an unsized type was found where a sized type was expected"
83+
}
84+
LayoutCalculatorError::SizeOverflow => "size overflow",
85+
LayoutCalculatorError::EmptyUnion => "type is a union with no fields",
86+
LayoutCalculatorError::ReprConflict => "type has an invalid repr",
87+
})
88+
}
5789
}
5890

5991
type LayoutCalculatorResult<FieldIdx, VariantIdx, F> =
@@ -489,6 +521,10 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
489521
}
490522

491523
let dl = self.cx.data_layout();
524+
// bail if the enum has an incoherent repr that cannot be computed
525+
if repr.packed() {
526+
return Err(LayoutCalculatorError::ReprConflict);
527+
}
492528

493529
let calculate_niche_filling_layout = || -> Option<TmpLayout<FieldIdx, VariantIdx>> {
494530
if dont_niche_optimize_enum {

0 commit comments

Comments
 (0)