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

Make it work on stable rust 1.53 #2

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

pudnax
Copy link
Contributor

@pudnax pudnax commented Jun 22, 2021

Feature const_in_array_repeat_expressions have been removed due to ambiguous drop order of ?Sised objects and other whatever reasons link.

And workaround is to make a constant for the value:

const SAMPLE: Option<F> = None;
pub fn new() -> Self {
    Executor {
        task_queue: [Self::SAMPLE; N],
    }
}

And below the using 0 as *const () is probably safe, but better to use ptr::null() and clippy also has style lint for this situation zero_ptr

Value of NULL is guaranteed by the standard to be 0. In practice, this particular feature was used in the first PDP machines, if I am not mistaken. if (ptr) and if (ptr == 0) and if (ptr == NULL) are always and everywhere equivalent https://twitter.com/typesanitizer/status/1333171905872891904

p.s.: I'm good at bad names :x

@XiangpengHao
Copy link
Owner

Looks good to me, thank you for the fix!

@XiangpengHao XiangpengHao merged commit 839ee96 into XiangpengHao:master Jun 22, 2021
@pudnax pudnax deleted the make_it_work branch June 24, 2021 19:43
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