mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 23:29:50 +00:00
Enforce opaque Rust types are unpin for now
This commit is contained in:
parent
c90897fb2f
commit
20fa62bf71
@ -489,10 +489,14 @@ fn expand_rust_type_assert_sized(ety: &ExternType) -> TokenStream {
|
||||
let sized = quote_spanned! {ety.semi_token.span=>
|
||||
#begin_span std::marker::Sized
|
||||
};
|
||||
let unpin = quote_spanned! {ety.semi_token.span=>
|
||||
#begin_span std::marker::Unpin
|
||||
};
|
||||
quote_spanned! {ident.span()=>
|
||||
let _ = {
|
||||
fn __AssertSized<T: ?#sized + #sized>() {}
|
||||
__AssertSized::<#ident>
|
||||
fn __AssertUnpin<T: #unpin>() {}
|
||||
(__AssertSized::<#ident>, __AssertUnpin::<#ident>)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
10
tests/ui/rust_pinned.stderr
Normal file
10
tests/ui/rust_pinned.stderr
Normal file
@ -0,0 +1,10 @@
|
||||
error[E0277]: `PhantomPinned` cannot be unpinned
|
||||
--> $DIR/rust_pinned.rs:6:14
|
||||
|
|
||||
6 | type Pinned;
|
||||
| -----^^^^^^-
|
||||
| | |
|
||||
| | within `Pinned`, the trait `Unpin` is not implemented for `PhantomPinned`
|
||||
| required by this bound in `__AssertUnpin`
|
||||
|
|
||||
= note: required because it appears within the type `Pinned`
|
Loading…
Reference in New Issue
Block a user