Skip to content

Overflowing evaluation in a simple trait #119370

Open
@zommiommy

Description

@zommiommy

I think it could be related to #113818

Code

use core::ops::Range;

pub trait MyTrait {
    type Iter<'a>: Iterator
    where
        <<Self as MyTrait>::Iter<'a> as Iterator>::Item: Clone,
        Self: 'a;
}

pub struct MyStruct;

impl MyTrait for MyStruct {
    type Iter<'a> = Range<usize>;
}

Playground link

Meta

The error is the same in rust 1.73, 1.74, nightly, and beta.

Error output

Compiling playground v0.0.1 (/playground)
error[E0275]: overflow evaluating the requirement `<MyStruct as MyTrait>::Iter<'a> == _`
  --> src/lib.rs:12:21
   |
12 |     type Iter<'a> = Range<usize>;
   |                     ^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0275`.
error: could not compile `playground` (lib) due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemA-type-systemArea: Type systemC-bugCategory: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types 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