Skip to content

Commit 2fae357

Browse files
committed
Auto merge of rust-lang#3394 - RalfJung:rustup, r=RalfJung
Rustup
2 parents f61f45f + ee57d2b commit 2fae357

File tree

917 files changed

+20346
-7434
lines changed

Some content is hidden

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

917 files changed

+20346
-7434
lines changed

Cargo.lock

+9-6
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
574574

575575
[[package]]
576576
name = "clippy"
577-
version = "0.1.78"
577+
version = "0.1.79"
578578
dependencies = [
579579
"anstream",
580580
"clippy_config",
@@ -602,7 +602,7 @@ dependencies = [
602602

603603
[[package]]
604604
name = "clippy_config"
605-
version = "0.1.78"
605+
version = "0.1.79"
606606
dependencies = [
607607
"rustc-semver",
608608
"serde",
@@ -625,7 +625,7 @@ dependencies = [
625625

626626
[[package]]
627627
name = "clippy_lints"
628-
version = "0.1.78"
628+
version = "0.1.79"
629629
dependencies = [
630630
"arrayvec",
631631
"cargo_metadata 0.18.1",
@@ -650,7 +650,7 @@ dependencies = [
650650

651651
[[package]]
652652
name = "clippy_utils"
653-
version = "0.1.78"
653+
version = "0.1.79"
654654
dependencies = [
655655
"arrayvec",
656656
"clippy_config",
@@ -971,7 +971,7 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"
971971

972972
[[package]]
973973
name = "declare_clippy_lint"
974-
version = "0.1.78"
974+
version = "0.1.79"
975975
dependencies = [
976976
"itertools 0.12.1",
977977
"quote",
@@ -2205,7 +2205,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
22052205
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
22062206
dependencies = [
22072207
"cfg-if",
2208-
"windows-targets 0.52.4",
2208+
"windows-targets 0.48.5",
22092209
]
22102210

22112211
[[package]]
@@ -4236,6 +4236,7 @@ name = "rustc_middle"
42364236
version = "0.0.0"
42374237
dependencies = [
42384238
"bitflags 2.4.2",
4239+
"derivative",
42394240
"either",
42404241
"field-offset",
42414242
"gsgdt",
@@ -4440,6 +4441,8 @@ dependencies = [
44404441
"rustc_target",
44414442
"smallvec",
44424443
"tracing",
4444+
"tracing-subscriber",
4445+
"tracing-tree",
44434446
]
44444447

44454448
[[package]]

compiler/rustc_ast/src/ast.rs

+16-6
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ impl TraitBoundModifiers {
303303
};
304304
}
305305

306-
/// The AST represents all type param bounds as types.
307-
/// `typeck::collect::compute_bounds` matches these against
308-
/// the "special" built-in traits (see `middle::lang_items`) and
309-
/// detects `Copy`, `Send` and `Sync`.
310306
#[derive(Clone, Encodable, Decodable, Debug)]
311307
pub enum GenericBound {
312308
Trait(PolyTraitRef, TraitBoundModifiers),
@@ -621,7 +617,9 @@ impl Pat {
621617
| PatKind::Or(s) => s.iter().for_each(|p| p.walk(it)),
622618

623619
// Trivial wrappers over inner patterns.
624-
PatKind::Box(s) | PatKind::Ref(s, _) | PatKind::Paren(s) => s.walk(it),
620+
PatKind::Box(s) | PatKind::Deref(s) | PatKind::Ref(s, _) | PatKind::Paren(s) => {
621+
s.walk(it)
622+
}
625623

626624
// These patterns do not contain subpatterns, skip.
627625
PatKind::Wild
@@ -792,6 +790,9 @@ pub enum PatKind {
792790
/// A `box` pattern.
793791
Box(P<Pat>),
794792

793+
/// A `deref` pattern (currently `deref!()` macro-based syntax).
794+
Deref(P<Pat>),
795+
795796
/// A reference pattern (e.g., `&mut (a, b)`).
796797
Ref(P<Pat>, Mutability),
797798

@@ -1436,7 +1437,7 @@ pub enum ExprKind {
14361437
/// `'label: loop { block }`
14371438
Loop(P<Block>, Option<Label>, Span),
14381439
/// A `match` block.
1439-
Match(P<Expr>, ThinVec<Arm>),
1440+
Match(P<Expr>, ThinVec<Arm>, MatchKind),
14401441
/// A closure (e.g., `move |a, b, c| a + b + c`).
14411442
Closure(Box<Closure>),
14421443
/// A block (`'label: { ... }`).
@@ -1761,6 +1762,15 @@ pub enum StrStyle {
17611762
Raw(u8),
17621763
}
17631764

1765+
/// The kind of match expression
1766+
#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq)]
1767+
pub enum MatchKind {
1768+
/// match expr { ... }
1769+
Prefix,
1770+
/// expr.match { ... }
1771+
Postfix,
1772+
}
1773+
17641774
/// A literal in a meta item.
17651775
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
17661776
pub struct MetaItemLit {

compiler/rustc_ast/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#![feature(box_patterns)]
1717
#![feature(if_let_guard)]
1818
#![feature(let_chains)]
19-
#![cfg_attr(bootstrap, feature(min_specialization))]
2019
#![feature(never_type)]
2120
#![feature(negative_impls)]
2221
#![feature(stmt_expr_attributes)]

compiler/rustc_ast/src/mut_visit.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,7 @@ pub fn noop_visit_pat<T: MutVisitor>(pat: &mut P<Pat>, vis: &mut T) {
12951295
fields.flat_map_in_place(|field| vis.flat_map_pat_field(field));
12961296
}
12971297
PatKind::Box(inner) => vis.visit_pat(inner),
1298+
PatKind::Deref(inner) => vis.visit_pat(inner),
12981299
PatKind::Ref(inner, _mutbl) => vis.visit_pat(inner),
12991300
PatKind::Range(e1, e2, Spanned { span: _, node: _ }) => {
13001301
visit_opt(e1, |e| vis.visit_expr(e));
@@ -1424,7 +1425,7 @@ pub fn noop_visit_expr<T: MutVisitor>(
14241425
visit_opt(label, |label| vis.visit_label(label));
14251426
vis.visit_span(span);
14261427
}
1427-
ExprKind::Match(expr, arms) => {
1428+
ExprKind::Match(expr, arms, _kind) => {
14281429
vis.visit_expr(expr);
14291430
arms.flat_map_in_place(|arm| vis.flat_map_arm(arm));
14301431
}

compiler/rustc_ast/src/token.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1111
use rustc_data_structures::sync::Lrc;
1212
use rustc_macros::HashStable_Generic;
1313
use rustc_span::symbol::{kw, sym};
14+
#[allow(clippy::useless_attribute)] // FIXME: following use of `hidden_glob_reexports` incorrectly triggers `useless_attribute` lint.
1415
#[allow(hidden_glob_reexports)]
1516
use rustc_span::symbol::{Ident, Symbol};
1617
use rustc_span::{edition::Edition, ErrorGuaranteed, Span, DUMMY_SP};
@@ -104,7 +105,7 @@ impl Lit {
104105
}
105106
}
106107

107-
/// Keep this in sync with `Token::can_begin_literal_or_bool` excluding unary negation.
108+
/// Keep this in sync with `Token::can_begin_literal_maybe_minus` excluding unary negation.
108109
pub fn from_token(token: &Token) -> Option<Lit> {
109110
match token.uninterpolate().kind {
110111
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => Some(Lit::new(Bool, name, None)),
@@ -663,7 +664,7 @@ impl Token {
663664
}
664665

665666
/// Returns `true` if the token is an interpolated path.
666-
fn is_path(&self) -> bool {
667+
fn is_whole_path(&self) -> bool {
667668
if let Interpolated(nt) = &self.kind
668669
&& let NtPath(..) = &nt.0
669670
{
@@ -709,7 +710,7 @@ impl Token {
709710
pub fn is_path_start(&self) -> bool {
710711
self == &ModSep
711712
|| self.is_qpath_start()
712-
|| self.is_path()
713+
|| self.is_whole_path()
713714
|| self.is_path_segment_keyword()
714715
|| self.is_ident() && !self.is_reserved_ident()
715716
}

compiler/rustc_ast/src/tokenstream.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,7 @@ use smallvec::{smallvec, SmallVec};
2828
use std::borrow::Cow;
2929
use std::{cmp, fmt, iter};
3030

31-
/// When the main Rust parser encounters a syntax-extension invocation, it
32-
/// parses the arguments to the invocation as a token tree. This is a very
33-
/// loose structure, such that all sorts of different AST fragments can
34-
/// be passed to syntax extensions using a uniform type.
35-
///
36-
/// If the syntax extension is an MBE macro, it will attempt to match its
37-
/// LHS token tree against the provided token tree, and if it finds a
38-
/// match, will transcribe the RHS token tree, splicing in any captured
39-
/// `macro_parser::matched_nonterminals` into the `SubstNt`s it finds.
40-
///
41-
/// The RHS of an MBE macro is the only place `SubstNt`s are substituted.
42-
/// Nothing special happens to misnamed or misplaced `SubstNt`s.
31+
/// Part of a `TokenStream`.
4332
#[derive(Debug, Clone, PartialEq, Encodable, Decodable, HashStable_Generic)]
4433
pub enum TokenTree {
4534
/// A single token. Should never be `OpenDelim` or `CloseDelim`, because

compiler/rustc_ast/src/visit.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ pub fn walk_use_tree<'a, V: Visitor<'a>>(
480480
try_visit!(visitor.visit_path(&use_tree.prefix, id));
481481
match use_tree.kind {
482482
UseTreeKind::Simple(rename) => {
483-
// The extra IDs are handled during HIR lowering.
483+
// The extra IDs are handled during AST lowering.
484484
visit_opt!(visitor, visit_ident, rename);
485485
}
486486
UseTreeKind::Glob => {}
@@ -576,7 +576,10 @@ pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) -> V::Res
576576
try_visit!(visitor.visit_path(path, pattern.id));
577577
walk_list!(visitor, visit_pat_field, fields);
578578
}
579-
PatKind::Box(subpattern) | PatKind::Ref(subpattern, _) | PatKind::Paren(subpattern) => {
579+
PatKind::Box(subpattern)
580+
| PatKind::Deref(subpattern)
581+
| PatKind::Ref(subpattern, _)
582+
| PatKind::Paren(subpattern) => {
580583
try_visit!(visitor.visit_pat(subpattern));
581584
}
582585
PatKind::Ident(_, ident, optional_subpattern) => {
@@ -920,7 +923,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V
920923
visit_opt!(visitor, visit_label, opt_label);
921924
try_visit!(visitor.visit_block(block));
922925
}
923-
ExprKind::Match(subexpression, arms) => {
926+
ExprKind::Match(subexpression, arms, _kind) => {
924927
try_visit!(visitor.visit_expr(subexpression));
925928
walk_list!(visitor, visit_arm, arms);
926929
}

compiler/rustc_ast_lowering/src/delegation.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
//! item id (`item_id`) in case of impl trait or path resolution id (`path_id`) otherwise.
3030
//!
3131
//! Since we do not have a proper way to obtain function type information by path resolution
32-
//! in AST, we mark each function parameter type as `InferDelegation` and inherit it in `AstConv`.
32+
//! in AST, we mark each function parameter type as `InferDelegation` and inherit it during
33+
//! HIR ty lowering.
3334
//!
3435
//! Similarly generics, predicates and header are set to the "default" values.
3536
//! In case of discrepancy with callee function the `NotSupportedDelegation` error will
36-
//! also be emitted in `AstConv`.
37+
//! also be emitted during HIR ty lowering.
3738
3839
use crate::{ImplTraitPosition, ResolverAstLoweringExt};
3940

@@ -129,7 +130,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
129130
) -> &'hir hir::FnDecl<'hir> {
130131
let args_count = if let Some(local_sig_id) = sig_id.as_local() {
131132
// Map may be filled incorrectly due to recursive delegation.
132-
// Error will be emmited later in astconv.
133+
// Error will be emitted later during HIR ty lowering.
133134
self.resolver.fn_parameter_counts.get(&local_sig_id).cloned().unwrap_or_default()
134135
} else {
135136
self.tcx.fn_arg_names(sig_id).len()

compiler/rustc_ast_lowering/src/expr.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
157157
hir::ExprKind::AddrOf(*k, *m, ohs)
158158
}
159159
ExprKind::Let(pat, scrutinee, span, is_recovered) => {
160-
hir::ExprKind::Let(self.arena.alloc(hir::Let {
160+
hir::ExprKind::Let(self.arena.alloc(hir::LetExpr {
161161
span: self.lower_span(*span),
162162
pat: self.lower_pat(pat),
163163
ty: None,
@@ -181,10 +181,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
181181
)
182182
}),
183183
ExprKind::TryBlock(body) => self.lower_expr_try_block(body),
184-
ExprKind::Match(expr, arms) => hir::ExprKind::Match(
184+
ExprKind::Match(expr, arms, kind) => hir::ExprKind::Match(
185185
self.lower_expr(expr),
186186
self.arena.alloc_from_iter(arms.iter().map(|x| self.lower_arm(x))),
187-
hir::MatchSource::Normal,
187+
match kind {
188+
MatchKind::Prefix => hir::MatchSource::Normal,
189+
MatchKind::Postfix => hir::MatchSource::Postfix,
190+
},
188191
),
189192
ExprKind::Await(expr, await_kw_span) => self.lower_expr_await(*await_kw_span, expr),
190193
ExprKind::Closure(box Closure {

compiler/rustc_ast_lowering/src/index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(super) fn index_hir<'hir>(
5555
OwnerNode::TraitItem(item) => collector.visit_trait_item(item),
5656
OwnerNode::ImplItem(item) => collector.visit_impl_item(item),
5757
OwnerNode::ForeignItem(item) => collector.visit_foreign_item(item),
58-
OwnerNode::AssocOpaqueTy(..) => unreachable!(),
58+
OwnerNode::Synthetic => unreachable!(),
5959
};
6060

6161
for (local_id, node) in collector.nodes.iter_enumerated() {

compiler/rustc_ast_lowering/src/item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1427,8 +1427,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
14271427
// Error if `?Trait` bounds in where clauses don't refer directly to type parameters.
14281428
// Note: we used to clone these bounds directly onto the type parameter (and avoid lowering
14291429
// these into hir when we lower thee where clauses), but this makes it quite difficult to
1430-
// keep track of the Span info. Now, `add_implicitly_sized` in `AstConv` checks both param bounds and
1431-
// where clauses for `?Sized`.
1430+
// keep track of the Span info. Now, `<dyn HirTyLowerer>::add_implicit_sized_bound`
1431+
// checks both param bounds and where clauses for `?Sized`.
14321432
for pred in &generics.where_clause.predicates {
14331433
let WherePredicate::BoundPredicate(bound_pred) = pred else {
14341434
continue;

0 commit comments

Comments
 (0)