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
From my reading of the docs for unimplemented!(), this code should typecheck. However, when I try to compile it I get this type error:
Compiling playground v0.0.1(/playground)
error[E0277]: the trait bound `():Spam` is not satisfied
--> src/lib.rs:5:20
|
5 | fn foo(bar:u8) -> implSpam{
| ^^^^^^^^^ the trait `Spam` is not implemented for `()`
6 | unimplemented!();
| -------- consider removing this semicolon
|
= note: the return type of a function must have a statically known size
error: aborting due to previous error
If I remove the semicolon I get this error:
Compiling playground v0.0.1(/playground)
error[E0277]: the trait bound `():Spam` is not satisfied
--> src/lib.rs:5:20
|
5 | fn foo(bar:u8) -> implSpam{
| ^^^^^^^^^ the trait `Spam` is not implemented for `()`
6 | unimplemented!()
| ---------------- this returned value is of type `!`
|
= note: the return type of a function must have a statically known size
error:aborting due to previous error
I tried this code:
From my reading of the docs for
unimplemented!()
, this code should typecheck. However, when I try to compile it I get this type error:If I remove the semicolon I get this error:
The same issue happens with the
todo!()
macro.Meta
When tested in the playground I get this error in stable 1.43.1, beta, and nightly.
Playground link to example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c62d0cbe9dd4e72fe0aaff17a18b53d0
The text was updated successfully, but these errors were encountered: