Skip to content

Impl reachability rules bug? #21687

@vadimcn

Description

@vadimcn
use std::default::Default;

trait AAA {}
trait BBB<T> {}
struct SSS<T>(T);

impl<T,U> AAA for SSS<T> where T:BBB<U>, U:Default {}
<anon>:7:8: 7:9 error: the type parameter `U` is not constrained by the impl trait, self type, or predicates [E0207]
<anon>:7 impl<T,U> AAA for SSS<T> where T:BBB<U>, U:Default {}
                ^
<anon>:7:8: 7:9 help: you can temporarily opt out of this rule by placing the `#[old_impl_check]` attribute on the impl
<anon>:7 impl<T,U> AAA for SSS<T> where T:BBB<U>, U:Default {}
                ^

I don't understand why I get the error, since U is constrained by the where predicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions