Tracking Issue for externally implementable items #125418
Description
Activity
- addedT-langRelevant to the language teamRelevant to the language teamC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCB-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).Blocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).F-extern_item_impls`#![feature(extern_item_impls)]``#![feature(extern_item_impls)]`I-lang-nominatedNominated for discussion during a lang team meeting.Nominated for discussion during a lang team meeting.
on May 22, 2024 @jdonszelmann and I are currently implementing this, with a different syntax. Instead of using new syntax (e.g.
extern impl fn ...) as in the RFC draft, we're using attributes instead:#[externally_implementable(thing_handler)] fn do_thing();
#[thing_handler] fn my_thing_handler() { ..; }
This has a number of advantages.
#[thing_handler]could be replaced by a proc_macro in semver-compatible versions of the crate, so we don't need to worry about providing conversion/upgrade mechanisms. It also makes it look identical to#[panic_handler]and#[global_allocator]attributes. It clarifies the naming and visibility issue:do_thingis the function to call, and#[thing_handler]is the attribute to override it, so they each have their own name and visibility. And it allows us to placeunsafein the attribute itself, to separate "unsafe to implement" and "unsafe to call".More updates soon!
Reacted by Jana Dönszelmann, Martin Nordholts, Bruno Kolenbrander, recatek and Mavity the MadityReacted by Alex- removedI-lang-nominatedNominated for discussion during a lang team meeting.Nominated for discussion during a lang team meeting.
on Sep 19, 2024 Does this introduce a new global namespace for
thing_handler? I would prefer if this was a proper path to an item within a crate since that properly takes care of things like multiple instances of the same crate with different major versions.Does this introduce a new global namespace for
thing_handler?Nope! It behaves the same as any other attribute (macro), as an item with a path.
84 remaining items
- added a commit that references this issue
on Jul 15, 2026 - added 2 commits that reference this issue
on Jul 15, 2026 - added 5 commits that reference this issue
on Jul 25, 2026 - added a commit that references this issue
on Jul 27, 2026 - added a commit that references this issue
on Jul 27, 2026 - added a commit that references this issue
on Aug 7, 2026 - added a commit that references this issue
on Aug 17, 2026
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsExploration
View all comments
This is a tracking issue for the lang experiment on externally implementable items. This currently covers these proposals:
The feature gate for the issue is
#![feature(extern_item_impls)].Example of how to use what's implemented now
About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
no_mangleon EIIs is rejected properlymissing stability attributeerrors with trivial Externally Implementable Item (eii) function inlibrary/std#150514expected statement#149980Instance::mono: DefId(..) has type parameters#149983Nonein find_attr() #149981#[eii]macro using methods on ecx #150906For now: fwd everything: compiler: Forward attributes to eii-expanded macros #150913-Cprefer-dynamicextern_item_implsmiri#5247Unresolved Questions
Related
Implementation history
cc @m-ou-se @Amanieu @tmandry @joshtriplett