You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0308]: mismatched types
--> src/main.rs:10:5
|
9 | fn test0(foo: impl Trait) {
| - possibly return type missing here?
10 | foo - foo
| ^^^^^^^^^ expected `()`, found associated type
|
= note: expected unit type `()`
found associated type `<impl Trait as Sub>::Output`
= help: consider constraining the associated type `<impl Trait as Sub>::Output` to `()`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
Maybe that's helpful enough? This definitely doesn't seem like a bug though, I'm going to change it to a diagnostic request.
error[E0562]: `impl Trait` is not allowed in paths
--> src/main.rs:8:31
|
8 | fn test0(foo: impl Trait) -> <impl Trait as std::ops::Sub>::Output {
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
Closing this issue as this code doesn't compile any more as intended, and maybe the diagnostic should be improved but i feel that's better as a new issue
Activity
ExpHP commentedon Jan 23, 2018
Should this even compile? I would have figured that the
impl Traitin the output type should be considered ambiguous.ExpHP commentedon Feb 28, 2018
#48084 makes the snippet no longer compile.
That said, I can see what originally led the author to write this signature; observe the error message for an incorrect return type:
jyn514 commentedon Jul 7, 2021
Triage: the error message for
foo0is nowMaybe that's helpful enough? This definitely doesn't seem like a bug though, I'm going to change it to a diagnostic request.
Dylan-DPC commentedon Dec 11, 2024
Current output: playground link
Dylan-DPC commentedon Dec 11, 2024
Closing this issue as this code doesn't compile any more as intended, and maybe the diagnostic should be improved but i feel that's better as a new issue