Skip to content
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

require trait impls to have matching const stabilities as the traits #136688

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fee1-dead
Copy link
Member

This resolves rust-lang/project-const-traits#5 by implementing the suggested solution in the given thread

r? @RalfJung
cc @rust-lang/project-const-traits

@rustbot rustbot added 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-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 7, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 7, 2025

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member

RalfJung commented Feb 7, 2025

The corresponding check for regular stability seems to work very differently -- do we have any idea why? I get

error: an `#[unstable]` annotation here has no effect
   --> library/alloc/src/slice.rs:836:1
    |
836 | #[unstable(feature = "rust2", issue = "none")]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information
    = note: `#[deny(ineffective_unstable_trait_impl)]` on by default

@RalfJung
Copy link
Member

RalfJung commented Feb 7, 2025

Anyway I agree with the goal but would prefer if someone else could review the implementation -- @compiler-errors or @oli-obk , could one of you take this?

@compiler-errors
Copy link
Member

Can do

@RalfJung
Copy link
Member

RalfJung commented Feb 7, 2025

r? @compiler-errors

@rustbot rustbot assigned compiler-errors and unassigned RalfJung Feb 7, 2025
@fee1-dead
Copy link
Member Author

hi @compiler-errors :))

@bors
Copy link
Contributor

bors commented Feb 25, 2025

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

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

r=me after rebasing

&& const_stab.is_some_and(|(stab, _)| stab.is_const_stable())
{
self.tcx.dcx().emit_err(errors::TraitImplConstStable { span: item.span });
if features.const_trait_impl() && hir::Constness::Const == *constness {
Copy link
Member

Choose a reason for hiding this comment

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

nit: inconsistency between == here but if let below for matching constness. can you choose one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Const stability on impls doesn't make sense
6 participants