Skip to content

Commit 8645ac4

Browse files
committed
Revert "pre-expansion gate try_blocks"
This reverts commit 1935ba6.
1 parent 73bde2f commit 8645ac4

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/libsyntax/feature_gate/check.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
518518
"type ascription is experimental");
519519
}
520520
}
521+
ast::ExprKind::TryBlock(_) => {
522+
gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental");
523+
}
521524
ast::ExprKind::Block(_, opt_label) => {
522525
if let Some(label) = opt_label {
523526
gate_feature_post!(&self, label_break_value, label.ident.span,
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
// compile-flags: --edition 2018
22

3-
#[cfg(FALSE)]
4-
fn foo() {
5-
let try_result: Option<_> = try { //~ ERROR `try` blocks are unstable
3+
pub fn main() {
4+
let try_result: Option<_> = try { //~ ERROR `try` expression is experimental
65
let x = 5;
76
x
87
};
98
assert_eq!(try_result, Some(5));
109
}
11-
12-
fn main() {}

src/test/ui/feature-gates/feature-gate-try_blocks.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
error[E0658]: `try` blocks are unstable
2-
--> $DIR/feature-gate-try_blocks.rs:5:33
1+
error[E0658]: `try` expression is experimental
2+
--> $DIR/feature-gate-try_blocks.rs:4:33
33
|
44
LL | let try_result: Option<_> = try {
55
| _________________________________^

0 commit comments

Comments
 (0)