Skip to content

Commit 2c22fc1

Browse files
committed
macros: improve try_join macro hygiene
The macro was previously relying on the library user not having any other `Ok` symbol in scope that didn't align with the expected variant in the standard library's `Result` type. Now, a full path to the standard library's `Ok` variant is used instead, which should protect the macro from compile errors that actually require looking at the underlying implementation to solve.
1 parent 6752f50 commit 2c22fc1

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

tokio/src/macros/support.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ cfg_macros! {
2929

3030
pub use std::future::{Future, IntoFuture};
3131
pub use std::pin::Pin;
32+
pub use std::result::Result;
3233
pub use std::task::{Context, Poll};

tokio/src/macros/try_join.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ doc! {macro_rules! try_join {
241241
if is_pending {
242242
$crate::macros::support::Poll::Pending
243243
} else {
244-
$crate::macros::support::Poll::Ready(Ok(($({
244+
$crate::macros::support::Poll::Ready($crate::macros::support::Result::Ok(($({
245245
// Extract the future for this branch from the tuple.
246246
let ( $($skip,)* fut, .. ) = &mut futures;
247247

0 commit comments

Comments
 (0)