Skip to content

GCI: Reject free const items with trivially unsatisfiable clauses #165153

Open

Description

@fmease

Uplifted from comment #142293 (comment) (2025).


Not doing so would make adding trait impls (more) breaking. "More" because thanks to 1IR (the "one-impl rule") that's already breaking. Furthermore, const blocks inside fns with trivially unsatisfiable clauses are problematic in quite a similar fashion except that breakages would only ever be post-mono. Related: #165152.

Reproducer

Upstream crate upstream:

pub trait Trait { const THING: (); }

// NOTE: Adding this innocuous-looking impl would break downstream.
//impl Trait for () { const THING: () = (); }

Downstream crate downstream:

#![feature(generic_const_items)]

const _: () = {
    let _ = <() as upstream::Trait>::THING;
    panic!(); // NOTE: Panics if upstream adds the impl
}
where
    for<'_delay> (): upstream::Trait;

Activity

  1. self-assigned this
    on Oct 29, 2026
  2. converted this from a draft issue on Oct 29, 2026
  3. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 29, 2026
  4. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    T-typesRelevant to the types team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 29, 2026
  5. changed the title [-]Reject free const items with trivially unsatisfiable clauses[/-] [+]GCI: Reject free const items with trivially unsatisfiable clauses[/+] on Oct 29, 2026
  6. moved this from In Progress to To Do in Generic Const Items (GCI)on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-generic_const_items`#![feature(generic_const_items)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions