]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-1937-termination-trait/termination-trait-in-test.rs
Rollup merge of #93112 - pietroalbini:pa-cve-2022-21658-nightly, r=pietroalbini
[rust.git] / src / test / ui / rfc-1937-termination-trait / termination-trait-in-test.rs
1 // compile-flags: --test
2 // run-pass
3 // needs-unwind
4
5 // ignore-wasm32-bare compiled with panic=abort by default
6
7 #![feature(test)]
8
9 extern crate test;
10 use std::num::ParseIntError;
11 use test::Bencher;
12
13 #[test]
14 fn is_a_num() -> Result<(), ParseIntError> {
15     let _: u32 = "22".parse()?;
16     Ok(())
17 }
18
19 #[bench]
20 fn test_a_positive_bench(_: &mut Bencher) -> Result<(), ParseIntError> {
21     Ok(())
22 }
23
24 #[bench]
25 #[should_panic]
26 fn test_a_neg_bench(_: &mut Bencher) -> Result<(), ParseIntError> {
27     let _: u32 = "abc".parse()?;
28     Ok(())
29 }