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

Add missing const _IS_BIASED in test/mpsc.rs #149

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

rikkaka
Copy link

@rikkaka rikkaka commented Jun 8, 2024

When I clone this repo to local and run cargo test, the compilation fails with "cannot find value _IS_BIASED in this scope" after the expansion of macro select.

flume/tests/mpsc.rs

Lines 174 to 187 in fcf3849

macro_rules! select {
(
$($name:pat = $rx:ident.$meth:ident() => $code:expr),+
) => ({
crossbeam_channel_internal! {
$(
recv(($rx).inner) -> res => {
let $name = res.map_err(|_| ::std::sync::mpsc::RecvError);
$code
}
)+
}
})
}

What's more, I forked this repo and tried github workflows, which failed due to same reason.

I find it uses a macro export from crossbeam-channel. flume specifies crossbeam-channel = "0.5.5" in [dev-dependencies]. However, crossbeam-channel of version 0.5.5 has been yanked, so actually the newest version 0.5.13 is used. In the new version, a new value _IS_BIASED is used in macro crossbeam_channel_internal, resulting in the error above.

I find two use cases of crossbeam_channel_internal in crossbeam-channel here:

macro_rules! select {
    ($($tokens:tt)*) => {
        {
            const _IS_BIASED: bool = false;


            $crate::crossbeam_channel_internal!(
                $($tokens)*
            )
        }
    };
}
#[macro_export]
macro_rules! select_biased {
    ($($tokens:tt)*) => {
        {
            const _IS_BIASED: bool = true;

            $crate::crossbeam_channel_internal!(
                $($tokens)*
            )
        }
    };
}

If this select macro is intended to work the same as select macro in crossbeam_channel_internal, adding the const _IS_BIASED with value false may help. After I added this value, the cargo test succeeded.

@zesterer
Copy link
Owner

Thanks!

@zesterer zesterer merged commit bb5623b into zesterer:master Jun 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants