mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
parent
73bde2f0ce
commit
8645ac4218
@ -518,6 +518,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
"type ascription is experimental");
|
||||
}
|
||||
}
|
||||
ast::ExprKind::TryBlock(_) => {
|
||||
gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental");
|
||||
}
|
||||
ast::ExprKind::Block(_, opt_label) => {
|
||||
if let Some(label) = opt_label {
|
||||
gate_feature_post!(&self, label_break_value, label.ident.span,
|
||||
|
@ -1,12 +1,9 @@
|
||||
// compile-flags: --edition 2018
|
||||
|
||||
#[cfg(FALSE)]
|
||||
fn foo() {
|
||||
let try_result: Option<_> = try { //~ ERROR `try` blocks are unstable
|
||||
pub fn main() {
|
||||
let try_result: Option<_> = try { //~ ERROR `try` expression is experimental
|
||||
let x = 5;
|
||||
x
|
||||
};
|
||||
assert_eq!(try_result, Some(5));
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0658]: `try` blocks are unstable
|
||||
--> $DIR/feature-gate-try_blocks.rs:5:33
|
||||
error[E0658]: `try` expression is experimental
|
||||
--> $DIR/feature-gate-try_blocks.rs:4:33
|
||||
|
|
||||
LL | let try_result: Option<_> = try {
|
||||
| _________________________________^
|
||||
|
Loading…
Reference in New Issue
Block a user