-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Inherit #[stable(..)]
annotations in enum variants and fields from its item
#71481
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
06a9316
to
8b3c6ee
Compare
This comment has been minimized.
This comment has been minimized.
8b3c6ee
to
f7b8313
Compare
CC @rust-lang/compiler who might be interested in this. |
I still don't think this is a good idea. |
Items in trait impls don't currently require stability attributes. |
Does this refer to this implementation, the general idea of stability From the first diff section in https://github.com/rust-lang/rust/pull/71481/files#diff-6bfe08b41853465a10867dc22a4a548c it seems to me that we originally intended this new behavior to be the correct one. It's also making me realize that after landing this when we update the used beta in this repo we'll also need to in the same commit update the current usages, as having two different nested
The mechanism used for |
This comment has been minimized.
This comment has been minimized.
#![feature(staged_api)] | ||
#![stable(feature = "test", since = "0")] | ||
|
||
#[stable(feature = "test", since = "0")] | ||
pub struct Reverse<T>(pub T); //~ ERROR field has missing stability attribute | ||
pub struct Reverse<T>(pub T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is potentially dangerous change that also limits our options in the future.
I can see an use-case in adding an unstable new field to a struct and not impacting any stable uses of the struct.
Similarly for #[non_exhaustive]
enums (the only kind of enum to which it is valid to add a variant), though perhaps significantly more debatable depending on the specific case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see an use-case in adding an unstable new field to a struct and not impacting any stable uses of the struct.
I'm not sure I follow. This PR makes the linked code semantically the same as the current
#[stable(feature = "test", since = "0")]
pub struct Reverse<T>(#[stable(feature = "test", since = "0")] pub T);
but you can still add unstable
(and stable
with different feature name) annotations to individual fields as you add to them. You currently get a compile error with the presented code. I don't see how this change limits us?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the point is more that we might accidentally stabilize struct fields without intending to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the reason this comment ended up being here is because I’m expressing my observation based on the removed error message, not because the struct is in any way interesting.
@nikomatsakis summarized my point well.
@matthewjasper any updates on this? |
I'm nominating to discuss in a triage meeting and decide next steps here. |
Removed |
This was discussed in today's weekly meeting. Removing nomination. |
💥 Test timed out |
@bors retry |
…atsakis Inherit `#[stable(..)]` annotations in enum variants and fields from its item Lint changes for rust-lang#65515. The stdlib will have to be updated once this lands in beta and that version is promoted in master.
⌛ Testing commit 49310ce with merge d81b0db9e9fc6a3ecbf3d00f9652e8c33aa953d7... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
Unrelated CI failure, @bors retry |
…atsakis Inherit `#[stable(..)]` annotations in enum variants and fields from its item Lint changes for rust-lang#65515. The stdlib will have to be updated once this lands in beta and that version is promoted in master.
☀️ Test successful - checks-actions |
…stab, r=estebank Enum variant ctor inherits the stability of the enum variant Fixes rust-lang#100399 Fixes rust-lang#100420 Context rust-lang#71481 for why enum variants don't need stability
Lint changes for #65515. The stdlib will have to be updated once this lands in beta and that version is promoted in master.