• B
    Auto merge of #31925 - aturon:inherent-overlap, r=nikomatsakis · 1a019dc8
    bors 提交于
    Forbid items with the same name from appearing in overlapping inherent impl blocks
    
    For example, the following is now correctly illegal:
    
    ```rust
    struct Foo;
    
    impl Foo {
        fn id() {}
    }
    
    impl Foo {
        fn id() {}
    }
    ```
    
    "Overlapping" here is determined the same way it is for traits (and in fact shares the same code path): roughly, there must be some way of substituting any generic types to unify the impls, such that none of the `where` clauses are provably unsatisfiable under such a unification.
    
    Along the way, this PR also introduces an `ImplHeader` abstraction (the first commit) that makes it easier to work with impls abstractly (without caring whether they are trait or inherent impl blocks); see the first commit.
    
    Closes #22889
    r? @nikomatsakis
    1a019dc8
diagnostics.rs 78.3 KB