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

Bounds on parameters of inherent GATs are not respected #106722

Closed
fmease opened this issue Jan 11, 2023 · 1 comment · Fixed by #109410
Closed

Bounds on parameters of inherent GATs are not respected #106722

fmease opened this issue Jan 11, 2023 · 1 comment · Fixed by #109410
Assignees
Labels
A-GATs Area: Generic associated types (GATs) C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs F-inherent_associated_types `#![feature(inherent_associated_types)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@fmease
Copy link
Member

fmease commented Jan 11, 2023

This code successfully compiles even though it should not (since String: !Copy).

#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

pub enum Ty {}

impl Ty {
    type Pr<T: Copy> = T;
}

const _: Ty::Pr<String> = String::new();

This strongly relates to #104251 which is only about the bounds on the Self type parameter (as I see it, others might disagree). #105961 does not address the issue around inherent GATs and I don't plan to change that (maybe). I consider this issue blocked on #105961 to avoid future merge conflicts.

@rustbot label T-compiler F-inherent_associated_types F-generic_associated_types requires-nightly S-blocked
@rustbot claim

@fmease fmease added the C-bug Category: This is a bug. label Jan 11, 2023
@rustbot rustbot added F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs F-inherent_associated_types `#![feature(inherent_associated_types)]` requires-nightly This issue requires a nightly compiler in some way. S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 11, 2023
@fmease fmease changed the title Bounds on inherent (generic) associated types are not respected Bounds on parameters of inherent GATs are not respected Jan 29, 2023
@fmease

This comment was marked as resolved.

@rustbot rustbot removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Feb 20, 2023
@bors bors closed this as completed in 29ac429 May 8, 2023
flip1995 pushed a commit to flip1995/rust that referenced this issue May 20, 2023
…compiler-errors

Introduce `AliasKind::Inherent` for inherent associated types

Allows us to check (possibly generic) inherent associated types for well-formedness.
Type inference now also works properly.

Follow-up to rust-lang#105961. Supersedes rust-lang#108430.
Fixes rust-lang#106722.
Fixes rust-lang#108957.
Fixes rust-lang#109768.
Fixes rust-lang#109789.
Fixes rust-lang#109790.

~Not to be merged before rust-lang#108860 (`AliasKind::Weak`).~

CC `@jackh726`
r? `@compiler-errors`

`@rustbot` label T-types F-inherent_associated_types
@fmease fmease added the A-GATs Area: Generic associated types (GATs) label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-GATs Area: Generic associated types (GATs) C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs F-inherent_associated_types `#![feature(inherent_associated_types)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants