Unconstrained parameter fix by TomtheCoder2 · Pull Request #148788 · rust-lang/rust (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well there would another error if the Inner struct took a generic parameter. I made a similar example here:

struct Foo {x: N}

impl Foo {}

which obviously gives the error, that the generic parameter N should be provided for the implementation of Foo:

error[E0107]: missing generics for struct Foo --> src/lib.rs:3:9 | 3 | impl Foo {} | ^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: N --> src/lib.rs:1:8 | 1 | struct Foo {x: N} | ^^^ - help: add missing generic argument | 3 | impl Foo {} | +++

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

Therefore I would even suggest never suggesting to add the generic argument in general or did I miss some edgecase?
Or we could suggest adding it as a type parameter to the struct and to the impl