Skip to content

Incorrect error for overflow in bound evaluation #29446

Closed
@wthrowe

Description

@wthrowe
#![allow(unconditional_recursion)]

struct X<T>(T);

trait A {
    fn foo(self);
}

impl<T> A for T {
    fn foo(self) {
        X(self).foo() // <-- error points here
    }
}

fn main() {
    1.foo();
}

reports error: overflow evaluating the requirement i32 : core::marker::Sized [E0275]. While this code certainly shouldn't work, I would not expect proving i32: Sized to be the problematic part.

(This is similar to #23714, but I think that's about the example failing to compile rather than the nonsense error.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions