Skip to content

Cannot use cfg_select! with EII #162378

Description

@sleepycatcoding

I tried this code:

#![feature(extern_item_impls)]

cfg_select! {
    feature = "nightly" => {
        #[eii(do_something)]
        pub fn do_something();
    }
    _ => {
        // Fallback if not on nightly.
        pub fn do_something() {}
    }
}

I expected to see this compile.

Instead, I got a compile error, complaining about unsupported attributes on externally implementable items, I assumed this should work since it selects a branch to compile based on the environment and the attributes aren't directly applied to the function itself.

error: only a small subset of attributes are supported on externally implementable items
 --> src/main.rs:7:9
  |
7 |         pub fn do_something();
  |         ^^^^^^^^^^^^^^^^^^^^^^
  |
note: this attribute is not supported
 --> src/main.rs:5:5
  |
5 |     feature = "nightly" => {
  |     ^^^^^^^^^^^^^^^^^^^

Meta

rustc --version --verbose:

rustc 1.100.0-nightly (f248f4038 2026-09-05)
binary: rustc
commit-hash: f248f4038796913873f11ca65b1b901e311c8dae
commit-date: 2026-09-05
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1
Backtrace

<backtrace>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.F-extern_item_impls`#![feature(extern_item_impls)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions