Skip to content

Commit 5ea6668

Browse files
committed
Auto merge of rust-lang#113102 - matthiaskrgr:rollup-wpkbsw1, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#112518 (Detect actual span for getting unexpected token from parsing macros) - rust-lang#112978 (Add suggestion for bad block fragment error) - rust-lang#113068 (bootstrap: rename 'user' profile to 'dist') - rust-lang#113079 (Use `CoverageKind::as_operand_id` instead of manually reimplementing it) - rust-lang#113089 (Export AnalysisResults trait in rustc_mir_dataflow) - rust-lang#113093 (`thir`: Add `Become` expression kind) - rust-lang#113096 (Remove unused struct and tweak format macro uses) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3c554f5 + adc3ae2 commit 5ea6668

File tree

30 files changed

+143
-50
lines changed

30 files changed

+143
-50
lines changed

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ pub struct ForbiddenLifetimeBound {
7777
pub spans: Vec<Span>,
7878
}
7979

80-
#[derive(Diagnostic)]
81-
#[diag(ast_passes_forbidden_non_lifetime_param)]
82-
pub struct ForbiddenNonLifetimeParam {
83-
#[primary_span]
84-
pub spans: Vec<Span>,
85-
}
86-
8780
#[derive(Diagnostic)]
8881
#[diag(ast_passes_fn_param_too_many)]
8982
pub struct FnParamTooMany {

compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
139139
tcx,
140140
generics,
141141
diag,
142-
&format!("{}", proj.self_ty()),
142+
&proj.self_ty().to_string(),
143143
&path,
144144
None,
145145
matching_span,
@@ -153,7 +153,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
153153
tcx,
154154
generics,
155155
diag,
156-
&format!("{}", proj.self_ty()),
156+
&proj.self_ty().to_string(),
157157
&path,
158158
None,
159159
matching_span,

compiler/rustc_middle/src/thir.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ pub enum ExprKind<'tcx> {
410410
Return {
411411
value: Option<ExprId>,
412412
},
413+
/// A `become` expression.
414+
Become {
415+
value: ExprId,
416+
},
413417
/// An inline `const` block, e.g. `const {}`.
414418
ConstBlock {
415419
did: DefId,

compiler/rustc_middle/src/thir/visit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Exp
100100
visitor.visit_expr(&visitor.thir()[value])
101101
}
102102
}
103+
Become { value } => visitor.visit_expr(&visitor.thir()[value]),
103104
ConstBlock { did: _, substs: _ } => {}
104105
Repeat { value, count: _ } => {
105106
visitor.visit_expr(&visitor.thir()[value]);

compiler/rustc_mir_build/src/build/expr/as_place.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
549549
| ExprKind::Break { .. }
550550
| ExprKind::Continue { .. }
551551
| ExprKind::Return { .. }
552+
| ExprKind::Become { .. }
552553
| ExprKind::Literal { .. }
553554
| ExprKind::NamedConst { .. }
554555
| ExprKind::NonHirLiteral { .. }

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
532532
| ExprKind::Break { .. }
533533
| ExprKind::Continue { .. }
534534
| ExprKind::Return { .. }
535+
| ExprKind::Become { .. }
535536
| ExprKind::InlineAsm { .. }
536537
| ExprKind::PlaceTypeAscription { .. }
537538
| ExprKind::ValueTypeAscription { .. } => {

compiler/rustc_mir_build/src/build/expr/category.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ impl Category {
8282
| ExprKind::Block { .. }
8383
| ExprKind::Break { .. }
8484
| ExprKind::Continue { .. }
85-
| ExprKind::Return { .. } =>
85+
| ExprKind::Return { .. }
86+
| ExprKind::Become { .. } =>
8687
// FIXME(#27840) these probably want their own
8788
// category, like "nonterminating"
8889
{

compiler/rustc_mir_build/src/build/expr/into.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
493493
block.unit()
494494
}
495495

496-
ExprKind::Continue { .. } | ExprKind::Break { .. } | ExprKind::Return { .. } => {
496+
ExprKind::Continue { .. }
497+
| ExprKind::Break { .. }
498+
| ExprKind::Return { .. }
499+
| ExprKind::Become { .. } => {
497500
unpack!(block = this.stmt_expr(block, expr, None));
498501
// No assign, as these have type `!`.
499502
block.unit()

compiler/rustc_mir_build/src/build/expr/stmt.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
9999
BreakableTarget::Return,
100100
source_info,
101101
),
102+
// FIXME(explicit_tail_calls): properly lower tail calls here
103+
ExprKind::Become { value } => this.break_scope(
104+
block,
105+
Some(&this.thir[value]),
106+
BreakableTarget::Return,
107+
source_info,
108+
),
102109
_ => {
103110
assert!(
104111
statement_scope.is_some(),

compiler/rustc_mir_build/src/check_unsafety.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
316316
| ExprKind::Closure { .. }
317317
| ExprKind::Continue { .. }
318318
| ExprKind::Return { .. }
319+
| ExprKind::Become { .. }
319320
| ExprKind::Yield { .. }
320321
| ExprKind::Loop { .. }
321322
| ExprKind::Let { .. }

0 commit comments

Comments
 (0)