@@ -6,6 +6,8 @@ Erroneous code examples:
66The target data is not a ` struct ` .
77
88``` compile_fail,E0802 
9+ #![feature(coerce_pointee)] 
10+ use std::marker::CoercePointee; 
911#[derive(CoercePointee)] 
1012enum NotStruct<'a, T: ?Sized> { 
1113    Variant(&'a T), 
@@ -16,6 +18,8 @@ The target data has a layout that is not transparent, or `repr(transparent)`
1618in other words.
1719
1820``` compile_fail,E0802 
21+ #![feature(coerce_pointee)] 
22+ use std::marker::CoercePointee; 
1923#[derive(CoercePointee)] 
2024struct NotTransparent<'a, #[pointee] T: ?Sized> { 
2125    ptr: &'a T, 
@@ -25,6 +29,8 @@ struct NotTransparent<'a, #[pointee] T: ?Sized> {
2529The target data has no data field.
2630
2731``` compile_fail,E0802 
32+ #![feature(coerce_pointee)] 
33+ use std::marker::CoercePointee; 
2834#[derive(CoercePointee)] 
2935#[repr(transparent)] 
3036struct NoField<'a, #[pointee] T: ?Sized> {} 
@@ -33,6 +39,8 @@ struct NoField<'a, #[pointee] T: ?Sized> {}
3339The target data is not generic over any data, or has no generic type parameter.
3440
3541``` compile_fail,E0802 
42+ #![feature(coerce_pointee)] 
43+ use std::marker::CoercePointee; 
3644#[derive(CoercePointee)] 
3745#[repr(transparent)] 
3846struct NoGeneric<'a>(&'a u8); 
@@ -42,6 +50,8 @@ The target data has multiple generic type parameters, but none is designated as
4250a pointee for coercion.
4351
4452``` compile_fail,E0802 
53+ #![feature(coerce_pointee)] 
54+ use std::marker::CoercePointee; 
4555#[derive(CoercePointee)] 
4656#[repr(transparent)] 
4757struct AmbiguousPointee<'a, T1: ?Sized, T2: ?Sized> { 
@@ -53,6 +63,8 @@ The target data has multiple generic type parameters that are designated as
5363pointees for coercion.
5464
5565``` compile_fail,E0802 
66+ #![feature(coerce_pointee)] 
67+ use std::marker::CoercePointee; 
5668#[derive(CoercePointee)] 
5769#[repr(transparent)] 
5870struct TooManyPointees< 
@@ -65,6 +77,8 @@ struct TooManyPointees<
6577The type parameter that is designated as a pointee is not marked ` ?Sized ` .
6678
6779``` compile_fail,E0802 
80+ #![feature(coerce_pointee)] 
81+ use std::marker::CoercePointee; 
6882#[derive(CoercePointee)] 
6983#[repr(transparent)] 
7084struct NoMaybeSized<'a, #[pointee] T> { 
0 commit comments