Skip to content

Commit a16ee12

Browse files
committed
Impl StructuralEq & ConstParamTy for str, &T, [T; N] and [T]
1 parent 740726d commit a16ee12

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

core/src/marker.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,18 @@ pub trait StructuralEq {
268268
// Empty.
269269
}
270270

271+
// FIXME: Remove special cases of these types from the compiler pattern checking code and always check `T: StructuralEq` instead
271272
marker_impls! {
272273
#[unstable(feature = "structural_match", issue = "31434")]
273274
StructuralEq for
274275
usize, u8, u16, u32, u64, u128,
275276
isize, i8, i16, i32, i64, i128,
276277
bool,
277278
char,
279+
str /* Technically requires `[u8]: StructuralEq` */,
280+
{T: ConstParamTy, const N: usize} [T; N],
281+
{T: ConstParamTy} [T],
282+
{T: ConstParamTy} &T,
278283
}
279284

280285
/// Types whose values can be duplicated simply by copying bits.
@@ -988,6 +993,10 @@ marker_impls! {
988993
isize, i8, i16, i32, i64, i128,
989994
bool,
990995
char,
996+
str /* Technically requires `[u8]: ConstParamTy` */,
997+
{T: ConstParamTy, const N: usize} [T; N],
998+
{T: ConstParamTy} [T],
999+
{T: ConstParamTy} &T,
9911000
}
9921001

9931002
/// A common trait implemented by all function pointers.

0 commit comments

Comments
 (0)