Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a162071

Browse files
committed
Auto merge of rust-lang#120437 - matthiaskrgr:rollup-h1uai71, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#120358 (Bump Fuchsia, build tests, and use 8 core bots) - rust-lang#120402 (Make the coroutine def id of an async closure the child of the closure def id) - rust-lang#120420 (Stop using derivative in rustc_pattern_analysis) - rust-lang#120425 (Remove unnecessary unit returns in query declarations) - rust-lang#120428 (hir: Two preparatory changes for rust-lang#120206) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 6351247 + 4a759f0 commit a162071

File tree

28 files changed

+293
-91
lines changed

28 files changed

+293
-91
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ jobs:
291291
- name: x86_64-gnu-integration
292292
env:
293293
CI_ONLY_WHEN_CHANNEL: nightly
294-
os: ubuntu-20.04-16core-64gb
294+
os: ubuntu-20.04-8core-32gb
295295
- name: x86_64-gnu-debug
296296
os: ubuntu-20.04-8core-32gb
297297
env: {}

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4342,7 +4342,6 @@ dependencies = [
43424342
name = "rustc_pattern_analysis"
43434343
version = "0.0.0"
43444344
dependencies = [
4345-
"derivative",
43464345
"rustc-hash",
43474346
"rustc_apfloat",
43484347
"rustc_arena",

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
153153
}
154154
ExprKind::Let(pat, scrutinee, span, is_recovered) => {
155155
hir::ExprKind::Let(self.arena.alloc(hir::Let {
156-
hir_id: self.next_id(),
157156
span: self.lower_span(*span),
158157
pat: self.lower_pat(pat),
159158
ty: None,

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23052305
match c.value.kind {
23062306
ExprKind::Underscore => {
23072307
if self.tcx.features().generic_arg_infer {
2308-
hir::ArrayLen::Infer(self.lower_node_id(c.id), self.lower_span(c.value.span))
2308+
hir::ArrayLen::Infer(hir::InferArg {
2309+
hir_id: self.lower_node_id(c.id),
2310+
span: self.lower_span(c.value.span),
2311+
})
23092312
} else {
23102313
feature_err(
23112314
&self.tcx.sess,

compiler/rustc_hir/src/hir.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,6 @@ pub struct Arm<'hir> {
12731273
/// desugaring to if-let. Only let-else supports the type annotation at present.
12741274
#[derive(Debug, Clone, Copy, HashStable_Generic)]
12751275
pub struct Let<'hir> {
1276-
pub hir_id: HirId,
12771276
pub span: Span,
12781277
pub pat: &'hir Pat<'hir>,
12791278
pub ty: Option<&'hir Ty<'hir>>,
@@ -1532,14 +1531,16 @@ pub type Lit = Spanned<LitKind>;
15321531

15331532
#[derive(Copy, Clone, Debug, HashStable_Generic)]
15341533
pub enum ArrayLen {
1535-
Infer(HirId, Span),
1534+
Infer(InferArg),
15361535
Body(AnonConst),
15371536
}
15381537

15391538
impl ArrayLen {
15401539
pub fn hir_id(&self) -> HirId {
15411540
match self {
1542-
&ArrayLen::Infer(hir_id, _) | &ArrayLen::Body(AnonConst { hir_id, .. }) => hir_id,
1541+
ArrayLen::Infer(InferArg { hir_id, .. }) | ArrayLen::Body(AnonConst { hir_id, .. }) => {
1542+
*hir_id
1543+
}
15431544
}
15441545
}
15451546
}
@@ -2424,7 +2425,7 @@ impl<'hir> Ty<'hir> {
24242425
TyKind::Infer => true,
24252426
TyKind::Slice(ty) => ty.is_suggestable_infer_ty(),
24262427
TyKind::Array(ty, length) => {
2427-
ty.is_suggestable_infer_ty() || matches!(length, ArrayLen::Infer(_, _))
2428+
ty.is_suggestable_infer_ty() || matches!(length, ArrayLen::Infer(..))
24282429
}
24292430
TyKind::Tup(tys) => tys.iter().any(Self::is_suggestable_infer_ty),
24302431
TyKind::Ptr(mut_ty) | TyKind::Ref(_, mut_ty) => mut_ty.ty.is_suggestable_infer_ty(),

compiler/rustc_hir/src/intravisit.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,6 @@ pub trait Visitor<'v>: Sized {
341341
fn visit_expr(&mut self, ex: &'v Expr<'v>) {
342342
walk_expr(self, ex)
343343
}
344-
fn visit_let_expr(&mut self, lex: &'v Let<'v>) {
345-
walk_let_expr(self, lex)
346-
}
347344
fn visit_expr_field(&mut self, field: &'v ExprField<'v>) {
348345
walk_expr_field(self, field)
349346
}
@@ -672,7 +669,7 @@ pub fn walk_pat_field<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v PatField<'
672669

673670
pub fn walk_array_len<'v, V: Visitor<'v>>(visitor: &mut V, len: &'v ArrayLen) {
674671
match len {
675-
&ArrayLen::Infer(hir_id, _span) => visitor.visit_id(hir_id),
672+
ArrayLen::Infer(InferArg { hir_id, span: _ }) => visitor.visit_id(*hir_id),
676673
ArrayLen::Body(c) => visitor.visit_anon_const(c),
677674
}
678675
}
@@ -729,7 +726,12 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
729726
ExprKind::DropTemps(ref subexpression) => {
730727
visitor.visit_expr(subexpression);
731728
}
732-
ExprKind::Let(ref let_expr) => visitor.visit_let_expr(let_expr),
729+
ExprKind::Let(Let { span: _, pat, ty, init, is_recovered: _ }) => {
730+
// match the visit order in walk_local
731+
visitor.visit_expr(init);
732+
visitor.visit_pat(pat);
733+
walk_list!(visitor, visit_ty, ty);
734+
}
733735
ExprKind::If(ref cond, ref then, ref else_opt) => {
734736
visitor.visit_expr(cond);
735737
visitor.visit_expr(then);
@@ -806,14 +808,6 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
806808
}
807809
}
808810

809-
pub fn walk_let_expr<'v, V: Visitor<'v>>(visitor: &mut V, let_expr: &'v Let<'v>) {
810-
// match the visit order in walk_local
811-
visitor.visit_expr(let_expr.init);
812-
visitor.visit_id(let_expr.hir_id);
813-
visitor.visit_pat(let_expr.pat);
814-
walk_list!(visitor, visit_ty, let_expr.ty);
815-
}
816-
817811
pub fn walk_expr_field<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v ExprField<'v>) {
818812
visitor.visit_id(field.hir_id);
819813
visitor.visit_ident(field.ident);

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
25292529
}
25302530
hir::TyKind::Array(ty, length) => {
25312531
let length = match length {
2532-
&hir::ArrayLen::Infer(_, span) => self.ct_infer(tcx.types.usize, None, span),
2532+
hir::ArrayLen::Infer(inf) => self.ct_infer(tcx.types.usize, None, inf.span),
25332533
hir::ArrayLen::Body(constant) => {
25342534
ty::Const::from_anon_const(tcx, constant.def_id)
25352535
}

compiler/rustc_hir_analysis/src/collect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ impl<'v> Visitor<'v> for HirPlaceholderCollector {
146146
}
147147
}
148148
fn visit_array_length(&mut self, length: &'v hir::ArrayLen) {
149-
if let &hir::ArrayLen::Infer(_, span) = length {
150-
self.0.push(span);
149+
if let hir::ArrayLen::Infer(inf) = length {
150+
self.0.push(inf.span);
151151
}
152152
intravisit::walk_array_len(self, length)
153153
}

compiler/rustc_hir_pretty/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ impl<'a> State<'a> {
956956

957957
fn print_array_length(&mut self, len: &hir::ArrayLen) {
958958
match len {
959-
hir::ArrayLen::Infer(_, _) => self.word("_"),
959+
hir::ArrayLen::Infer(..) => self.word("_"),
960960
hir::ArrayLen::Body(ct) => self.print_anon_const(ct),
961961
}
962962
}

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
320320
}
321321
ExprKind::Ret(ref expr_opt) => self.check_expr_return(expr_opt.as_deref(), expr),
322322
ExprKind::Become(call) => self.check_expr_become(call, expr),
323-
ExprKind::Let(let_expr) => self.check_expr_let(let_expr),
323+
ExprKind::Let(let_expr) => self.check_expr_let(let_expr, expr.hir_id),
324324
ExprKind::Loop(body, _, source, _) => {
325325
self.check_expr_loop(body, source, expected, expr)
326326
}
@@ -1259,12 +1259,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12591259
}
12601260
}
12611261

1262-
pub(super) fn check_expr_let(&self, let_expr: &'tcx hir::Let<'tcx>) -> Ty<'tcx> {
1262+
pub(super) fn check_expr_let(&self, let_expr: &'tcx hir::Let<'tcx>, hir_id: HirId) -> Ty<'tcx> {
12631263
// for let statements, this is done in check_stmt
12641264
let init = let_expr.init;
12651265
self.warn_if_unreachable(init.hir_id, init.span, "block in `let` expression");
12661266
// otherwise check exactly as a let statement
1267-
self.check_decl(let_expr.into());
1267+
self.check_decl((let_expr, hir_id).into());
12681268
// but return a bool, for this is a boolean expression
12691269
if let Some(error_guaranteed) = let_expr.is_recovered {
12701270
self.set_tainted_by_errors(error_guaranteed);

0 commit comments

Comments
 (0)