macros: allow setting unhandled_panic behavior in tokio::{main, test} by name1e5s · Pull Request #6593 · tokio-rs/tokio (original) (raw)

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 of ignore?
(The ignore annotation makes the doc a bit scary.)
Screen Shot 2024-06-03 at 19 57 29

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 of ignore? (The ignore annotation makes the doc a bit scary.) Screen Shot 2024-06-03 at 19 57 29

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.

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.

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.

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.

All tests looks fine now.