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

Update Rust edition to 2021. #2327

Merged
merged 1 commit into from
Jan 13, 2023
Merged

Update Rust edition to 2021. #2327

merged 1 commit into from
Jan 13, 2023

Conversation

xStrom
Copy link
Member

@xStrom xStrom commented Jan 12, 2023

It seems that we can rather easily upgrade to Rust 2021 and there is currently a direct benefit, so I think we should do it. Specifically clippy 1.67 (beta) is buggy with Rust 2018 as I found out in #2326. Upgrading to Rust 2021 will solve that issue for us.


There is an exception in druid-derive which will remain Rust 2018. We have macros that use syntax which is no longer allowed in Rust 2021.

This is mostly relevant to macros. E.g. quote!{ #a#b } is no longer accepted.

quote! {
    #[doc = #struct_docs]
    #[allow(non_camel_case_types)]
    #[derive(Debug, Copy, Clone)]
    pub struct #field_name#lens_ty_generics(#(#phantom_decls),*); // <- Illegal in Rust 2021

    impl #lens_ty_generics #field_name#lens_ty_generics{ // <- Illegal in Rust 2021
        #[doc = #fn_docs]
        pub const fn new()->Self{
            Self(#(#phantom_inits),*)
        }
    }
}

As druid-derive doesn't have any assert! or debug_assert! usage that clippy complains about, staying at 2018 there isn't an issue for us right now.

@xStrom xStrom added maintenance cleans up code or docs S-needs-review waits for review labels Jan 12, 2023
Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@xStrom xStrom merged commit 839ac47 into linebender:master Jan 13, 2023
@xStrom xStrom deleted the rust2021 branch January 13, 2023 16:03
@xStrom xStrom removed the S-needs-review waits for review label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance cleans up code or docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants