Skip to content

Commit 4bbb318

Browse files
committed
API: Rename ExprKind::QuestionMark -> ExprKind::Try
1 parent 1774692 commit 4bbb318

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

marker_api/src/ast/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub enum ExprKind<'ast> {
6161
UnaryOp(&'ast UnaryOpExpr<'ast>),
6262
Ref(&'ast RefExpr<'ast>),
6363
BinaryOp(&'ast BinaryOpExpr<'ast>),
64-
QuestionMark(&'ast TryExpr<'ast>),
64+
Try(&'ast TryExpr<'ast>),
6565
Assign(&'ast AssignExpr<'ast>),
6666
As(&'ast AsExpr<'ast>),
6767
Path(&'ast PathExpr<'ast>),
@@ -180,7 +180,7 @@ pub enum ExprPrecedence {
180180
Fn = 0x1000_0000,
181181
Index = 0x1000_0001,
182182

183-
QuestionMark = 0x0F00_0000,
183+
Try = 0x0F00_0000,
184184

185185
/// The unary `-` operator
186186
Neg = 0x0E00_0000,
@@ -249,7 +249,7 @@ macro_rules! impl_expr_kind_fn {
249249
impl_expr_kind_fn!((ExprKind) $method() -> $return_ty,
250250
IntLit, FloatLit, StrLit, CharLit, BoolLit,
251251
Block, Closure,
252-
UnaryOp, Ref, BinaryOp, QuestionMark, As, Assign,
252+
UnaryOp, Ref, BinaryOp, Try, As, Assign,
253253
Path, Index, Field,
254254
Call, Method,
255255
Array, Tuple, Ctor, Range,

marker_api/src/ast/expr/op_exprs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl<'ast> TryExpr<'ast> {
189189
}
190190
}
191191

192-
super::impl_expr_data!(TryExpr<'ast>, QuestionMark);
192+
super::impl_expr_data!(TryExpr<'ast>, Try);
193193

194194
#[cfg(feature = "driver-api")]
195195
impl<'ast> TryExpr<'ast> {

marker_rustc_driver/src/conversion/marker/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
210210
ExprKind::Match(self.alloc(MatchExpr::new(data, self.to_expr(scrutinee), self.to_match_arms(arms))))
211211
},
212212
hir::ExprKind::Match(_scrutinee, [_early_return, _continue], hir::MatchSource::TryDesugar(_)) => {
213-
ExprKind::QuestionMark(self.alloc(self.to_try_expr_from_desugar(expr)))
213+
ExprKind::Try(self.alloc(self.to_try_expr_from_desugar(expr)))
214214
},
215215
hir::ExprKind::Match(_scrutinee, [_awaitee_arm], hir::MatchSource::AwaitDesugar) => {
216216
ExprKind::Await(self.alloc(self.to_await_expr_from_desugar(expr)))

marker_uilints/tests/ui/print_cond_expr.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ warning: print test
10181018
48 | let _print_option_match = x?;
10191019
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10201020
|
1021-
= note: QuestionMark(
1021+
= note: Try(
10221022
TryExpr {
10231023
data: CommonExprData {
10241024
_lifetime: PhantomData<&()>,
@@ -1063,7 +1063,7 @@ warning: print test
10631063
54 | let _print_result_match = x?;
10641064
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10651065
|
1066-
= note: QuestionMark(
1066+
= note: Try(
10671067
TryExpr {
10681068
data: CommonExprData {
10691069
_lifetime: PhantomData<&()>,

marker_utils/src/visitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ pub fn traverse_expr<'ast, B>(
248248
traverse_expr(cx, visitor, e.left())?;
249249
traverse_expr(cx, visitor, e.right())?;
250250
},
251-
ExprKind::QuestionMark(e) => {
251+
ExprKind::Try(e) => {
252252
traverse_expr(cx, visitor, e.expr())?;
253253
},
254254
ExprKind::Assign(e) => {
@@ -455,7 +455,7 @@ pub trait BoolTraversable<'ast>: Traversable<'ast, bool> {
455455
/// refactoring.
456456
fn contains_return(&self, cx: &'ast AstContext<'ast>) -> bool {
457457
self.for_each_expr(cx, |expr| {
458-
if matches!(expr, ExprKind::Return(_) | ExprKind::QuestionMark(_)) {
458+
if matches!(expr, ExprKind::Return(_) | ExprKind::Try(_)) {
459459
ControlFlow::Break(true)
460460
} else {
461461
ControlFlow::Continue(())

0 commit comments

Comments
 (0)