File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
tests/ui/stability-attribute Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ #![ crate_type = "lib" ]
4+ #![ feature( staged_api) ]
5+ #![ stable( feature = "stable_test_feature" , since = "3.3.3" ) ]
6+
7+ macro_rules! sign_dependent_expr {
8+ ( unsigned ? if unsigned { $unsigned_case: expr } if signed { $signed_case: expr } ) => {
9+ $unsigned_case
10+ } ;
11+ ( signed ? if unsigned { $unsigned_case: expr } if signed { $signed_case: expr } ) => {
12+ $signed_case
13+ } ;
14+ }
15+
16+ macro_rules! stable_feature {
17+ ( $signedness: ident) => {
18+ sign_dependent_expr! {
19+ $signedness ?
20+ if unsigned { "nonzero" }
21+ if signed { "signed_nonzero" }
22+ }
23+ } ;
24+ }
25+
26+ macro_rules! stable_since {
27+ ( $signedness: ident) => {
28+ sign_dependent_expr! {
29+ $signedness ?
30+ if unsigned { "1.28.0" }
31+ if signed { "1.34.0" }
32+ }
33+ } ;
34+ }
35+
36+ macro_rules! nonzero_integers {
37+ ( $( $signedness: ident $NonZero: ident( $primitive: ty) ) * ) => {
38+ $(
39+ #[ stable( feature = stable_feature!( $signedness) , since = stable_since!( $signedness) ) ]
40+ pub struct $NonZero( $primitive) ;
41+ ) *
42+ } ;
43+ }
44+
45+ nonzero_integers ! {
46+ unsigned NonZeroU8 ( u8 )
47+ unsigned NonZeroU16 ( u16 )
48+ unsigned NonZeroU32 ( u32 )
49+ unsigned NonZeroU64 ( u64 )
50+ signed NonZeroI8 ( u8 )
51+ signed NonZeroI16 ( u16 )
52+ signed NonZeroI32 ( u32 )
53+ signed NonZeroI64 ( u64 )
54+ }
You can’t perform that action at this time.
0 commit comments