Skip to content

Some additional bounds on implemented trait methods are permitted, but not respected #29250

@petrochenkov

Description

@petrochenkov

This code successfully compiles on stable and nightly, but should supposedly be rejected for one of two reasons - incompatible method signature or "a does not live long enough"

trait Tr {
    fn f<T>(_: T) {}
}

impl Tr for u8 {
    fn f<T>(_: T) where T: 'static {} // Should this be rejected?
}

fn main() {
    let a = 10;
    u8::f(a);
    u8::f(&a); // Or should *this* be rejected?
}

cc @arielb1

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