Skip to content

Allow the unstable attribute on foreign type - #158233

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
kantnero:allow-unstable-attr-on-target
Jun 28, 2026
Merged

Allow the unstable attribute on foreign type#158233
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
kantnero:allow-unstable-attr-on-target

Conversation

@kantnero

@kantnerokantnero commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

While working the FnPtr trait in #156176@carbotaniuman was trying to implement Code as an extern type but got an error as the current stability infrastructure does not allow unstable attribute on foreign type. #158200

This PR fixes that by allowing the unstable attribute on ForeignTy and adds test to verify.

@rustbot r? @JonathanBrouwer

@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@rustbotrustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 22, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @JonathanBrouwer (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rust-log-analyzer

This comment has been minimized.

Comment threadtests/ui/stability-attribute/foreign-type-stability.rs Outdated
@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 22, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@kantnero
kantneroforce-pushed the allow-unstable-attr-on-target branch from b915a1c to 4b98d4cCompareJune 22, 2026 17:25
@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 22, 2026
@kantnero
kantnero marked this pull request as draft June 22, 2026 17:46
@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 22, 2026
@kantnero
kantneroforce-pushed the allow-unstable-attr-on-target branch from 8fd861c to b973eb9CompareJune 22, 2026 18:03
@rust-log-analyzer

This comment has been minimized.

Signed-off-by: Emmanuel Ugwu <emmanuelugwu121@gmail.com>
@kantnero
kantnero marked this pull request as ready for review June 26, 2026 21:36
@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 26, 2026
@kantnero

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@rust-log-analyzer

This comment has been minimized.

@JonathanBrouwerJonathanBrouwer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the uitests need to be blessed, looks good to me after that, thanks <3

View changes since this review

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 27, 2026
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 4 pull requests
Successful merges:
- #137858 (Add new `unused_footnote_definition` rustdoc lint)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 4 pull requests
Successful merges:
- #137858 (Add new `unused_footnote_definition` rustdoc lint)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 4 pull requests
Successful merges:
- #137858 (Add new `unused_footnote_definition` rustdoc lint)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 4 pull requests
Successful merges:
- #137858 (Add new `unused_footnote_definition` rustdoc lint)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 27, 2026
…rget, r=JonathanBrouwer
Allow the unstable attribute on foreign type
While working the `FnPtr` trait in rust-lang#156176@carbotaniuman was trying to implement `Code` as an extern type but got an error as the current stability infrastructure does not allow `unstable` attribute on foreign type. rust-lang#158200
This PR fixes that by allowing the `unstable` attribute on ForeignTy and adds test to verify.
@rustbot r? @JonathanBrouwer
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 6 pull requests
Successful merges:
- #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- #137858 (Add new `unused_footnote_definition` rustdoc lint)
- #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors try jobs=x86_64-gnu-llvm-22-3

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
Allow the unstable attribute on foreign type
try-job: x86_64-gnu-llvm-22-3
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 6 pull requests
Successful merges:
- #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- #137858 (Add new `unused_footnote_definition` rustdoc lint)
- #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 6 pull requests
Successful merges:
- #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- #137858 (Add new `unused_footnote_definition` rustdoc lint)
- #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 6 pull requests
Successful merges:
- #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- #137858 (Add new `unused_footnote_definition` rustdoc lint)
- #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 27, 2026
…rget, r=JonathanBrouwer
Allow the unstable attribute on foreign type
While working the `FnPtr` trait in rust-lang#156176@carbotaniuman was trying to implement `Code` as an extern type but got an error as the current stability infrastructure does not allow `unstable` attribute on foreign type. rust-lang#158200
This PR fixes that by allowing the `unstable` attribute on ForeignTy and adds test to verify.
@rustbot r? @JonathanBrouwer
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
- #152225 (Add supertrait item shadowing for type-level path resolution)
- #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
- #158501 (miri subtree update)
- #153097 (Expand `OptionFlatten`'s iterator methods)
- #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
@rust-bors

rust-borsBot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: a211074 (a211074522f1363fba8b3ebad1611cfe1c84757c)
Base parent: 13f1859 (13f1859f2faf97a15664e655624baa7417fdc100)

rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
- #152225 (Add supertrait item shadowing for type-level path resolution)
- #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
- #158501 (miri subtree update)
- #153097 (Expand `OptionFlatten`'s iterator methods)
- #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
- #152225 (Add supertrait item shadowing for type-level path resolution)
- #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
- #158501 (miri subtree update)
- #153097 (Expand `OptionFlatten`'s iterator methods)
- #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-borsBot pushed a commit that referenced this pull request Jun 27, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
- #152225 (Add supertrait item shadowing for type-level path resolution)
- #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
- #158501 (miri subtree update)
- #153097 (Expand `OptionFlatten`'s iterator methods)
- #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- #158233 (Allow the unstable attribute on foreign type)
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 28, 2026
…rget, r=JonathanBrouwer
Allow the unstable attribute on foreign type
While working the `FnPtr` trait in rust-lang#156176@carbotaniuman was trying to implement `Code` as an extern type but got an error as the current stability infrastructure does not allow `unstable` attribute on foreign type. rust-lang#158200
This PR fixes that by allowing the `unstable` attribute on ForeignTy and adds test to verify.
@rustbot r? @JonathanBrouwer
This was referenced Jun 28, 2026
rust-borsBot pushed a commit that referenced this pull request Jun 28, 2026
Rollup of 15 pull requests
Successful merges:
- #158497 (stdarch subtree update)
- #152225 (Add supertrait item shadowing for type-level path resolution)
- #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
- #158501 (miri subtree update)
- #153097 (Expand `OptionFlatten`'s iterator methods)
- #157614 (Move tests drop)
- #157996 (perf: drop the full-crate AST walk in check_unused)
- #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- #158233 (Allow the unstable attribute on foreign type)
- #158433 (Fix inconsistent safety requirement in VecDeque::nonoverlapping_ranges)
- #158464 (Reorganize `tests/ui/issues` [15/N])
- #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- #158485 (Reorganize `tests/ui/issues` [16/N])
- #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
@rust-bors
rust-borsBot merged commit dc0e276 into rust-lang:mainJun 28, 2026
14 checks passed
@rustbotrustbot added this to the 1.98.0 milestone Jun 28, 2026
rust-timer added a commit that referenced this pull request Jun 28, 2026
Rollup merge of #158233 - kantnero:allow-unstable-attr-on-target, r=JonathanBrouwer
Allow the unstable attribute on foreign type
While working the `FnPtr` trait in #156176@carbotaniuman was trying to implement `Code` as an extern type but got an error as the current stability infrastructure does not allow `unstable` attribute on foreign type. #158200
This PR fixes that by allowing the `unstable` attribute on ForeignTy and adds test to verify.
@rustbot r? @JonathanBrouwer
faukah pushed a commit to faukah/miri that referenced this pull request Jun 28, 2026
Rollup of 15 pull requests
Successful merges:
- rust-lang/rust#158497 (stdarch subtree update)
- rust-lang/rust#152225 (Add supertrait item shadowing for type-level path resolution)
- rust-lang/rust#158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- rust-lang/rust#158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
- rust-lang/rust#158501 (miri subtree update)
- rust-lang/rust#153097 (Expand `OptionFlatten`'s iterator methods)
- rust-lang/rust#157614 (Move tests drop)
- rust-lang/rust#157996 (perf: drop the full-crate AST walk in check_unused)
- rust-lang/rust#158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- rust-lang/rust#158233 (Allow the unstable attribute on foreign type)
- rust-lang/rust#158433 (Fix inconsistent safety requirement in VecDeque::nonoverlapping_ranges)
- rust-lang/rust#158464 (Reorganize `tests/ui/issues` [15/N])
- rust-lang/rust#158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- rust-lang/rust#158485 (Reorganize `tests/ui/issues` [16/N])
- rust-lang/rust#158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
github-actionsBot pushed a commit to rust-lang/stdarch that referenced this pull request Jul 16, 2026
Rollup of 15 pull requests
Successful merges:
- rust-lang/rust#158497 (stdarch subtree update)
- rust-lang/rust#152225 (Add supertrait item shadowing for type-level path resolution)
- rust-lang/rust#158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
- rust-lang/rust#158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
- rust-lang/rust#158501 (miri subtree update)
- rust-lang/rust#153097 (Expand `OptionFlatten`'s iterator methods)
- rust-lang/rust#157614 (Move tests drop)
- rust-lang/rust#157996 (perf: drop the full-crate AST walk in check_unused)
- rust-lang/rust#158163 (Fix too-short variance slice in `variances_of` cycle recovery)
- rust-lang/rust#158233 (Allow the unstable attribute on foreign type)
- rust-lang/rust#158433 (Fix inconsistent safety requirement in VecDeque::nonoverlapping_ranges)
- rust-lang/rust#158464 (Reorganize `tests/ui/issues` [15/N])
- rust-lang/rust#158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
- rust-lang/rust#158485 (Reorganize `tests/ui/issues` [16/N])
- rust-lang/rust#158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@kantnero@rustbot@rust-log-analyzer@JonathanBrouwer