Skip to content

Trivial bounds check doesn't consider non-global predicates *after* normalization #140309

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
compiler-errors opened this issue Apr 25, 2025 · 0 comments · May be fixed by #140313
Open

Trivial bounds check doesn't consider non-global predicates *after* normalization #140309

compiler-errors opened this issue Apr 25, 2025 · 0 comments · May be fixed by #140313
Assignees
Labels
C-bug Category: This is a bug. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@compiler-errors
Copy link
Member

trait Hello {}
impl<const N: usize> Hello for [(); N] {}

trait Foo {
    type Assoc;
}

fn foo<const N: usize>()
where
    <u32 as Foo>::Assoc: Hello,
    u32: Foo<Assoc = [(); N]>,
{
}

I expected to see this pass.

Instead, this ICEd.

<u32 as Foo>::Assoc: Hello is considered global, but it is not global.

@compiler-errors compiler-errors added the C-bug Category: This is a bug. label Apr 25, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 25, 2025
@compiler-errors compiler-errors added T-types Relevant to the types team, which will review and decide on the PR/issue. F-trivial_bounds `#![feature(trivial_bounds)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-trivial_bounds `#![feature(trivial_bounds)]` labels Apr 25, 2025
@lcnr lcnr linked a pull request Apr 25, 2025 that will close this issue
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 25, 2025
change false trivial bounds detection

fixes rust-lang#140309

TODO

r? `@compiler-errors`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants