Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggests to wrap an attribute in Ok() #107113

Closed
Ploppz opened this issue Jan 20, 2023 · 1 comment · Fixed by #107254
Closed

suggests to wrap an attribute in Ok() #107113

Ploppz opened this issue Jan 20, 2023 · 1 comment · Fixed by #107254
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Ploppz
Copy link

Ploppz commented Jan 20, 2023

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)

@Ploppz Ploppz added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 20, 2023
@chenyukang
Copy link
Member

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 16, 2023
Do not provide suggestions when the spans come from expanded code that doesn't point at user code

Hide invalid proc-macro suggestions and track spans
coming from proc-macros pointing at attribute.

Effectively, unless the proc-macro keeps user spans,
suggestions will not be produced for the code they
produce.

r? `@ghost`

Fix rust-lang#107113, fix rust-lang#107976, fix rust-lang#107977, fix rust-lang#108748, fix rust-lang#106720, fix rust-lang#90557.

Could potentially address rust-lang#50141, rust-lang#67373, rust-lang#55146, rust-lang#78862, rust-lang#74043, rust-lang#88514, rust-lang#83320, rust-lang#91520, rust-lang#104071. CC rust-lang#50122, rust-lang#76360.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 17, 2023
Do not provide suggestions when the spans come from expanded code that doesn't point at user code

Hide invalid proc-macro suggestions and track spans
coming from proc-macros pointing at attribute.

Effectively, unless the proc-macro keeps user spans,
suggestions will not be produced for the code they
produce.

r? ``@ghost``

Fix rust-lang#107113, fix rust-lang#107976, fix rust-lang#107977, fix rust-lang#108748, fix rust-lang#106720, fix rust-lang#90557.

Could potentially address rust-lang#50141, rust-lang#67373, rust-lang#55146, rust-lang#78862, rust-lang#74043, rust-lang#88514, rust-lang#83320, rust-lang#91520, rust-lang#104071. CC rust-lang#50122, rust-lang#76360.
bors added a commit to rust-lang-ci/rust that referenced this issue Aug 2, 2023
…ugg-in-macro, r=estebank

Avoid wrong code suggesting for attribute macro

Fixes rust-lang#107113
r? `@estebank`
@bors bors closed this as completed in 75b9f53 Aug 3, 2023
flip1995 pushed a commit to flip1995/rust that referenced this issue Aug 11, 2023
…ugg-in-macro, r=estebank

Avoid wrong code suggesting for attribute macro

Fixes rust-lang#107113
r? `@estebank`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
2 participants