Skip to content

Bounds on parameters of inherent GATs are not respected #106722

Closed
@fmease

Description

@fmease

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

Metadata

Metadata

Assignees

Labels

A-GATsArea: Generic associated types (GATs)C-bugCategory: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsF-inherent_associated_types`#![feature(inherent_associated_types)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions