2015-01-22 12:33:46 -08:00
|
|
|
// Various checks that stability attributes are used correctly, per RFC 507
|
|
|
|
|
2019-12-04 22:00:28 +01:00
|
|
|
#![feature(const_fn, staged_api)]
|
2015-01-22 12:33:46 -08:00
|
|
|
|
2015-11-16 19:54:28 +03:00
|
|
|
#![stable(feature = "rust1", since = "1.0.0")]
|
|
|
|
|
2015-01-22 12:33:46 -08:00
|
|
|
mod bogus_attribute_types_1 {
|
2018-07-23 12:22:23 +01:00
|
|
|
#[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541]
|
2015-01-22 12:33:46 -08:00
|
|
|
fn f1() { }
|
|
|
|
|
2016-06-29 17:23:51 +02:00
|
|
|
#[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539]
|
2015-01-22 12:33:46 -08:00
|
|
|
fn f2() { }
|
|
|
|
|
2016-06-29 17:23:51 +02:00
|
|
|
#[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539]
|
2015-01-22 12:33:46 -08:00
|
|
|
fn f3() { }
|
|
|
|
|
2016-06-29 17:23:51 +02:00
|
|
|
#[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539]
|
2015-01-22 12:33:46 -08:00
|
|
|
fn f5() { }
|
|
|
|
|
2016-06-29 17:23:51 +02:00
|
|
|
#[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539]
|
2015-01-22 12:33:46 -08:00
|
|
|
fn f6() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_feature_names {
|
2019-12-21 13:16:18 +02:00
|
|
|
#[unstable(issue = "none")] //~ ERROR missing 'feature' [E0546]
|
2015-01-22 12:33:46 -08:00
|
|
|
fn f1() { }
|
|
|
|
|
2018-07-23 12:22:23 +01:00
|
|
|
#[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547]
|
2015-10-13 06:01:31 +03:00
|
|
|
fn f2() { }
|
2015-08-13 13:06:25 -07:00
|
|
|
|
2016-06-29 17:23:51 +02:00
|
|
|
#[stable(since = "a")] //~ ERROR missing 'feature' [E0546]
|
2015-08-13 13:06:25 -07:00
|
|
|
fn f3() { }
|
2015-01-22 12:33:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_version {
|
2016-06-29 17:23:51 +02:00
|
|
|
#[stable(feature = "a")] //~ ERROR missing 'since' [E0542]
|
2015-01-22 12:33:46 -08:00
|
|
|
fn f1() { }
|
|
|
|
|
|
|
|
#[stable(feature = "a", since = "b")]
|
2016-06-29 17:23:51 +02:00
|
|
|
#[rustc_deprecated(reason = "a")] //~ ERROR missing 'since' [E0542]
|
2015-01-22 12:33:46 -08:00
|
|
|
fn f2() { }
|
2019-09-26 13:24:41 +02:00
|
|
|
|
|
|
|
#[stable(feature = "a", since = "b")]
|
|
|
|
#[rustc_deprecated(since = "a")] //~ ERROR missing 'reason' [E0543]
|
|
|
|
fn f3() { }
|
2015-01-22 12:33:46 -08:00
|
|
|
}
|
|
|
|
|
2019-12-21 13:16:18 +02:00
|
|
|
#[unstable(feature = "b", issue = "none")]
|
2016-06-29 17:23:51 +02:00
|
|
|
#[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
|
|
|
|
fn multiple1() { }
|
2015-01-22 12:33:46 -08:00
|
|
|
|
2019-12-21 13:16:18 +02:00
|
|
|
#[unstable(feature = "b", issue = "none")]
|
|
|
|
#[unstable(feature = "b", issue = "none")] //~ ERROR multiple stability levels [E0544]
|
2016-06-29 17:23:51 +02:00
|
|
|
fn multiple2() { }
|
2015-01-22 12:33:46 -08:00
|
|
|
|
|
|
|
#[stable(feature = "a", since = "b")]
|
2016-06-29 17:23:51 +02:00
|
|
|
#[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
|
|
|
|
fn multiple3() { }
|
2015-01-22 12:33:46 -08:00
|
|
|
|
|
|
|
#[stable(feature = "a", since = "b")]
|
2015-11-20 16:11:20 +03:00
|
|
|
#[rustc_deprecated(since = "b", reason = "text")]
|
2020-11-01 12:29:57 +01:00
|
|
|
#[rustc_deprecated(since = "b", reason = "text")] //~ ERROR multiple deprecated attributes
|
2019-12-21 13:16:18 +02:00
|
|
|
#[rustc_const_unstable(feature = "c", issue = "none")]
|
|
|
|
#[rustc_const_unstable(feature = "d", issue = "none")] //~ ERROR multiple stability levels
|
2020-11-01 12:29:57 +01:00
|
|
|
pub const fn multiple4() { }
|
2015-06-11 17:18:46 -07:00
|
|
|
//~^ ERROR Invalid stability or deprecation version found
|
2015-01-22 12:33:46 -08:00
|
|
|
|
2015-11-20 16:11:20 +03:00
|
|
|
#[rustc_deprecated(since = "a", reason = "text")]
|
2016-06-29 17:23:51 +02:00
|
|
|
fn deprecated_without_unstable_or_stable() { }
|
2020-11-01 12:29:57 +01:00
|
|
|
//~^^ ERROR rustc_deprecated attribute must be paired with either stable or unstable attribute
|
2015-01-22 12:33:46 -08:00
|
|
|
|
|
|
|
fn main() { }
|