Skip to content

Commit fa6062a

Browse files
committed
Auto merge of rust-lang#122932 - matthiaskrgr:rollup-px6ifi3, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#122460 (Rework rmake support library API) - rust-lang#122698 (Cancel `cargo update` job if there's no updates) - rust-lang#122780 (Rename `hir::Local` into `hir::LetStmt`) - rust-lang#122875 (CFI: Support self_cell-like recursion) - rust-lang#122915 (Delay a bug if no RPITITs were found) - rust-lang#122916 (docs(sync): normalize dot in fn summaries) - rust-lang#122921 (Enable more mir-opt tests in debug builds) - rust-lang#122922 (-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.) - rust-lang#122927 (Change an ICE regression test to use the original reproducer) r? `@ghost` `@rustbot` modify labels: rollup
2 parents c3b05c6 + 8cd7551 commit fa6062a

File tree

121 files changed

+828
-426
lines changed

Some content is hidden

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

121 files changed

+828
-426
lines changed

.github/workflows/dependencies.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
4343
# Exit with error if open and S-waiting-on-bors
4444
if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
45-
exit 1
45+
gh run cancel ${{ github.run_id }}
4646
fi
4747
4848
update:
@@ -65,7 +65,10 @@ jobs:
6565
6666
- name: cargo update
6767
# Remove first line that always just says "Updating crates.io index"
68-
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
68+
# If there are no changes, cancel the job here
69+
run: |
70+
cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
71+
git status --porcelain | grep -q Cargo.lock || gh run cancel ${{ github.run_id }}
6972
- name: upload Cargo.lock artifact for use in PR
7073
uses: actions/upload-artifact@v3
7174
with:
@@ -131,7 +134,7 @@ jobs:
131134
# Exit with error if PR is closed
132135
STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state')
133136
if [[ "$STATE" != "OPEN" ]]; then
134-
exit 1
137+
gh run cancel ${{ github.run_id }}
135138
fi
136139
137140
gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY

compiler/rustc_ast_lowering/src/block.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
8181
(self.arena.alloc_from_iter(stmts), expr)
8282
}
8383

84-
fn lower_local(&mut self, l: &Local) -> &'hir hir::Local<'hir> {
84+
fn lower_local(&mut self, l: &Local) -> &'hir hir::LetStmt<'hir> {
8585
let ty = l
8686
.ty
8787
.as_ref()
@@ -97,7 +97,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
9797
let span = self.lower_span(l.span);
9898
let source = hir::LocalSource::Normal;
9999
self.lower_attrs(hir_id, &l.attrs);
100-
self.arena.alloc(hir::Local { hir_id, ty, pat, init, els, span, source })
100+
self.arena.alloc(hir::LetStmt { hir_id, ty, pat, init, els, span, source })
101101
}
102102

103103
fn lower_block_check_mode(&mut self, b: &BlockCheckMode) -> hir::BlockCheckMode {

compiler/rustc_ast_lowering/src/index.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
302302
});
303303
}
304304

305-
fn visit_local(&mut self, l: &'hir Local<'hir>) {
306-
self.insert(l.span, l.hir_id, Node::Local(l));
305+
fn visit_local(&mut self, l: &'hir LetStmt<'hir>) {
306+
self.insert(l.span, l.hir_id, Node::LetStmt(l));
307307
self.with_parent(l.hir_id, |this| {
308308
intravisit::walk_local(this, l);
309309
})

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2341,7 +2341,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23412341
debug_assert!(!a.is_empty());
23422342
self.attrs.insert(hir_id.local_id, a);
23432343
}
2344-
let local = hir::Local {
2344+
let local = hir::LetStmt {
23452345
hir_id,
23462346
init,
23472347
pat,

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
622622

623623
// FIXME: We make sure that this is a normal top-level binding,
624624
// but we could suggest `todo!()` for all uninitalized bindings in the pattern pattern
625-
if let hir::StmtKind::Let(hir::Local { span, ty, init: None, pat, .. }) =
625+
if let hir::StmtKind::Let(hir::LetStmt { span, ty, init: None, pat, .. }) =
626626
&ex.kind
627627
&& let hir::PatKind::Binding(..) = pat.kind
628628
&& span.contains(self.decl_span)
@@ -800,7 +800,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
800800
for (_, node) in tcx.hir().parent_iter(expr.hir_id) {
801801
let e = match node {
802802
hir::Node::Expr(e) => e,
803-
hir::Node::Local(hir::Local { els: Some(els), .. }) => {
803+
hir::Node::LetStmt(hir::LetStmt { els: Some(els), .. }) => {
804804
let mut finder = BreakFinder { found_breaks: vec![], found_continues: vec![] };
805805
finder.visit_block(els);
806806
if !finder.found_breaks.is_empty() {
@@ -2124,7 +2124,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
21242124
hir::intravisit::walk_expr(self, e);
21252125
}
21262126

2127-
fn visit_local(&mut self, local: &'hir hir::Local<'hir>) {
2127+
fn visit_local(&mut self, local: &'hir hir::LetStmt<'hir>) {
21282128
if let hir::Pat { kind: hir::PatKind::Binding(_, hir_id, _ident, _), .. } =
21292129
local.pat
21302130
&& let Some(init) = local.init

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
558558
hir::intravisit::walk_stmt(self, stmt);
559559
let expr = match stmt.kind {
560560
hir::StmtKind::Semi(expr) | hir::StmtKind::Expr(expr) => expr,
561-
hir::StmtKind::Let(hir::Local { init: Some(expr), .. }) => expr,
561+
hir::StmtKind::Let(hir::LetStmt { init: Some(expr), .. }) => expr,
562562
_ => {
563563
return;
564564
}
@@ -737,7 +737,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
737737
&& let body = self.infcx.tcx.hir().body(body_id)
738738
&& let Some(hir_id) = (BindingFinder { span: pat_span }).visit_body(body).break_value()
739739
&& let node = self.infcx.tcx.hir_node(hir_id)
740-
&& let hir::Node::Local(hir::Local {
740+
&& let hir::Node::LetStmt(hir::LetStmt {
741741
pat: hir::Pat { kind: hir::PatKind::Ref(_, _), .. },
742742
..
743743
})
@@ -1170,7 +1170,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
11701170
};
11711171

11721172
if let Some(hir_id) = hir_id
1173-
&& let hir::Node::Local(local) = self.infcx.tcx.hir_node(hir_id)
1173+
&& let hir::Node::LetStmt(local) = self.infcx.tcx.hir_node(hir_id)
11741174
{
11751175
let tables = self.infcx.tcx.typeck(def_id.as_local().unwrap());
11761176
if let Some(clone_trait) = self.infcx.tcx.lang_items().clone_trait()

compiler/rustc_hir/src/hir.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ pub struct Stmt<'hir> {
12201220
#[derive(Debug, Clone, Copy, HashStable_Generic)]
12211221
pub enum StmtKind<'hir> {
12221222
/// A local (`let`) binding.
1223-
Let(&'hir Local<'hir>),
1223+
Let(&'hir LetStmt<'hir>),
12241224

12251225
/// An item binding.
12261226
Item(ItemId),
@@ -1234,7 +1234,7 @@ pub enum StmtKind<'hir> {
12341234

12351235
/// Represents a `let` statement (i.e., `let <pat>:<ty> = <init>;`).
12361236
#[derive(Debug, Clone, Copy, HashStable_Generic)]
1237-
pub struct Local<'hir> {
1237+
pub struct LetStmt<'hir> {
12381238
pub pat: &'hir Pat<'hir>,
12391239
/// Type annotation, if any (otherwise the type will be inferred).
12401240
pub ty: Option<&'hir Ty<'hir>>,
@@ -1264,7 +1264,7 @@ pub struct Arm<'hir> {
12641264
pub body: &'hir Expr<'hir>,
12651265
}
12661266

1267-
/// Represents a `let <pat>[: <ty>] = <expr>` expression (not a [`Local`]), occurring in an `if-let`
1267+
/// Represents a `let <pat>[: <ty>] = <expr>` expression (not a [`LetStmt`]), occurring in an `if-let`
12681268
/// or `let-else`, evaluating to a boolean. Typically the pattern is refutable.
12691269
///
12701270
/// In an `if let`, imagine it as `if (let <pat> = <expr>) { ... }`; in a let-else, it is part of
@@ -1861,7 +1861,7 @@ pub enum ExprKind<'hir> {
18611861
DropTemps(&'hir Expr<'hir>),
18621862
/// A `let $pat = $expr` expression.
18631863
///
1864-
/// These are not `Local` and only occur as expressions.
1864+
/// These are not [`LetStmt`] and only occur as expressions.
18651865
/// The `let Some(x) = foo()` in `if let Some(x) = foo()` is an example of `Let(..)`.
18661866
Let(&'hir LetExpr<'hir>),
18671867
/// An `if` block, with an optional else block.
@@ -3529,7 +3529,7 @@ pub enum Node<'hir> {
35293529
PatField(&'hir PatField<'hir>),
35303530
Arm(&'hir Arm<'hir>),
35313531
Block(&'hir Block<'hir>),
3532-
Local(&'hir Local<'hir>),
3532+
LetStmt(&'hir LetStmt<'hir>),
35333533
/// `Ctor` refers to the constructor of an enum variant or struct. Only tuple or unit variants
35343534
/// with synthesized constructors.
35353535
Ctor(&'hir VariantData<'hir>),
@@ -3585,7 +3585,7 @@ impl<'hir> Node<'hir> {
35853585
| Node::Ctor(..)
35863586
| Node::Pat(..)
35873587
| Node::Arm(..)
3588-
| Node::Local(..)
3588+
| Node::LetStmt(..)
35893589
| Node::Crate(..)
35903590
| Node::Ty(..)
35913591
| Node::TraitRef(..)
@@ -3757,7 +3757,7 @@ impl<'hir> Node<'hir> {
37573757
expect_pat_field, &'hir PatField<'hir>, Node::PatField(n), n;
37583758
expect_arm, &'hir Arm<'hir>, Node::Arm(n), n;
37593759
expect_block, &'hir Block<'hir>, Node::Block(n), n;
3760-
expect_local, &'hir Local<'hir>, Node::Local(n), n;
3760+
expect_let_stmt, &'hir LetStmt<'hir>, Node::LetStmt(n), n;
37613761
expect_ctor, &'hir VariantData<'hir>, Node::Ctor(n), n;
37623762
expect_lifetime, &'hir Lifetime, Node::Lifetime(n), n;
37633763
expect_generic_param, &'hir GenericParam<'hir>, Node::GenericParam(n), n;
@@ -3787,7 +3787,7 @@ mod size_asserts {
37873787
static_assert_size!(ImplItemKind<'_>, 40);
37883788
static_assert_size!(Item<'_>, 88);
37893789
static_assert_size!(ItemKind<'_>, 56);
3790-
static_assert_size!(Local<'_>, 64);
3790+
static_assert_size!(LetStmt<'_>, 64);
37913791
static_assert_size!(Param<'_>, 32);
37923792
static_assert_size!(Pat<'_>, 72);
37933793
static_assert_size!(Path<'_>, 40);

compiler/rustc_hir/src/intravisit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ pub trait Visitor<'v>: Sized {
320320
fn visit_foreign_item(&mut self, i: &'v ForeignItem<'v>) -> Self::Result {
321321
walk_foreign_item(self, i)
322322
}
323-
fn visit_local(&mut self, l: &'v Local<'v>) -> Self::Result {
323+
fn visit_local(&mut self, l: &'v LetStmt<'v>) -> Self::Result {
324324
walk_local(self, l)
325325
}
326326
fn visit_block(&mut self, b: &'v Block<'v>) -> Self::Result {
@@ -606,7 +606,7 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(
606606
V::Result::output()
607607
}
608608

609-
pub fn walk_local<'v, V: Visitor<'v>>(visitor: &mut V, local: &'v Local<'v>) -> V::Result {
609+
pub fn walk_local<'v, V: Visitor<'v>>(visitor: &mut V, local: &'v LetStmt<'v>) -> V::Result {
610610
// Intentionally visiting the expr first - the initialization expr
611611
// dominates the local's definition.
612612
visit_opt!(visitor, visit_expr, local.init);

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -639,10 +639,9 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
639639
}
640640
}
641641

642-
if !unnormalized_trait_sig.output().references_error() {
643-
debug_assert!(
644-
!collector.types.is_empty(),
645-
"expect >0 RPITITs in call to `collect_return_position_impl_trait_in_trait_tys`"
642+
if !unnormalized_trait_sig.output().references_error() && collector.types.is_empty() {
643+
tcx.dcx().delayed_bug(
644+
"expect >0 RPITITs in call to `collect_return_position_impl_trait_in_trait_tys`",
646645
);
647646
}
648647

compiler/rustc_hir_analysis/src/check/region.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_data_structures::fx::FxHashSet;
1111
use rustc_hir as hir;
1212
use rustc_hir::def_id::DefId;
1313
use rustc_hir::intravisit::{self, Visitor};
14-
use rustc_hir::{Arm, Block, Expr, Local, Pat, PatKind, Stmt};
14+
use rustc_hir::{Arm, Block, Expr, LetStmt, Pat, PatKind, Stmt};
1515
use rustc_index::Idx;
1616
use rustc_middle::middle::region::*;
1717
use rustc_middle::ty::TyCtxt;
@@ -123,7 +123,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
123123

124124
for (i, statement) in blk.stmts.iter().enumerate() {
125125
match statement.kind {
126-
hir::StmtKind::Let(hir::Local { els: Some(els), .. }) => {
126+
hir::StmtKind::Let(LetStmt { els: Some(els), .. }) => {
127127
// Let-else has a special lexical structure for variables.
128128
// First we take a checkpoint of the current scope context here.
129129
let mut prev_cx = visitor.cx;
@@ -855,7 +855,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
855855
fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
856856
resolve_expr(self, ex);
857857
}
858-
fn visit_local(&mut self, l: &'tcx Local<'tcx>) {
858+
fn visit_local(&mut self, l: &'tcx LetStmt<'tcx>) {
859859
resolve_local(self, Some(l.pat), l.init)
860860
}
861861
}

compiler/rustc_hir_pretty/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'a> State<'a> {
113113
// `hir_map` to reconstruct their full structure for pretty
114114
// printing.
115115
Node::Ctor(..) => panic!("cannot print isolated Ctor"),
116-
Node::Local(a) => self.print_local_decl(a),
116+
Node::LetStmt(a) => self.print_local_decl(a),
117117
Node::Crate(..) => panic!("cannot print Crate"),
118118
Node::WhereBoundPredicate(pred) => {
119119
self.print_formal_generic_params(pred.bound_generic_params);
@@ -1544,7 +1544,7 @@ impl<'a> State<'a> {
15441544
self.end()
15451545
}
15461546

1547-
fn print_local_decl(&mut self, loc: &hir::Local<'_>) {
1547+
fn print_local_decl(&mut self, loc: &hir::LetStmt<'_>) {
15481548
self.print_pat(loc.pat);
15491549
if let Some(ty) = loc.ty {
15501550
self.word_space(":");

compiler/rustc_hir_typeck/src/_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
408408
}
409409
}
410410
}
411-
if let hir::Node::Local(hir::Local { ty: Some(_), pat, .. }) = node {
411+
if let hir::Node::LetStmt(hir::LetStmt { ty: Some(_), pat, .. }) = node {
412412
return Some((pat.span, "expected because of this assignment".to_string()));
413413
}
414414
None

compiler/rustc_hir_typeck/src/demand.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
299299
return false;
300300
};
301301
let (init_ty_hir_id, init) = match self.tcx.parent_hir_node(pat.hir_id) {
302-
hir::Node::Local(hir::Local { ty: Some(ty), init, .. }) => (ty.hir_id, *init),
303-
hir::Node::Local(hir::Local { init: Some(init), .. }) => (init.hir_id, Some(*init)),
302+
hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), init, .. }) => (ty.hir_id, *init),
303+
hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) => (init.hir_id, Some(*init)),
304304
_ => return false,
305305
};
306306
let Some(init_ty) = self.node_ty_opt(init_ty_hir_id) else {
@@ -678,7 +678,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
678678
error: Option<TypeError<'tcx>>,
679679
) {
680680
match (self.tcx.parent_hir_node(expr.hir_id), error) {
681-
(hir::Node::Local(hir::Local { ty: Some(ty), init: Some(init), .. }), _)
681+
(hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), init: Some(init), .. }), _)
682682
if init.hir_id == expr.hir_id =>
683683
{
684684
// Point at `let` assignment type.
@@ -724,11 +724,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
724724
primary_span = pat.span;
725725
secondary_span = pat.span;
726726
match self.tcx.parent_hir_node(pat.hir_id) {
727-
hir::Node::Local(hir::Local { ty: Some(ty), .. }) => {
727+
hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), .. }) => {
728728
primary_span = ty.span;
729729
post_message = " type";
730730
}
731-
hir::Node::Local(hir::Local { init: Some(init), .. }) => {
731+
hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) => {
732732
primary_span = init.span;
733733
post_message = " value";
734734
}

compiler/rustc_hir_typeck/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14511451
});
14521452
let Some((
14531453
_,
1454-
hir::Node::Local(hir::Local { ty: Some(ty), .. })
1454+
hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), .. })
14551455
| hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _, _), .. }),
14561456
)) = parent_node
14571457
else {

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
371371

372372
fn walk_stmt(&mut self, stmt: &hir::Stmt<'_>) {
373373
match stmt.kind {
374-
hir::StmtKind::Let(hir::Local { pat, init: Some(expr), els, .. }) => {
374+
hir::StmtKind::Let(hir::LetStmt { pat, init: Some(expr), els, .. }) => {
375375
self.walk_local(expr, pat, *els, |_| {})
376376
}
377377

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16011601
}
16021602

16031603
/// Type check a `let` statement.
1604-
pub fn check_decl_local(&self, local: &'tcx hir::Local<'tcx>) {
1604+
pub fn check_decl_local(&self, local: &'tcx hir::LetStmt<'tcx>) {
16051605
self.check_decl(local.into());
16061606
if local.pat.is_never_pattern() {
16071607
self.diverges.set(Diverges::Always {
@@ -1789,7 +1789,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17891789
[
17901790
hir::Stmt {
17911791
kind:
1792-
hir::StmtKind::Let(hir::Local {
1792+
hir::StmtKind::Let(hir::LetStmt {
17931793
source:
17941794
hir::LocalSource::AssignDesugar(_),
17951795
..

0 commit comments

Comments
 (0)