Skip to content

Commit

Permalink
Rename catch_expr feature to try_blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmcm committed Aug 19, 2018
1 parent 817efc2 commit 9f683be
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 17 deletions.
@@ -1,18 +1,18 @@
# `catch_expr`
# `try_blocks`

The tracking issue for this feature is: [#31436]

[#31436]: https://github.com/rust-lang/rust/issues/31436

------------------------

The `catch_expr` feature adds support for `try` blocks. A `try`
The `try_blocks` feature adds support for `try` blocks. A `try`
block creates a new scope one can use the `?` operator in.

```rust,ignore
// This code needs the 2018 edition
#![feature(catch_expr)]
#![feature(try_blocks)]
use std::num::ParseIntError;
Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Expand Up @@ -65,7 +65,6 @@
#![feature(trace_macros)]
#![feature(trusted_len)]
#![feature(vec_remove_item)]
#![feature(catch_expr)]
#![feature(step_trait)]
#![feature(integer_atomics)]
#![feature(test)]
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/feature_gate.rs
Expand Up @@ -331,7 +331,7 @@ declare_features! (
(active, abi_x86_interrupt, "1.17.0", Some(40180), None),

// Allows the `try {...}` expression
(active, catch_expr, "1.17.0", Some(31436), None),
(active, try_blocks, "1.29.0", Some(31436), None),

// Used to preserve symbols (see llvm.used)
(active, used, "1.18.0", Some(40289), None),
Expand Down Expand Up @@ -1735,7 +1735,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
"yield syntax is experimental");
}
ast::ExprKind::TryBlock(_) => {
gate_feature_post!(&self, catch_expr, e.span, "`try` expression is experimental");
gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental");
}
ast::ExprKind::IfLet(ref pats, ..) | ast::ExprKind::WhileLet(ref pats, ..) => {
if pats.len() > 1 {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/try-block-bad-lifetime.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: --edition 2018

#![feature(catch_expr)]
#![feature(try_blocks)]

// This test checks that borrows made and returned inside try blocks are properly constrained
pub fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/try-block-bad-type.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: --edition 2018

#![feature(catch_expr)]
#![feature(try_blocks)]

pub fn main() {
let res: Result<u32, i32> = try {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/try-block-in-match.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: --edition 2018

#![feature(catch_expr)]
#![feature(try_blocks)]

fn main() {
match try { false } { _ => {} } //~ ERROR expected expression, found reserved keyword `try`
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/try-block-in-while.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: --edition 2018

#![feature(catch_expr)]
#![feature(try_blocks)]

fn main() {
while try { false } {} //~ ERROR expected expression, found reserved keyword `try`
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/try-block-maybe-bad-lifetime.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: --edition 2018

#![feature(catch_expr)]
#![feature(try_blocks)]

// This test checks that borrows made and returned inside try blocks are properly constrained
pub fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/try-block-opt-init.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: --edition 2018

#![feature(catch_expr)]
#![feature(try_blocks)]

fn use_val<T: Sized>(_x: T) {}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-45124.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: --edition 2018

#![feature(catch_expr)]
#![feature(try_blocks)]

fn main() {
let mut a = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/try-block.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: --edition 2018

#![feature(catch_expr)]
#![feature(try_blocks)]

struct catch {}

Expand Down
@@ -1,5 +1,5 @@
error[E0658]: `try` expression is experimental (see issue #31436)
--> $DIR/feature-gate-catch_expr.rs:14:33
--> $DIR/feature-gate-try_blocks.rs:14:33
|
LL | let try_result: Option<_> = try { //~ ERROR `try` expression is experimental
| _________________________________^
Expand All @@ -8,7 +8,7 @@ LL | | x
LL | | };
| |_____^
|
= help: add #![feature(catch_expr)] to the crate attributes to enable
= help: add #![feature(try_blocks)] to the crate attributes to enable

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/try-block-type-error.rs
Expand Up @@ -10,7 +10,7 @@

// compile-flags: --edition 2018

#![feature(catch_expr)]
#![feature(try_blocks)]

fn foo() -> Option<()> { Some(()) }

Expand Down

0 comments on commit 9f683be

Please sign in to comment.