diff --git a/compiler/rustc_error_codes/src/error_codes/E0802.md b/compiler/rustc_error_codes/src/error_codes/E0802.md index 9088b100886d3..59061ff04359d 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0802.md +++ b/compiler/rustc_error_codes/src/error_codes/E0802.md @@ -6,6 +6,8 @@ Erroneous code examples: The target data is not a `struct`. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] enum NotStruct<'a, T: ?Sized> { Variant(&'a T), @@ -16,6 +18,8 @@ The target data has a layout that is not transparent, or `repr(transparent)` in other words. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] struct NotTransparent<'a, #[pointee] T: ?Sized> { ptr: &'a T, @@ -25,6 +29,8 @@ struct NotTransparent<'a, #[pointee] T: ?Sized> { The target data has no data field. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct NoField<'a, #[pointee] T: ?Sized> {} @@ -33,6 +39,8 @@ struct NoField<'a, #[pointee] T: ?Sized> {} The target data is not generic over any data, or has no generic type parameter. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct NoGeneric<'a>(&'a u8); @@ -42,6 +50,8 @@ The target data has multiple generic type parameters, but none is designated as a pointee for coercion. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct AmbiguousPointee<'a, T1: ?Sized, T2: ?Sized> { @@ -53,6 +63,8 @@ The target data has multiple generic type parameters that are designated as pointees for coercion. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct TooManyPointees< @@ -65,6 +77,8 @@ struct TooManyPointees< The type parameter that is designated as a pointee is not marked `?Sized`. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct NoMaybeSized<'a, #[pointee] T> {