summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_mir_build/src/build/custom
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /compiler/rustc_mir_build/src/build/custom
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_mir_build/src/build/custom')
-rw-r--r--compiler/rustc_mir_build/src/build/custom/parse.rs6
-rw-r--r--compiler/rustc_mir_build/src/build/custom/parse/instruction.rs31
2 files changed, 17 insertions, 20 deletions
diff --git a/compiler/rustc_mir_build/src/build/custom/parse.rs b/compiler/rustc_mir_build/src/build/custom/parse.rs
index 803207d9d..60c4a0416 100644
--- a/compiler/rustc_mir_build/src/build/custom/parse.rs
+++ b/compiler/rustc_mir_build/src/build/custom/parse.rs
@@ -74,7 +74,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
kind @ StmtKind::Let { pattern, .. } => {
return Err(ParseError {
span: pattern.span,
- item_description: format!("{:?}", kind),
+ item_description: format!("{kind:?}"),
expected: "expression".to_string(),
});
}
@@ -241,9 +241,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
});
}
- let Some(trailing) = block.expr else {
- return Err(self.expr_error(expr_id, "terminator"))
- };
+ let Some(trailing) = block.expr else { return Err(self.expr_error(expr_id, "terminator")) };
let span = self.thir[trailing].span;
let terminator = self.parse_terminator(trailing)?;
data.terminator = Some(Terminator {
diff --git a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs
index 4cb9d7bab..26662f5de 100644
--- a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs
+++ b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs
@@ -61,11 +61,9 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
})
},
@call("mir_call", args) => {
- let destination = self.parse_place(args[0])?;
- let target = self.parse_block(args[1])?;
- self.parse_call(args[2], destination, target)
+ self.parse_call(args)
},
- ExprKind::Match { scrutinee, arms } => {
+ ExprKind::Match { scrutinee, arms, .. } => {
let discr = self.parse_operand(*scrutinee)?;
self.parse_match(arms, expr.span).map(|t| TerminatorKind::SwitchInt { discr, targets: t })
},
@@ -78,7 +76,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
span,
item_description: "no arms".to_string(),
expected: "at least one arm".to_string(),
- })
+ });
};
let otherwise = &self.thir[*otherwise];
@@ -87,7 +85,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
span: otherwise.span,
item_description: format!("{:?}", otherwise.pattern.kind),
expected: "wildcard pattern".to_string(),
- })
+ });
};
let otherwise = self.parse_block(otherwise.body)?;
@@ -100,7 +98,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
span: arm.pattern.span,
item_description: format!("{:?}", arm.pattern.kind),
expected: "constant pattern".to_string(),
- })
+ });
};
values.push(value.eval_bits(self.tcx, self.param_env, arm.pattern.ty));
targets.push(self.parse_block(arm.body)?);
@@ -109,13 +107,14 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
Ok(SwitchTargets::new(values.into_iter().zip(targets), otherwise))
}
- fn parse_call(
- &self,
- expr_id: ExprId,
- destination: Place<'tcx>,
- target: BasicBlock,
- ) -> PResult<TerminatorKind<'tcx>> {
- parse_by_kind!(self, expr_id, _, "function call",
+ fn parse_call(&self, args: &[ExprId]) -> PResult<TerminatorKind<'tcx>> {
+ let (destination, call) = parse_by_kind!(self, args[0], _, "function call",
+ ExprKind::Assign { lhs, rhs } => (*lhs, *rhs),
+ );
+ let destination = self.parse_place(destination)?;
+ let target = self.parse_block(args[1])?;
+
+ parse_by_kind!(self, call, _, "function call",
ExprKind::Call { fun, args, from_hir_call, fn_span, .. } => {
let fun = self.parse_operand(*fun)?;
let args = args
@@ -192,12 +191,12 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
fields.iter().map(|e| self.parse_operand(*e)).collect::<Result<_, _>>()?
))
},
- ExprKind::Adt(box AdtExpr{ adt_def, variant_index, substs, fields, .. }) => {
+ ExprKind::Adt(box AdtExpr{ adt_def, variant_index, args, fields, .. }) => {
let is_union = adt_def.is_union();
let active_field_index = is_union.then(|| fields[0].name);
Ok(Rvalue::Aggregate(
- Box::new(AggregateKind::Adt(adt_def.did(), *variant_index, substs, None, active_field_index)),
+ Box::new(AggregateKind::Adt(adt_def.did(), *variant_index, args, None, active_field_index)),
fields.iter().map(|f| self.parse_operand(f.expr)).collect::<Result<_, _>>()?
))
},