Skip to content

Warn when known types are used as generic placeholders #54905

@lu-zero

Description

@lu-zero

Since hardly it is what you want and it leads to funny error messages, here an example:

struct S<T> {
    foo: T,
}
impl<u16> S<u16> {
    fn fee(&self, idx: usize) -> u16 {
        if (self.foo as usize) < idx {
            idx as u16
        } else {
            4
        }
    }
}
fn main() {
    let f: S<u16> = S { foo: 42 };
    println!(" {}", f.fee(13));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions