-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
macros: add "local" runtime flavor #7375
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6bd6650
macros: add "local" runtime flavor
Twey dad546f
`tokio-macros`: hard error if `flavor = "local"` and not `tokio_unsta…
Twey 225f6d7
`tokio-macros`: add docs for `flavor = "local"`
Twey 11f49dd
`tokio-macros`: don't run unstable usage examples
Twey 8bfcd4b
`tokio-macros`: use `ignore` instead of `no_run`
Twey 324222a
`tokio-macros`: put `local` validation logic with the rest
Twey 0bdde71
`tokio-macros`: use hidden `cfg` for `local` docs
Twey 92e156f
`tokio-macros`: emit compile error on `local` without unstable
Twey 3a29832
`tokio-macros`: add dummy `main` to disabled doctest blocks
Twey 213598d
`macros`: don't emit additional warnings when checks fail
Twey 0cc0f31
fix permissions
Twey b58144e
update compile errors for newer Rust
Twey e1117ec
Merge branch 'master' into local-macro
Darksonn 8c3d838
link `flavor` in `spawn_local` docs
Twey 0f436ec
unbreak docs
Twey 67abbc8
rerun tests
Twey 9933509
only emit panic if checks fail
Twey ac2ad0a
revert `macros_type_mismatch.stderr`
Twey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Twey marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please add logic to
rt_multi_thread_availableto detect whether--cfg tokio_unstableis set and emit a hard error if it is not.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 not sure I understand this comment. Did you mean to add the logic to
RuntimeFlavor::from_str?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.
The error should be similar to this error:
tokio/tokio-macros/src/entry.rs
Lines 193 to 197 in 2506c9f
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.
Maybe you meant a0ca77e; if I've misinterpreted please feel free to suggest changes :)
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.
Sorry, I just saw your comment. Is 4363203 more what you had in mind?
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 think both are okay.
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.
This is harder than it appears because
RUSTFLAGSis not passed to proc macros. I guess we have to emit acfgcheck, so it actually can't live in either of these places.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.
44a31b1 seems to work in my local tests.
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.
Doesn't that also trigger other unrelated errors when it fails?
What we do today is essentially define the
mainmacro two times to pass different values to thert_multi_threadboolean, and havelib.rsdo this:This way, the macro knows based on the cfgs that apply in the main Tokio crate. We could use the same approach and have four macros.
Uh oh!
There was an error while loading. Please reload this page.
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.
The quadratic explosion is a little bit scary to me. We can avoid emitting additional code if checks fail like 213598d.