Skip to content

Implement unstable trait impl #140399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Implement unstable trait impl #140399

wants to merge 7 commits into from

Conversation

tiif
Copy link
Member

@tiif tiif commented Apr 28, 2025

This PR allows marking impls of stable trait with stable type as unstable.

The design and mentoring are done by @BoxyUwU

@rustbot rustbot 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 28, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@BoxyUwU BoxyUwU self-assigned this May 27, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 10, 2025

☔ The latest upstream changes (presumably #142299) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member Author

@tiif tiif Jun 11, 2025

Choose a reason for hiding this comment

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

If we stop making TypingMode::PostAnalysis return Ok(Yes) when proving ClauseKind::UnstableFeature, this test will ice: #142368 (comment)

This means the test is working as intended,

@jhpratt
Copy link
Member

jhpratt commented Jun 11, 2025

I've got nothing technical to add (I've not looked over the code). I just wanted to thank @tiif for taking on this task! It's far from trivial and has been a long-standing desire.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 14, 2025

☔ The latest upstream changes (presumably #142483) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@BoxyUwU BoxyUwU left a comment

Choose a reason for hiding this comment

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

gg gamer

@tiif tiif changed the title WIP: Unstable impls Implement unstable trait impl Jun 21, 2025
@tiif
Copy link
Member Author

tiif commented Jun 23, 2025

I am leaving the conflicts there because I don't want to rebase for now (the conflict also happens quite frequently), so it would be easier for boxy to review.

hi @jdonszelmann, it'd be nice to get a vibeck from you for the attribute change :)

@tiif tiif marked this pull request as ready for review June 23, 2025 13:50
@rustbot
Copy link
Collaborator

rustbot commented Jun 23, 2025

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

changes to the core type system

cc @compiler-errors, @lcnr

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

changes to inspect_obligations.rs

cc @compiler-errors, @lcnr

Some changes occurred in compiler/rustc_attr_data_structures

cc @jdonszelmann

@jdonszelmann
Copy link
Contributor

Hi tiff! Will review this week :)

@bors
Copy link
Collaborator

bors commented Jun 25, 2025

☔ The latest upstream changes (presumably #142997) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@jdonszelmann jdonszelmann left a comment

Choose a reason for hiding this comment

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

looks good from my side tiff!

@@ -268,5 +268,7 @@ pub enum AttributeKind {
/// Span of the attribute.
span: Span,
},
/// Represents `#[unstable_feature_bound]`.
Copy link
Contributor

Choose a reason for hiding this comment

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

add a space above this simply to be consistent with the other ones (minor hehe)

@@ -675,6 +675,10 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
template!(List: r#"feature = "name", reason = "...", issue = "N""#), DuplicatesOk,
EncodeCrossCrate::Yes
),
ungated!(
unstable_feature_bound, Normal, template!(Word, List: "feat1, feat2, ..."),
DuplicatesOk, EncodeCrossCrate::No,
Copy link
Contributor

Choose a reason for hiding this comment

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

we're moving lots of this info into the attribute system, that's why it duplicates the template for now. When you'll rebase on master you'll also have to duplicate the cross-crate-encoding somewhere else to make it compile

@bors
Copy link
Collaborator

bors commented Jun 27, 2025

☔ The latest upstream changes (presumably #143091) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants