Skip to content

tracing::instrument doesn't work for -> ! on stable #3257

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

Open
oriongonza opened this issue Apr 14, 2025 · 5 comments
Open

tracing::instrument doesn't work for -> ! on stable #3257

oriongonza opened this issue Apr 14, 2025 · 5 comments

Comments

@oriongonza
Copy link

fn main() {}

#[tracing::instrument]
fn foo() -> ! {
    loop {}
}

Fails with

error[E0658]: the `!` type is experimental
 --> src/main.rs:4:13
  |
4 | fn foo() -> ! {
  |             ^
  |
@kaffarell
Copy link
Contributor

This is not related to tracing. The never-type has been reverted for quite some time: rust-lang/rust#67224

@oriongonza
Copy link
Author

oriongonza commented Apr 14, 2025

never type in return position has been stable for a long time: playground link

@kaffarell
Copy link
Contributor

@oriongonza
Copy link
Author

oriongonza commented Apr 21, 2025

My previous comment didn't link to anything useful. Oops :P
Corrected link

@kaffarell
Copy link
Contributor

The never type is still experimental, the fact that it works in the return position is a hack AFAICT rust-lang/rust#35121 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants