Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6561424

Browse files
committed
Add test for mixed stability levels
1 parent b9db439 commit 6561424

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//! definitions for ../mixed-levels.rs
2+
3+
#![stable(feature = "stable_feature", since = "1.0.0")]
4+
#![feature(staged_api)]
5+
#![crate_type = "lib"]
6+
7+
#[stable(feature = "stable_a", since = "1.0.0")]
8+
#[stable(feature = "stable_b", since = "1.8.2")]
9+
#[macro_export]
10+
macro_rules! stable_mac {
11+
() => ()
12+
}
13+
14+
#[unstable(feature = "unstable_a", issue = "none")]
15+
#[stable(feature = "stable_a", since = "1.0.0")]
16+
#[macro_export]
17+
macro_rules! unstable_mac {
18+
() => ()
19+
}
20+
21+
#[stable(feature = "stable_feature", since = "1.0.0")]
22+
#[rustc_const_stable(feature = "stable_c", since = "1.8.2")]
23+
#[rustc_const_stable(feature = "stable_d", since = "1.0.0")]
24+
pub const fn const_stable_fn() {}
25+
26+
#[stable(feature = "stable_feature", since = "1.0.0")]
27+
#[rustc_const_unstable(feature = "unstable_c", issue = "none")]
28+
#[rustc_const_stable(feature = "stable_c", since = "1.8.2")]
29+
pub const fn const_unstable_fn() {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! Test stability levels for items formerly dependent on multiple unstable features.
2+
//@ aux-build:mixed-levels.rs
3+
4+
extern crate mixed_levels;
5+
6+
const USE_STABLE: () = mixed_levels::const_stable_fn();
7+
const USE_UNSTABLE: () = mixed_levels::const_unstable_fn();
8+
//~^ ERROR `const_unstable_fn` is not yet stable as a const fn
9+
10+
fn main() {
11+
mixed_levels::stable_mac!();
12+
mixed_levels::unstable_mac!(); //~ ERROR use of unstable library feature `unstable_a` [E0658]
13+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0658]: use of unstable library feature `unstable_a`
2+
--> $DIR/mixed-levels.rs:12:5
3+
|
4+
LL | mixed_levels::unstable_mac!();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add `#![feature(unstable_a)]` to the crate attributes to enable
8+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9+
10+
error: `const_unstable_fn` is not yet stable as a const fn
11+
--> $DIR/mixed-levels.rs:7:26
12+
|
13+
LL | const USE_UNSTABLE: () = mixed_levels::const_unstable_fn();
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: use of unstable library feature `unstable_c`
17+
= help: add `#![feature(unstable_c)]` to the crate attributes to enable
18+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
19+
20+
error: aborting due to 2 previous errors
21+
22+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /