Rename catch_expr feature to try_blocks

This commit is contained in:
Scott McMurray 2018-07-24 18:03:25 -07:00
parent 817efc2489
commit 9f683bed3d
14 changed files with 16 additions and 17 deletions

View File

@ -1,4 +1,4 @@
# `catch_expr`
# `try_blocks`
The tracking issue for this feature is: [#31436]
@ -6,13 +6,13 @@ The tracking issue for this feature is: [#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;

View File

@ -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)]

View File

@ -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),
@ -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 {

View File

@ -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() {

View File

@ -10,7 +10,7 @@
// compile-flags: --edition 2018
#![feature(catch_expr)]
#![feature(try_blocks)]
pub fn main() {
let res: Result<u32, i32> = try {

View File

@ -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`

View File

@ -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`

View File

@ -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() {

View File

@ -10,7 +10,7 @@
// compile-flags: --edition 2018
#![feature(catch_expr)]
#![feature(try_blocks)]
fn use_val<T: Sized>(_x: T) {}

View File

@ -10,7 +10,7 @@
// compile-flags: --edition 2018
#![feature(catch_expr)]
#![feature(try_blocks)]
fn main() {
let mut a = 0;

View File

@ -10,7 +10,7 @@
// compile-flags: --edition 2018
#![feature(catch_expr)]
#![feature(try_blocks)]
struct catch {}

View File

@ -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
| _________________________________^
@ -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

View File

@ -10,7 +10,7 @@
// compile-flags: --edition 2018
#![feature(catch_expr)]
#![feature(try_blocks)]
fn foo() -> Option<()> { Some(()) }