Skip to content

Commit 9f683be

Browse files
committed
Rename catch_expr feature to try_blocks
1 parent 817efc2 commit 9f683be

14 files changed

+16
-17
lines changed

src/doc/unstable-book/src/language-features/catch-expr.md renamed to src/doc/unstable-book/src/language-features/try-blocks.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# `catch_expr`
1+
# `try_blocks`
22

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

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

77
------------------------
88

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

1212
```rust,ignore
1313
// This code needs the 2018 edition
1414
15-
#![feature(catch_expr)]
15+
#![feature(try_blocks)]
1616
1717
use std::num::ParseIntError;
1818

src/librustc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
#![feature(trace_macros)]
6666
#![feature(trusted_len)]
6767
#![feature(vec_remove_item)]
68-
#![feature(catch_expr)]
6968
#![feature(step_trait)]
7069
#![feature(integer_atomics)]
7170
#![feature(test)]

src/libsyntax/feature_gate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ declare_features! (
331331
(active, abi_x86_interrupt, "1.17.0", Some(40180), None),
332332

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

336336
// Used to preserve symbols (see llvm.used)
337337
(active, used, "1.18.0", Some(40289), None),
@@ -1735,7 +1735,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
17351735
"yield syntax is experimental");
17361736
}
17371737
ast::ExprKind::TryBlock(_) => {
1738-
gate_feature_post!(&self, catch_expr, e.span, "`try` expression is experimental");
1738+
gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental");
17391739
}
17401740
ast::ExprKind::IfLet(ref pats, ..) | ast::ExprKind::WhileLet(ref pats, ..) => {
17411741
if pats.len() > 1 {

src/test/compile-fail/try-block-bad-lifetime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// compile-flags: --edition 2018
1212

13-
#![feature(catch_expr)]
13+
#![feature(try_blocks)]
1414

1515
// This test checks that borrows made and returned inside try blocks are properly constrained
1616
pub fn main() {

src/test/compile-fail/try-block-bad-type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// compile-flags: --edition 2018
1212

13-
#![feature(catch_expr)]
13+
#![feature(try_blocks)]
1414

1515
pub fn main() {
1616
let res: Result<u32, i32> = try {

src/test/compile-fail/try-block-in-match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// compile-flags: --edition 2018
1212

13-
#![feature(catch_expr)]
13+
#![feature(try_blocks)]
1414

1515
fn main() {
1616
match try { false } { _ => {} } //~ ERROR expected expression, found reserved keyword `try`

src/test/compile-fail/try-block-in-while.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// compile-flags: --edition 2018
1212

13-
#![feature(catch_expr)]
13+
#![feature(try_blocks)]
1414

1515
fn main() {
1616
while try { false } {} //~ ERROR expected expression, found reserved keyword `try`

src/test/compile-fail/try-block-maybe-bad-lifetime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// compile-flags: --edition 2018
1212

13-
#![feature(catch_expr)]
13+
#![feature(try_blocks)]
1414

1515
// This test checks that borrows made and returned inside try blocks are properly constrained
1616
pub fn main() {

src/test/compile-fail/try-block-opt-init.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// compile-flags: --edition 2018
1212

13-
#![feature(catch_expr)]
13+
#![feature(try_blocks)]
1414

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

src/test/run-pass/issue-45124.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// compile-flags: --edition 2018
1212

13-
#![feature(catch_expr)]
13+
#![feature(try_blocks)]
1414

1515
fn main() {
1616
let mut a = 0;

src/test/run-pass/try-block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// compile-flags: --edition 2018
1212

13-
#![feature(catch_expr)]
13+
#![feature(try_blocks)]
1414

1515
struct catch {}
1616

src/test/ui/feature-gates/feature-gate-catch_expr.stderr renamed to src/test/ui/feature-gates/feature-gate-try_blocks.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: `try` expression is experimental (see issue #31436)
2-
--> $DIR/feature-gate-catch_expr.rs:14:33
2+
--> $DIR/feature-gate-try_blocks.rs:14:33
33
|
44
LL | let try_result: Option<_> = try { //~ ERROR `try` expression is experimental
55
| _________________________________^
@@ -8,7 +8,7 @@ LL | | x
88
LL | | };
99
| |_____^
1010
|
11-
= help: add #![feature(catch_expr)] to the crate attributes to enable
11+
= help: add #![feature(try_blocks)] to the crate attributes to enable
1212

1313
error: aborting due to previous error
1414

src/test/ui/try-block-type-error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// compile-flags: --edition 2018
1212

13-
#![feature(catch_expr)]
13+
#![feature(try_blocks)]
1414

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

0 commit comments

Comments
 (0)