许杰友 Jieyou Xu (Joe) | ec2cc76 | 2024-02-16 20:02:50 | [diff] [blame] | 1 | //@ run-pass |
Vadim Petrochenkov | ca9faa5 | 2019-07-26 21:54:25 | [diff] [blame] | 2 | |
Felix S. Klock II | c9f2c2d | 2018-09-14 10:20:28 | [diff] [blame] | 3 | #![allow(unused_must_use)] |
4 | #![allow(dead_code)] | ||||
Ahmed Charles | 6fbff4f | 2016-08-13 09:41:43 | [diff] [blame] | 5 | #![allow(path_statements)] |
Manish Goregaokar | 713e875 | 2014-04-14 15:30:31 | [diff] [blame] | 6 | #![allow(unreachable_code)] |
Ahmed Charles | 6fbff4f | 2016-08-13 09:41:43 | [diff] [blame] | 7 | #![allow(unused_variables)] |
Matthew Jasper | b491402 | 2023-09-18 15:18:51 | [diff] [blame] | 8 | #![feature(if_let_guard)] |
Tim Chevalier | c8ea9fc | 2012-07-26 21:47:05 | [diff] [blame] | 9 | |
Matthew Jasper | b491402 | 2023-09-18 15:18:51 | [diff] [blame] | 10 | fn id(x: bool) -> bool { |
11 | x | ||||
12 | } | ||||
Tim Chevalier | c8ea9fc | 2012-07-26 21:47:05 | [diff] [blame] | 13 | |
14 | fn call_id() { | ||||
Steve Klabnik | 7828c3d | 2014-10-09 19:17:22 | [diff] [blame] | 15 | let c = panic!(); |
Tim Chevalier | c8ea9fc | 2012-07-26 21:47:05 | [diff] [blame] | 16 | id(c); |
17 | } | ||||
18 | |||||
Matthew Jasper | b491402 | 2023-09-18 15:18:51 | [diff] [blame] | 19 | fn call_id_2() { |
20 | id(true) && id(return); | ||||
21 | } | ||||
Tim Chevalier | c8ea9fc | 2012-07-26 21:47:05 | [diff] [blame] | 22 | |
Matthew Jasper | b491402 | 2023-09-18 15:18:51 | [diff] [blame] | 23 | fn call_id_3() { |
24 | id(return) && id(return); | ||||
25 | } | ||||
Tim Chevalier | c8ea9fc | 2012-07-26 21:47:05 | [diff] [blame] | 26 | |
Tim Chevalier | c8ea9fc | 2012-07-26 21:47:05 | [diff] [blame] | 27 | fn ret_guard() { |
Tobias Bucher | 7f64fe4 | 2015-01-25 21:05:03 | [diff] [blame] | 28 | match 2 { |
Brian Anderson | 025d866 | 2012-08-04 02:59:04 | [diff] [blame] | 29 | x if (return) => { x; } |
Matthew Jasper | b491402 | 2023-09-18 15:18:51 | [diff] [blame] | 30 | x if let true = return => { x; } |
Brian Anderson | 025d866 | 2012-08-04 02:59:04 | [diff] [blame] | 31 | _ => {} |
Tim Chevalier | c8ea9fc | 2012-07-26 21:47:05 | [diff] [blame] | 32 | } |
33 | } | ||||
34 | |||||
Graydon Hoare | 89c8ef7 | 2013-02-02 03:43:17 | [diff] [blame] | 35 | pub fn main() {} |