Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 2 Packages Projects Releases Wiki Activity
Files
51b51b51d7931da85280382a81c4dd80c73ca754
rust/tests/ui/try-block/issue-45124.rs

19 lines
305 B
Rust
Raw Normal View History

[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives
2024-02-16 20:02:50 +00:00
//@ run-pass
Add `#![allow(..)]` as necessary to get re-migrated run-pass tests compiling with clean stderr again. Most were added mechanically.
2018-09-25 23:51:35 +02:00
#![allow(unreachable_code)]
[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives
2024-02-16 20:02:50 +00:00
//@ compile-flags: --edition 2018
Parse try blocks with the try keyword instead of do catch placeholder
2018-07-21 20:59:44 -07:00
Rename `catch_expr` feature to `try_blocks`
2018-07-24 18:03:25 -07:00
#![feature(try_blocks)]
Mark block exits as reachable if the block can break.
2017-10-15 21:18:08 -07:00
fn main() {
let mut a = 0;
let () = {
Parse try blocks with the try keyword instead of do catch placeholder
2018-07-21 20:59:44 -07:00
let _: Result<(), ()> = try {
Adjust UI tests for `unit_bindings` - Either explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Fix disjoint-capture-in-same-closure test
2023-06-12 16:55:36 +08:00
let () = Err(())?;
Mark block exits as reachable if the block can break.
2017-10-15 21:18:08 -07:00
return
};
a += 1;
};
a += 2;
assert_eq!(a, 3);
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 4479ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API