rust/tests/ui/missing/missing-stability.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
595 B
Rust
Raw Normal View History

2015-02-04 03:00:54 +08:00
// Checks that exported items without stability attributes cause an error
#![crate_type="lib"]
#![feature(staged_api)]
2018-07-23 19:22:23 +08:00
#![stable(feature = "stable_test_feature", since = "1.0.0")]
2015-11-17 00:54:28 +08:00
2015-02-04 03:00:54 +08:00
pub fn unmarked() {
2019-02-08 21:30:13 +08:00
//~^ ERROR function has missing stability attribute
2015-02-04 03:00:54 +08:00
()
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
2015-02-04 03:00:54 +08:00
pub mod foo {
// #[unstable] is inherited
pub fn unmarked() {}
}
2018-07-23 19:22:23 +08:00
#[stable(feature = "stable_test_feature", since="1.0.0")]
2015-02-04 03:00:54 +08:00
pub mod bar {
// #[stable] is not inherited
pub fn unmarked() {}
2019-02-08 21:30:13 +08:00
//~^ ERROR function has missing stability attribute
2015-02-18 07:10:25 +08:00
}