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

macros: various error message improvements #3677

Merged
merged 5 commits into from
Apr 5, 2021

Conversation

davidpdrsn
Copy link
Member

Improves a few of the error messages for #[tokio::main] and #[tokio::test]. The changes are probably best illustrated by the new trybuild tests.

I also added a note to the docs about start_paused requiring the test-util feature which wasn't mentioned previously. Took me some digging to discover.

@davidpdrsn davidpdrsn added C-enhancement Category: A PR with an enhancement or bugfix. A-tokio-macros Area: The tokio-macros crate labels Apr 5, 2021
Comment on lines +52 to +53
27 | #[tokio::test(flavor = "foo")]
| ^^^^^
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would previously point to flavor even though "foo" is the problem.

Comment on lines +55 to +59
error: The `start_paused` option requires the `current_thread` runtime flavor. Use `#[tokio::test(flavor = "current_thread")]`
--> $DIR/macros_invalid_input.rs:30:55
|
30 | #[tokio::test(flavor = "multi_thread", start_paused = false)]
| ^^^^^
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding Use ... suggestion the user can copy-paste.

Comment on lines +61 to +65
error: Failed to parse value of `worker_threads` as integer.
--> $DIR/macros_invalid_input.rs:33:57
|
33 | #[tokio::test(flavor = "multi_thread", worker_threads = "foo")]
| ^^^^^
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added missing backticks.

Why does CI require this?
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me.

@davidpdrsn davidpdrsn merged commit 618d2bf into master Apr 5, 2021
@davidpdrsn davidpdrsn deleted the david/macro-ux-improvements branch April 5, 2021 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-macros Area: The tokio-macros crate C-enhancement Category: A PR with an enhancement or bugfix.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants