2015-01-22 14:33:46 -06:00
|
|
|
// Various checks that stability attributes are used correctly, per RFC 507
|
|
|
|
|
2021-05-07 11:56:16 -05:00
|
|
|
#![feature(staged_api)]
|
2015-01-22 14:33:46 -06:00
|
|
|
|
2015-11-16 10:54:28 -06:00
|
|
|
#![stable(feature = "rust1", since = "1.0.0")]
|
|
|
|
|
2015-01-22 14:33:46 -06:00
|
|
|
mod bogus_attribute_types_1 {
|
2023-10-16 15:11:26 -05:00
|
|
|
#[stable(feature = "a", since = "4.4.4", reason)] //~ ERROR unknown meta item 'reason' [E0541]
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f1() { }
|
|
|
|
|
2016-06-29 10:23:51 -05:00
|
|
|
#[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539]
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f2() { }
|
|
|
|
|
2023-10-16 15:11:26 -05:00
|
|
|
#[stable(feature, since = "3.3.3")] //~ ERROR incorrect meta item [E0539]
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f3() { }
|
|
|
|
|
2016-06-29 10:23:51 -05:00
|
|
|
#[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539]
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f5() { }
|
|
|
|
|
2023-10-16 15:11:26 -05:00
|
|
|
#[stable(feature(b), since = "3.3.3")] //~ ERROR incorrect meta item [E0539]
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f6() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_feature_names {
|
2019-12-21 05:16:18 -06:00
|
|
|
#[unstable(issue = "none")] //~ ERROR missing 'feature' [E0546]
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f1() { }
|
|
|
|
|
2018-07-23 06:22:23 -05:00
|
|
|
#[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547]
|
2015-10-12 22:01:31 -05:00
|
|
|
fn f2() { }
|
2015-08-13 15:06:25 -05:00
|
|
|
|
2023-10-16 15:11:26 -05:00
|
|
|
#[stable(since = "3.3.3")] //~ ERROR missing 'feature' [E0546]
|
2015-08-13 15:06:25 -05:00
|
|
|
fn f3() { }
|
2015-01-22 14:33:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_version {
|
2016-06-29 10:23:51 -05:00
|
|
|
#[stable(feature = "a")] //~ ERROR missing 'since' [E0542]
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f1() { }
|
|
|
|
|
2023-10-16 15:11:26 -05:00
|
|
|
#[stable(feature = "a", since = "4.4.4")]
|
2022-03-04 20:59:18 -06:00
|
|
|
#[deprecated(note = "a")] //~ ERROR missing 'since' [E0542]
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f2() { }
|
2019-09-26 06:24:41 -05:00
|
|
|
|
2023-10-16 15:11:26 -05:00
|
|
|
#[stable(feature = "a", since = "4.4.4")]
|
2023-10-30 00:25:13 -05:00
|
|
|
#[deprecated(since = "5.5.5")] //~ ERROR missing 'note' [E0543]
|
2019-09-26 06:24:41 -05:00
|
|
|
fn f3() { }
|
2015-01-22 14:33:46 -06:00
|
|
|
}
|
|
|
|
|
2019-12-21 05:16:18 -06:00
|
|
|
#[unstable(feature = "b", issue = "none")]
|
2023-10-16 15:11:26 -05:00
|
|
|
#[stable(feature = "a", since = "4.4.4")] //~ ERROR multiple stability levels [E0544]
|
2016-06-29 10:23:51 -05:00
|
|
|
fn multiple1() { }
|
2015-01-22 14:33:46 -06:00
|
|
|
|
2019-12-21 05:16:18 -06:00
|
|
|
#[unstable(feature = "b", issue = "none")]
|
|
|
|
#[unstable(feature = "b", issue = "none")] //~ ERROR multiple stability levels [E0544]
|
2016-06-29 10:23:51 -05:00
|
|
|
fn multiple2() { }
|
2015-01-22 14:33:46 -06:00
|
|
|
|
2023-10-16 15:11:26 -05:00
|
|
|
#[stable(feature = "a", since = "4.4.4")]
|
|
|
|
#[stable(feature = "a", since = "4.4.4")] //~ ERROR multiple stability levels [E0544]
|
2016-06-29 10:23:51 -05:00
|
|
|
fn multiple3() { }
|
2015-01-22 14:33:46 -06:00
|
|
|
|
2023-10-16 15:11:26 -05:00
|
|
|
#[stable(feature = "e", since = "b")] //~ ERROR 'since' must be a Rust version number, such as "1.31.0"
|
2023-10-30 00:25:13 -05:00
|
|
|
#[deprecated(since = "5.5.5", note = "text")]
|
|
|
|
#[deprecated(since = "5.5.5", note = "text")] //~ ERROR multiple `deprecated` attributes
|
2019-12-21 05:16:18 -06:00
|
|
|
#[rustc_const_unstable(feature = "c", issue = "none")]
|
|
|
|
#[rustc_const_unstable(feature = "d", issue = "none")] //~ ERROR multiple stability levels
|
2023-10-24 01:11:53 -05:00
|
|
|
pub const fn multiple4() { }
|
2020-12-09 17:26:42 -06:00
|
|
|
|
2023-10-26 12:14:29 -05:00
|
|
|
#[stable(feature = "a", since = "1.0.0")] //~ ERROR feature `a` is declared stable since 1.0.0
|
|
|
|
#[deprecated(since = "invalid", note = "text")] //~ ERROR 'since' must be a Rust version number, such as "1.31.0"
|
2021-02-10 23:35:27 -06:00
|
|
|
fn invalid_deprecation_version() {}
|
2015-01-22 14:33:46 -06:00
|
|
|
|
2023-10-30 00:25:13 -05:00
|
|
|
#[deprecated(since = "5.5.5", note = "text")]
|
2016-06-29 10:23:51 -05:00
|
|
|
fn deprecated_without_unstable_or_stable() { }
|
2022-03-04 20:59:18 -06:00
|
|
|
//~^^ ERROR deprecated attribute must be paired with either stable or unstable attribute
|
2015-01-22 14:33:46 -06:00
|
|
|
|
|
|
|
fn main() { }
|