mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Rename Catch
variants to TryBlock
(Not `Try` since `QuestionMark` is using that.)
This commit is contained in:
parent
f28f648a96
commit
f2445fb507
@ -3613,10 +3613,10 @@ impl<'a> LoweringContext<'a> {
|
||||
hir::LoopSource::Loop,
|
||||
)
|
||||
}),
|
||||
ExprKind::Catch(ref body) => {
|
||||
ExprKind::TryBlock(ref body) => {
|
||||
self.with_catch_scope(body.id, |this| {
|
||||
let unstable_span =
|
||||
this.allow_internal_unstable(CompilerDesugaringKind::Catch, body.span);
|
||||
this.allow_internal_unstable(CompilerDesugaringKind::TryBlock, body.span);
|
||||
let mut block = this.lower_block(body, true).into_inner();
|
||||
let tail = block.expr.take().map_or_else(
|
||||
|| {
|
||||
|
@ -412,7 +412,7 @@ impl_stable_hash_for!(enum ::syntax_pos::hygiene::CompilerDesugaringKind {
|
||||
QuestionMark,
|
||||
ExistentialReturnType,
|
||||
ForLoop,
|
||||
Catch
|
||||
TryBlock
|
||||
});
|
||||
|
||||
impl_stable_hash_for!(enum ::syntax_pos::FileName {
|
||||
|
@ -987,7 +987,7 @@ impl Expr {
|
||||
ExprKind::Match(..) => ExprPrecedence::Match,
|
||||
ExprKind::Closure(..) => ExprPrecedence::Closure,
|
||||
ExprKind::Block(..) => ExprPrecedence::Block,
|
||||
ExprKind::Catch(..) => ExprPrecedence::Catch,
|
||||
ExprKind::TryBlock(..) => ExprPrecedence::TryBlock,
|
||||
ExprKind::Async(..) => ExprPrecedence::Async,
|
||||
ExprKind::Assign(..) => ExprPrecedence::Assign,
|
||||
ExprKind::AssignOp(..) => ExprPrecedence::AssignOp,
|
||||
@ -1108,8 +1108,8 @@ pub enum ExprKind {
|
||||
/// created during lowering cannot be made the parent of any other
|
||||
/// preexisting defs.
|
||||
Async(CaptureBy, NodeId, P<Block>),
|
||||
/// A catch block (`catch { ... }`)
|
||||
Catch(P<Block>),
|
||||
/// A try block (`try { ... }`)
|
||||
TryBlock(P<Block>),
|
||||
|
||||
/// An assignment (`a = foo()`)
|
||||
Assign(P<Expr>, P<Expr>),
|
||||
|
@ -1734,7 +1734,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
e.span,
|
||||
"yield syntax is experimental");
|
||||
}
|
||||
ast::ExprKind::Catch(_) => {
|
||||
ast::ExprKind::TryBlock(_) => {
|
||||
gate_feature_post!(&self, catch_expr, e.span, "`catch` expression is experimental");
|
||||
}
|
||||
ast::ExprKind::IfLet(ref pats, ..) | ast::ExprKind::WhileLet(ref pats, ..) => {
|
||||
|
@ -1351,7 +1351,7 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span, attrs}: Expr, folder: &mu
|
||||
}
|
||||
ExprKind::Yield(ex) => ExprKind::Yield(ex.map(|x| folder.fold_expr(x))),
|
||||
ExprKind::Try(ex) => ExprKind::Try(folder.fold_expr(ex)),
|
||||
ExprKind::Catch(body) => ExprKind::Catch(folder.fold_block(body)),
|
||||
ExprKind::TryBlock(body) => ExprKind::TryBlock(folder.fold_block(body)),
|
||||
},
|
||||
id: folder.new_id(id),
|
||||
span: folder.new_span(span),
|
||||
|
@ -31,7 +31,7 @@ pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool {
|
||||
ast::ExprKind::WhileLet(..) |
|
||||
ast::ExprKind::Loop(..) |
|
||||
ast::ExprKind::ForLoop(..) |
|
||||
ast::ExprKind::Catch(..) => false,
|
||||
ast::ExprKind::TryBlock(..) => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
@ -3458,7 +3458,7 @@ impl<'a> Parser<'a> {
|
||||
{
|
||||
let (iattrs, body) = self.parse_inner_attrs_and_block()?;
|
||||
attrs.extend(iattrs);
|
||||
Ok(self.mk_expr(span_lo.to(body.span), ExprKind::Catch(body), attrs))
|
||||
Ok(self.mk_expr(span_lo.to(body.span), ExprKind::TryBlock(body), attrs))
|
||||
}
|
||||
|
||||
// `match` token already eaten
|
||||
|
@ -2379,7 +2379,7 @@ impl<'a> State<'a> {
|
||||
self.print_expr_maybe_paren(e, parser::PREC_POSTFIX)?;
|
||||
self.s.word("?")?
|
||||
}
|
||||
ast::ExprKind::Catch(ref blk) => {
|
||||
ast::ExprKind::TryBlock(ref blk) => {
|
||||
self.head("do catch")?;
|
||||
self.s.space()?;
|
||||
self.print_block_with_attrs(blk, attrs)?
|
||||
|
@ -273,7 +273,7 @@ pub enum ExprPrecedence {
|
||||
Loop,
|
||||
Match,
|
||||
Block,
|
||||
Catch,
|
||||
TryBlock,
|
||||
Struct,
|
||||
Async,
|
||||
}
|
||||
@ -332,7 +332,7 @@ impl ExprPrecedence {
|
||||
ExprPrecedence::Loop |
|
||||
ExprPrecedence::Match |
|
||||
ExprPrecedence::Block |
|
||||
ExprPrecedence::Catch |
|
||||
ExprPrecedence::TryBlock |
|
||||
ExprPrecedence::Async |
|
||||
ExprPrecedence::Struct => PREC_PAREN,
|
||||
}
|
||||
|
@ -809,7 +809,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
|
||||
ExprKind::Try(ref subexpression) => {
|
||||
visitor.visit_expr(subexpression)
|
||||
}
|
||||
ExprKind::Catch(ref body) => {
|
||||
ExprKind::TryBlock(ref body) => {
|
||||
visitor.visit_block(body)
|
||||
}
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ impl ExpnFormat {
|
||||
#[derive(Clone, Copy, Hash, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)]
|
||||
pub enum CompilerDesugaringKind {
|
||||
QuestionMark,
|
||||
Catch,
|
||||
TryBlock,
|
||||
/// Desugaring of an `impl Trait` in return type position
|
||||
/// to an `existential type Foo: Trait;` + replacing the
|
||||
/// `impl Trait` with `Foo`.
|
||||
@ -609,7 +609,7 @@ impl CompilerDesugaringKind {
|
||||
Symbol::intern(match self {
|
||||
CompilerDesugaringKind::Async => "async",
|
||||
CompilerDesugaringKind::QuestionMark => "?",
|
||||
CompilerDesugaringKind::Catch => "do catch",
|
||||
CompilerDesugaringKind::TryBlock => "do catch",
|
||||
CompilerDesugaringKind::ExistentialReturnType => "existential type",
|
||||
CompilerDesugaringKind::ForLoop => "for loop",
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user