error[E0308]: mismatched types --> $DIR/issue-35241.rs:13:20 | 13 | fn test() -> Foo { Foo } //~ ERROR mismatched types | --- ^^^ | | | | | expected struct `Foo`, found fn item | | did you mean `Foo(/* fields */)`? | expected `Foo` because of return type | = note: expected type `Foo` found type `fn(u32) -> Foo {Foo::{{constructor}}}` error: aborting due to previous error If you want more information on this error, try using "rustc --explain E0308"