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

Trait bounds are not checked on type aliases until they are used #51626

Open
glandium opened this issue Jun 19, 2018 · 1 comment
Open

Trait bounds are not checked on type aliases until they are used #51626

glandium opened this issue Jun 19, 2018 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-trait-system Area: Trait system C-bug Category: This is a bug. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@glandium
Copy link
Contributor

Consider the following code:

#![crate_type = "lib"]

pub trait Trait {}

pub struct Foo<T: Trait>(T);

pub struct Qux;

pub type Bar<T=Qux> = Foo<T>;

This builds without an error although Qux doesn't respect the trait bound.

Build failure only occurs when one actually uses the type alias, like the following:

fn foo(_: Bar) {}
@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints A-trait-system Area: Trait system I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 5, 2019
@nikomatsakis nikomatsakis added P-medium Medium priority and removed I-nominated labels Aug 15, 2019
@nikomatsakis
Copy link
Contributor

Compiler team pre-triage: Marking as P-medium as this is a rather old and long-standing issue that we have to resolve.

@JohnTitor JohnTitor added the C-bug Category: This is a bug. label Nov 10, 2019
@fmease fmease added A-trait-system Area: Trait system and removed A-trait-system Area: Trait system labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-trait-system Area: Trait system C-bug Category: This is a bug. P-medium Medium priority 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.

5 participants