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 bound claims missing requirements despite those bounds being implied by the trait #86635

Open
CraftSpider opened this issue Jun 25, 2021 · 2 comments
Labels
A-traits Area: Trait system C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@CraftSpider
Copy link
Contributor

CraftSpider commented Jun 25, 2021

I tried this code: Playground Link

I expected to see this happen: Only one error: Foo cannot be implemented for Bar, the function should compile.

Instead, this happened: The function complains about missing bounds, despite the fact that those bounds should be implicit by the requirements of the trait.

Zulip Discussion: Zulip

Meta

Using 1.53.0 on the playground, bug still present on latest nightly.

@CraftSpider CraftSpider added the C-bug Category: This is a bug. label Jun 25, 2021
@bjorn3 bjorn3 added the A-traits Area: Trait system label Jun 25, 2021
@fee1-dead
Copy link
Member

Minified:

trait R { type Assoc; }

// Does not need `for` for the error
trait Foo<'a> where &'a Self: R<Assoc = Self>, Self: 'a {}
trait Foo2 where for<'a> &'a Self: R<Assoc = Self> {}

fn do_thing<'a, T: Foo<'a>, T2: Foo2>(_: (T, T2)) {
    
}

playground

@jonas-schievink
Copy link
Contributor

Looks like a duplicate / special case of #20671

@Nilstrieb Nilstrieb added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue. labels Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants