Skip to content

"overflow evaluating the requirement" regression in nightly-2020-12-27 #80807

Open
@is8ac

Description

@is8ac

Code

trait Foo {}

trait Bar {
    type Corge;
}

struct Fuga<T> {
    _a: T,
}

struct Piyo<T> {
    _b: T,
}

impl<T> Foo for Piyo<T> {}

impl<T> Bar for Fuga<T>
where
    T: Bar,
    Self::Corge: Foo,
{
    type Corge = Piyo<T>;
}

fn main() {}

Error

On current nightly or stable 1.49.0, rustc errors with:

error[E0275]: overflow evaluating the requirement `<Fuga<T> as Bar>::Corge == _`
  --> src/bin/demo.rs:17:1
   |
17 | / impl<T> Bar for Fuga<T>
18 | | where
19 | |     T: Bar,
20 | |     Self::Corge: Foo,
21 | | {
22 | |     type Corge = Piyo<T>;
23 | | }
   | |_^
   |
   = note: required because of the requirements on the impl of `Bar` for `Fuga<T>`

error[E0275]: overflow evaluating the requirement `<Fuga<T> as Bar>::Corge == _`
  --> src/bin/demo.rs:22:5
   |
22 |     type Corge = Piyo<T>;
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: required because of the requirements on the impl of `Bar` for `Fuga<T>`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0275`.

but on nightly-2020-12-20 it compiles without issue.

bisect-rustc gives:

searched nightlies: from nightly-2020-12-22 to nightly-2021-01-06
regressed nightly: nightly-2020-12-27
searched commits: from bb17823 to 0b644e4
regressed commit: 931aa27

bisected with cargo-bisect-rustc v0.6.0

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc 

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemP-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions