Skip to content

Commit da2e570

Browse files
committed
EII add feature gate
1 parent 620086e commit da2e570

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

compiler/rustc_feature/src/unstable.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ declare_features! (
211211
(internal, compiler_builtins, "1.13.0", None),
212212
/// Allows writing custom MIR
213213
(internal, custom_mir, "1.65.0", None),
214+
/// Implementation details of externally implementatble items
215+
(unstable, eii_internals, "CURRENT_RUSTC_VERSION", None),
214216
/// Outputs useful `assert!` messages
215217
(unstable, generic_assert, "1.63.0", None),
216218
/// Allows using the #[rustc_intrinsic] attribute.
@@ -482,6 +484,8 @@ declare_features! (
482484
(unstable, doc_masked, "1.21.0", Some(44027)),
483485
/// Allows features to allow target_feature to better interact with traits.
484486
(incomplete, effective_target_features, "CURRENT_RUSTC_VERSION", Some(143352)),
487+
/// Externally implementatble items
488+
(unstable, eii, "CURRENT_RUSTC_VERSION", Some(125418)),
485489
/// Allows the .use postfix syntax `x.use` and use closures `use |x| { ... }`
486490
(incomplete, ergonomic_clones, "1.87.0", Some(132290)),
487491
/// Allows exhaustive pattern matching on types that contain uninhabited types.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![crate_type = "rlib"]
2+
#![feature(decl_macro)]
3+
#![feature(rustc_attrs)]
4+
5+
#[eii_extern_target(bar)] //~ ERROR use of unstable library feature `eii_internals`
6+
#[rustc_builtin_macro(eii_macro)]
7+
macro foo() {} //~ ERROR: cannot find a built-in macro with name `foo`
8+
9+
unsafe extern "Rust" {
10+
safe fn bar(x: u64) -> u64;
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error[E0658]: use of unstable library feature `eii_internals`
2+
--> $DIR/feature-gate-eii-internals.rs:5:3
3+
|
4+
LL | #[eii_extern_target(bar)]
5+
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add `#![feature(eii_internals)]` 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: cannot find a built-in macro with name `foo`
11+
--> $DIR/feature-gate-eii-internals.rs:7:1
12+
|
13+
LL | macro foo() {}
14+
| ^^^^^^^^^^^^^^
15+
16+
error: aborting due to 2 previous errors
17+
18+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![crate_type = "rlib"]
2+
3+
#[eii] //~ ERROR use of unstable library feature `eii`
4+
fn hello(x: u64);
5+
6+
#[hello]
7+
fn hello_impl(x: u64) {
8+
println!("{x:?}")
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0658]: use of unstable library feature `eii`
2+
--> $DIR/feature-gate-eii.rs:3:3
3+
|
4+
LL | #[eii]
5+
| ^^^
6+
|
7+
= note: see issue #125418 <https://github.com/rust-lang/rust/issues/125418> for more information
8+
= help: add `#![feature(eii)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error: aborting due to 1 previous error
12+
13+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)