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

Ensure data structures are RefUnwindSafe on all versions of Rust #382

Merged
merged 1 commit into from
Apr 3, 2023

Commits on Apr 3, 2023

  1. Ensure data structures are RefUnwindSafe on all versions of Rust

    Previously it was not the case on versions from 1.32 through 1.57.
    
        error[E0277]: the type `UnsafeCell<usize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
          --> tests/marker.rs:13:13
           |
        13 |               assert_implemented::<$ty>();
           |               ^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<usize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
        ...
        82 | /     assert_unwind_safe! {
        83 | |         Delimiter
        84 | |         Group
        85 | |         Ident
        ...  |
        92 | |         TokenTree
        93 | |     }
           | |_____- in this macro invocation
           |
           = help: within `proc_macro2::Group`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<usize>`
           = note: required because it appears within the type `Cell<usize>`
           = note: required because it appears within the type `rc::RcBox<Vec<TokenTree>>`
           = note: required because it appears within the type `PhantomData<rc::RcBox<Vec<TokenTree>>>`
           = note: required because it appears within the type `Rc<Vec<TokenTree>>`
           = note: required because it appears within the type `proc_macro2::rcvec::RcVec<TokenTree>`
           = note: required because it appears within the type `fallback::TokenStream`
           = note: required because it appears within the type `fallback::Group`
           = note: required because it appears within the type `proc_macro2::imp::Group`
           = note: required because it appears within the type `proc_macro2::Group`
        note: required by a bound in `unwind_safe::Group::assert_implemented`
          --> tests/marker.rs:12:40
           |
        12 |               fn assert_implemented<T: $($marker +)+>() {}
           |                                          ^^^^^^^ required by this bound in `unwind_safe::Group::assert_implemented`
        ...
        82 | /     assert_unwind_safe! {
        83 | |         Delimiter
        84 | |         Group
        85 | |         Ident
        ...  |
        92 | |         TokenTree
        93 | |     }
           | |_____- in this macro invocation
           = note: this error originates in the macro `assert_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
    
        error[E0277]: the type `UnsafeCell<usize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
          --> tests/marker.rs:13:13
           |
        13 |               assert_implemented::<$ty>();
           |               ^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<usize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
        ...
        82 | /     assert_unwind_safe! {
        83 | |         Delimiter
        84 | |         Group
        85 | |         Ident
        ...  |
        92 | |         TokenTree
        93 | |     }
           | |_____- in this macro invocation
           |
           = help: within `TokenStream`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<usize>`
           = note: required because it appears within the type `Cell<usize>`
           = note: required because it appears within the type `rc::RcBox<Vec<TokenTree>>`
           = note: required because it appears within the type `PhantomData<rc::RcBox<Vec<TokenTree>>>`
           = note: required because it appears within the type `Rc<Vec<TokenTree>>`
           = note: required because it appears within the type `proc_macro2::rcvec::RcVec<TokenTree>`
           = note: required because it appears within the type `fallback::TokenStream`
           = note: required because it appears within the type `proc_macro2::imp::TokenStream`
           = note: required because it appears within the type `TokenStream`
        note: required by a bound in `unwind_safe::TokenStream::assert_implemented`
          --> tests/marker.rs:12:40
           |
        12 |               fn assert_implemented<T: $($marker +)+>() {}
           |                                          ^^^^^^^ required by this bound in `unwind_safe::TokenStream::assert_implemented`
        ...
        82 | /     assert_unwind_safe! {
        83 | |         Delimiter
        84 | |         Group
        85 | |         Ident
        ...  |
        92 | |         TokenTree
        93 | |     }
           | |_____- in this macro invocation
           = note: this error originates in the macro `assert_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
    
        error[E0277]: the type `UnsafeCell<usize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
          --> tests/marker.rs:13:13
           |
        13 |               assert_implemented::<$ty>();
           |               ^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<usize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
        ...
        82 | /     assert_unwind_safe! {
        83 | |         Delimiter
        84 | |         Group
        85 | |         Ident
        ...  |
        92 | |         TokenTree
        93 | |     }
           | |_____- in this macro invocation
           |
           = help: within `TokenTree`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<usize>`
           = note: required because it appears within the type `Cell<usize>`
           = note: required because it appears within the type `rc::RcBox<Vec<TokenTree>>`
           = note: required because it appears within the type `PhantomData<rc::RcBox<Vec<TokenTree>>>`
           = note: required because it appears within the type `Rc<Vec<TokenTree>>`
           = note: required because it appears within the type `proc_macro2::rcvec::RcVec<TokenTree>`
           = note: required because it appears within the type `fallback::TokenStream`
           = note: required because it appears within the type `fallback::Group`
           = note: required because it appears within the type `proc_macro2::imp::Group`
           = note: required because it appears within the type `proc_macro2::Group`
           = note: required because it appears within the type `TokenTree`
        note: required by a bound in `unwind_safe::TokenTree::assert_implemented`
          --> tests/marker.rs:12:40
           |
        12 |               fn assert_implemented<T: $($marker +)+>() {}
           |                                          ^^^^^^^ required by this bound in `unwind_safe::TokenTree::assert_implemented`
        ...
        82 | /     assert_unwind_safe! {
        83 | |         Delimiter
        84 | |         Group
        85 | |         Ident
        ...  |
        92 | |         TokenTree
        93 | |     }
           | |_____- in this macro invocation
           = note: this error originates in the macro `assert_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
    dtolnay committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    cda93c5 View commit details
    Browse the repository at this point in the history