-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Open
Twey
wants to merge
9
commits into
tokio-rs:master
Choose a base branch
from
Twey:local-macro
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 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 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The permission of this file is updated too. |
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
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_available
to detect whether--cfg tokio_unstable
is 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
RUSTFLAGS
is not passed to proc macros. I guess we have to emit acfg
check, 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
main
macro two times to pass different values to thert_multi_thread
boolean, and havelib.rs
do 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.