Skip to content

Commit 2427bf9

Browse files
committed
Auto merge of rust-lang#3597 - rust-lang:rustup-2024-05-11, r=RalfJung
Automatic Rustup
2 parents 6f4c7d9 + ce3daac commit 2427bf9

File tree

838 files changed

+10671
-5859
lines changed

Some content is hidden

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

838 files changed

+10671
-5859
lines changed

Diff for: .github/workflows/ci.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252
- name: Checkout the source code
5353
uses: actions/checkout@v4
5454
- name: Calculate the CI job matrix
55+
env:
56+
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
5557
run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
5658
id: jobs
5759
job:
@@ -75,14 +77,6 @@ jobs:
7577
matrix:
7678
# Check the `calculate_matrix` job to see how is the matrix defined.
7779
include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
78-
# GitHub Actions fails the workflow if an empty list of jobs is provided to
79-
# the workflow, so we need to skip this job if nothing was produced by
80-
# the Python script.
81-
#
82-
# Unfortunately checking whether a list is empty is not possible in a nice
83-
# way due to GitHub Actions expressions limits.
84-
# This hack is taken from https://github.com/ferrocene/ferrocene/blob/d43edc6b7697cf1719ec1c17c54904ab94825763/.github/workflows/release.yml#L75-L82
85-
if: fromJSON(needs.calculate_matrix.outputs.jobs)[0] != null
8680
steps:
8781
- if: contains(matrix.os, 'windows')
8882
uses: msys2/[email protected]

Diff for: Cargo.lock

+12-18
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,9 @@ version = "0.1.0"
479479

480480
[[package]]
481481
name = "cc"
482-
version = "1.0.92"
482+
version = "1.0.97"
483483
source = "registry+https://github.com/rust-lang/crates.io-index"
484-
checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41"
484+
checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
485485

486486
[[package]]
487487
name = "cfg-if"
@@ -2219,7 +2219,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
22192219
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
22202220
dependencies = [
22212221
"cfg-if",
2222-
"windows-targets 0.48.5",
2222+
"windows-targets 0.52.4",
22232223
]
22242224

22252225
[[package]]
@@ -2760,7 +2760,7 @@ dependencies = [
27602760
"tabled",
27612761
"tar",
27622762
"tempfile",
2763-
"xz",
2763+
"xz2",
27642764
"zip",
27652765
]
27662766

@@ -3746,8 +3746,10 @@ name = "rustc_codegen_ssa"
37463746
version = "0.0.0"
37473747
dependencies = [
37483748
"ar_archive_writer",
3749+
"arrayvec",
37493750
"bitflags 2.5.0",
37503751
"cc",
3752+
"either",
37513753
"itertools 0.12.1",
37523754
"jobserver",
37533755
"libc",
@@ -3976,7 +3978,6 @@ dependencies = [
39763978
"rustc_session",
39773979
"rustc_span",
39783980
"smallvec",
3979-
"termcolor",
39803981
"thin-vec",
39813982
"tracing",
39823983
]
@@ -4163,6 +4164,7 @@ dependencies = [
41634164
"rustc_ast",
41644165
"rustc_ast_lowering",
41654166
"rustc_ast_passes",
4167+
"rustc_ast_pretty",
41664168
"rustc_attr",
41674169
"rustc_borrowck",
41684170
"rustc_builtin_macros",
@@ -4464,6 +4466,7 @@ dependencies = [
44644466
"rustc_macros",
44654467
"rustc_session",
44664468
"rustc_span",
4469+
"termcolor",
44674470
"thin-vec",
44684471
"tracing",
44694472
"unicode-normalization",
@@ -5667,9 +5670,9 @@ version = "0.1.0"
56675670

56685671
[[package]]
56695672
name = "time"
5670-
version = "0.3.34"
5673+
version = "0.3.36"
56715674
source = "registry+https://github.com/rust-lang/crates.io-index"
5672-
checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
5675+
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
56735676
dependencies = [
56745677
"deranged",
56755678
"itoa",
@@ -5688,9 +5691,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
56885691

56895692
[[package]]
56905693
name = "time-macros"
5691-
version = "0.2.17"
5694+
version = "0.2.18"
56925695
source = "registry+https://github.com/rust-lang/crates.io-index"
5693-
checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
5696+
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
56945697
dependencies = [
56955698
"num-conv",
56965699
"time-core",
@@ -6585,15 +6588,6 @@ dependencies = [
65856588
"rustix",
65866589
]
65876590

6588-
[[package]]
6589-
name = "xz"
6590-
version = "0.1.0"
6591-
source = "registry+https://github.com/rust-lang/crates.io-index"
6592-
checksum = "3c887690ff2a2e233e8e49633461521f98ec57fbff9d59a884c9a4f04ec1da34"
6593-
dependencies = [
6594-
"xz2",
6595-
]
6596-
65976591
[[package]]
65986592
name = "xz2"
65996593
version = "0.1.7"

Diff for: compiler/rustc_abi/src/layout.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::borrow::{Borrow, Cow};
22
use std::cmp;
33
use std::fmt::{self, Write};
44
use std::iter;
5+
use std::num::NonZero;
56
use std::ops::Bound;
67
use std::ops::Deref;
78

@@ -10,8 +11,8 @@ use tracing::debug;
1011

1112
use crate::{
1213
Abi, AbiAndPrefAlign, Align, FieldsShape, IndexSlice, IndexVec, Integer, LayoutS, Niche,
13-
NonZeroUsize, Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding, TargetDataLayout,
14-
Variants, WrappingRange,
14+
Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding, TargetDataLayout, Variants,
15+
WrappingRange,
1516
};
1617

1718
// A variant is absent if it's uninhabited and only has ZST fields.
@@ -327,7 +328,7 @@ pub trait LayoutCalculator {
327328

328329
Some(LayoutS {
329330
variants: Variants::Single { index: VariantIdx::new(0) },
330-
fields: FieldsShape::Union(NonZeroUsize::new(only_variant.len())?),
331+
fields: FieldsShape::Union(NonZero::new(only_variant.len())?),
331332
abi,
332333
largest_niche: None,
333334
align,

Diff for: compiler/rustc_abi/src/lib.rs

+40-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
55

66
use std::fmt;
7-
use std::num::{NonZeroUsize, ParseIntError};
7+
use std::num::{NonZero, ParseIntError};
88
use std::ops::{Add, AddAssign, Mul, RangeInclusive, Sub};
99
use std::str::FromStr;
1010

@@ -926,6 +926,41 @@ impl Integer {
926926
}
927927
}
928928

929+
/// Floating-point types.
930+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
931+
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
932+
pub enum Float {
933+
F16,
934+
F32,
935+
F64,
936+
F128,
937+
}
938+
939+
impl Float {
940+
pub fn size(self) -> Size {
941+
use Float::*;
942+
943+
match self {
944+
F16 => Size::from_bits(16),
945+
F32 => Size::from_bits(32),
946+
F64 => Size::from_bits(64),
947+
F128 => Size::from_bits(128),
948+
}
949+
}
950+
951+
pub fn align<C: HasDataLayout>(self, cx: &C) -> AbiAndPrefAlign {
952+
use Float::*;
953+
let dl = cx.data_layout();
954+
955+
match self {
956+
F16 => dl.f16_align,
957+
F32 => dl.f32_align,
958+
F64 => dl.f64_align,
959+
F128 => dl.f128_align,
960+
}
961+
}
962+
}
963+
929964
/// Fundamental unit of memory access and layout.
930965
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
931966
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
@@ -938,10 +973,7 @@ pub enum Primitive {
938973
/// a negative integer passed by zero-extension will appear positive in
939974
/// the callee, and most operations on it will produce the wrong values.
940975
Int(Integer, bool),
941-
F16,
942-
F32,
943-
F64,
944-
F128,
976+
Float(Float),
945977
Pointer(AddressSpace),
946978
}
947979

@@ -952,10 +984,7 @@ impl Primitive {
952984

953985
match self {
954986
Int(i, _) => i.size(),
955-
F16 => Size::from_bits(16),
956-
F32 => Size::from_bits(32),
957-
F64 => Size::from_bits(64),
958-
F128 => Size::from_bits(128),
987+
Float(f) => f.size(),
959988
// FIXME(erikdesjardins): ignoring address space is technically wrong, pointers in
960989
// different address spaces can have different sizes
961990
// (but TargetDataLayout doesn't currently parse that part of the DL string)
@@ -969,10 +998,7 @@ impl Primitive {
969998

970999
match self {
9711000
Int(i, _) => i.align(dl),
972-
F16 => dl.f16_align,
973-
F32 => dl.f32_align,
974-
F64 => dl.f64_align,
975-
F128 => dl.f128_align,
1001+
Float(f) => f.align(dl),
9761002
// FIXME(erikdesjardins): ignoring address space is technically wrong, pointers in
9771003
// different address spaces can have different alignments
9781004
// (but TargetDataLayout doesn't currently parse that part of the DL string)
@@ -1149,7 +1175,7 @@ pub enum FieldsShape<FieldIdx: Idx> {
11491175
Primitive,
11501176

11511177
/// All fields start at no offset. The `usize` is the field count.
1152-
Union(NonZeroUsize),
1178+
Union(NonZero<usize>),
11531179

11541180
/// Array/vector-like placement, with all fields of identical types.
11551181
Array { stride: Size, count: u64 },

Diff for: compiler/rustc_ast/src/ast.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ pub enum ExprKind {
14221422
/// of `if` / `while` expressions. (e.g., `if let 0 = x { .. }`).
14231423
///
14241424
/// `Span` represents the whole `let pat = expr` statement.
1425-
Let(P<Pat>, P<Expr>, Span, Option<ErrorGuaranteed>),
1425+
Let(P<Pat>, P<Expr>, Span, Recovered),
14261426
/// An `if` block, with an optional `else` block.
14271427
///
14281428
/// `if expr { block } else { expr }`
@@ -2164,7 +2164,7 @@ pub enum TyKind {
21642164
MacCall(P<MacCall>),
21652165
/// Placeholder for a `va_list`.
21662166
CVarArgs,
2167-
/// Pattern types like `pattern_type!(u32 is 1..=)`, which is the same as `NonZeroU32`,
2167+
/// Pattern types like `pattern_type!(u32 is 1..=)`, which is the same as `NonZero<u32>`,
21682168
/// just as part of the type system.
21692169
Pat(P<Ty>, P<Pat>),
21702170
/// Sometimes we need a dummy value when no error has occurred.
@@ -2729,7 +2729,7 @@ pub enum UseTreeKind {
27292729
/// `use prefix` or `use prefix as rename`
27302730
Simple(Option<Ident>),
27312731
/// `use prefix::{...}`
2732-
Nested(ThinVec<(UseTree, NodeId)>),
2732+
Nested { items: ThinVec<(UseTree, NodeId)>, span: Span },
27332733
/// `use prefix::*`
27342734
Glob,
27352735
}
@@ -2881,17 +2881,20 @@ pub struct FieldDef {
28812881
pub is_placeholder: bool,
28822882
}
28832883

2884+
/// Was parsing recovery performed?
2885+
#[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable_Generic)]
2886+
pub enum Recovered {
2887+
No,
2888+
Yes(ErrorGuaranteed),
2889+
}
2890+
28842891
/// Fields and constructor ids of enum variants and structs.
28852892
#[derive(Clone, Encodable, Decodable, Debug)]
28862893
pub enum VariantData {
28872894
/// Struct variant.
28882895
///
28892896
/// E.g., `Bar { .. }` as in `enum Foo { Bar { .. } }`.
2890-
Struct {
2891-
fields: ThinVec<FieldDef>,
2892-
// FIXME: investigate making this a `Option<ErrorGuaranteed>`
2893-
recovered: bool,
2894-
},
2897+
Struct { fields: ThinVec<FieldDef>, recovered: Recovered },
28952898
/// Tuple variant.
28962899
///
28972900
/// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`.

Diff for: compiler/rustc_ast/src/mut_visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ fn noop_visit_use_tree<T: MutVisitor>(use_tree: &mut UseTree, vis: &mut T) {
441441
vis.visit_path(prefix);
442442
match kind {
443443
UseTreeKind::Simple(rename) => visit_opt(rename, |rename| vis.visit_ident(rename)),
444-
UseTreeKind::Nested(items) => {
444+
UseTreeKind::Nested { items, .. } => {
445445
for (tree, id) in items {
446446
vis.visit_use_tree(tree);
447447
vis.visit_id(id);

Diff for: compiler/rustc_ast/src/token.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl LitKind {
167167

168168
pub fn descr(self) -> &'static str {
169169
match self {
170-
Bool => panic!("literal token contains `Lit::Bool`"),
170+
Bool => "boolean",
171171
Byte => "byte",
172172
Char => "char",
173173
Integer => "integer",

Diff for: compiler/rustc_ast/src/tokenstream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ impl<'t> Iterator for RefTokenTreeCursor<'t> {
706706
/// involve associated types) for getting individual elements, or
707707
/// `RefTokenTreeCursor` if you really want an `Iterator`, e.g. in a `for`
708708
/// loop.
709-
#[derive(Clone)]
709+
#[derive(Clone, Debug)]
710710
pub struct TokenTreeCursor {
711711
pub stream: TokenStream,
712712
index: usize,

Diff for: compiler/rustc_ast/src/visit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,8 @@ pub fn walk_use_tree<'a, V: Visitor<'a>>(
517517
visit_opt!(visitor, visit_ident, rename);
518518
}
519519
UseTreeKind::Glob => {}
520-
UseTreeKind::Nested(ref use_trees) => {
521-
for &(ref nested_tree, nested_id) in use_trees {
520+
UseTreeKind::Nested { ref items, .. } => {
521+
for &(ref nested_tree, nested_id) in items {
522522
try_visit!(visitor.visit_use_tree(nested_tree, nested_id, true));
523523
}
524524
}

Diff for: compiler/rustc_ast_lowering/src/expr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
158158
let ohs = self.lower_expr(ohs);
159159
hir::ExprKind::AddrOf(*k, *m, ohs)
160160
}
161-
ExprKind::Let(pat, scrutinee, span, is_recovered) => {
161+
ExprKind::Let(pat, scrutinee, span, recovered) => {
162162
hir::ExprKind::Let(self.arena.alloc(hir::LetExpr {
163163
span: self.lower_span(*span),
164164
pat: self.lower_pat(pat),
165165
ty: None,
166166
init: self.lower_expr(scrutinee),
167-
is_recovered: *is_recovered,
167+
recovered: *recovered,
168168
}))
169169
}
170170
ExprKind::If(cond, then, else_opt) => {
@@ -581,8 +581,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
581581
self.dcx().emit_err(NeverPatternWithGuard { span: g.span });
582582
}
583583

584-
// We add a fake `loop {}` arm body so that it typecks to `!`.
585-
// FIXME(never_patterns): Desugar into a call to `unreachable_unchecked`.
584+
// We add a fake `loop {}` arm body so that it typecks to `!`. The mir lowering of never
585+
// patterns ensures this loop is not reachable.
586586
let block = self.arena.alloc(hir::Block {
587587
stmts: &[],
588588
expr: None,

Diff for: compiler/rustc_ast_lowering/src/item.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
135135

136136
fn lower_item_id_use_tree(&mut self, tree: &UseTree, vec: &mut SmallVec<[hir::ItemId; 1]>) {
137137
match &tree.kind {
138-
UseTreeKind::Nested(nested_vec) => {
139-
for &(ref nested, id) in nested_vec {
138+
UseTreeKind::Nested { items, .. } => {
139+
for &(ref nested, id) in items {
140140
vec.push(hir::ItemId {
141141
owner_id: hir::OwnerId { def_id: self.local_def_id(id) },
142142
});
@@ -518,7 +518,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
518518
let path = self.lower_use_path(res, &path, ParamMode::Explicit);
519519
hir::ItemKind::Use(path, hir::UseKind::Glob)
520520
}
521-
UseTreeKind::Nested(ref trees) => {
521+
UseTreeKind::Nested { items: ref trees, .. } => {
522522
// Nested imports are desugared into simple imports.
523523
// So, if we start with
524524
//

0 commit comments

Comments
 (0)