mirror of
https://github.com/openharmony/third_party_rust_static-assertions-rs.git
synced 2026-07-20 01:04:23 -04:00
[Tests] Test assert_eq_size against Self type
The new implementation as of commit e48415c should enable this pattern.
This commit is contained in:
@@ -8,6 +8,22 @@ assert_eq_size!(byte; u8, u8, (u8,), [u8; 1]);
|
||||
#[cfg(feature = "failure")]
|
||||
assert_eq_size!(byte; u8, u8);
|
||||
|
||||
mod assoc_type {
|
||||
trait Trait {
|
||||
type AssocItem;
|
||||
}
|
||||
|
||||
impl<T> Trait for T {
|
||||
type AssocItem = Self;
|
||||
}
|
||||
|
||||
struct Value;
|
||||
|
||||
impl Value {
|
||||
assert_eq_size!(test; <Self as Trait>::AssocItem, Self);
|
||||
}
|
||||
}
|
||||
|
||||
// Placed in separate module so that DropCounter's fields are private
|
||||
mod dc {
|
||||
/// A type that acts somewhat of a reference counter.
|
||||
|
||||
Reference in New Issue
Block a user