Skip to content

suggests to wrap an attribute in Ok() #107113

Closed
@Ploppz

Description

@Ploppz

Code

#[actix_rt::main]
async fn main() -> std::io::Result<()> {}

Current output

error[E0308]: mismatched types
 --> src/main.rs:1:1
  |
1 | #[actix_rt::main]
  | ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
2 | async fn main() -> std::io::Result<()> {}
  |                    ------------------- expected `Result<(), std::io::Error>` because of return type
  |
  = note:   expected enum `Result<(), std::io::Error>`
          found unit type `()`
  = note: this error originates in the attribute macro `actix_rt::main` (in Nightly builds, run with -Z macro-backtrace for more info)
help: try wrapping the expression in `Ok`
  |
1 | Ok(#[actix_rt::main])
  | +++                 +

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

Desired output

Wrap the return value in Ok(), not the attribute...

Rationale and extra context

No response

Other cases

No response

Anything else?

rustc 1.68.0-nightly (4c83bd0 2023-01-19)

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions