-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
macros: allow setting unhandled_panic
behavior in tokio::{main, test}
#6593
Conversation
0c0a796
to
70c7c17
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see the documentation for this. Perhaps it will be placed tokio-macros/src/lib.rs
, there should already be similar docs there.
Thanks for your suggestion. Documantation is added now. |
b044fb8
to
d1e103b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, I left some comments regarding the docs.
639b69f
to
d8f02ad
Compare
d8f02ad
to
c886cde
Compare
tokio-macros/src/lib.rs
Outdated
/// | ||
/// This option is only compatible with the `current_thread` runtime. | ||
/// | ||
/// ```ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the other examples on this page, can you use
no_run
instead ofignore
? (Theignore
annotation makes the doc a bit scary.)
I tried and found it break those CI jobs running cargo test
without RUSTFLAGS="--cfg tokio_unstable"
, such as this link. Since we can't use conditional compilation tricks on examples, I think we can only use ignore
here to make CI happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that #[cfg(tokio_unstable)]
works perfectly fine inside an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that
#[cfg(tokio_unstable)]
works perfectly fine inside an example.
Yes, it works fine. I mean we can not use words like
```#[cfg(tokio_unstable)]
to disable an example entirely. But your comment reminds me that we can use #
lines to make the example works under cargo test
without tokio_unstable
, I will try it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that
#[cfg(tokio_unstable)]
works perfectly fine inside an example.Yes, it works fine. I mean we can not use words like
```#[cfg(tokio_unstable)]
to disable an example entirely. But your comment reminds me that we can use
#
lines to make the example works undercargo test
withouttokio_unstable
, I will try it.
All tests looks fine now.
c546470
to
c886cde
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks.
bc41125
to
6d46e25
Compare
6d46e25
to
30d9d22
Compare
Motivation
Allow users to set
unhandled_panic
behavior in those macros directly.Close #6527.
Solution
This PR parses
unhandled_panic
intokio-macros
.