]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0711.md
docs/test: add error-docs and UI test for `E0711`
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0711.md
1 #### This error code is internal to the compiler and will not be emitted with normal Rust code.
2
3 Feature declared with conflicting stability requirements.
4
5 ```compile_fail,E0711
6 // NOTE: this attribute is perma-unstable and should *never* be used outside of
7 //       stdlib and the compiler.
8 #![feature(staged_api)]
9
10 #![stable(feature = "...", since = "1.0.0")]
11
12 #[stable(feature = "foo", since = "1.0.0")]
13 fn foo_stable_1_0_0() {}
14
15 // error: feature `foo` is declared stable since 1.29.0
16 #[stable(feature = "foo", since = "1.29.0")]
17 fn foo_stable_1_29_0() {}
18
19 // error: feature `foo` is declared unstable
20 #[unstable(feature = "foo", issue = "none")]
21 fn foo_unstable() {}
22 ```
23
24 In the above example, the `foo` feature is first defined to be stable since
25 1.0.0, but is then re-declared stable since 1.29.0. This discrepancy in
26 versions causes an error. Furthermore, `foo` is then re-declared as unstable,
27 again the conflict causes an error.
28
29 This error can be fixed by splitting the feature, this allows any
30 stability requirements and removes any possibility of conflict.