]>
git.proxmox.com Git - rustc.git/blob - tests/ui/rfc-2008-non-exhaustive/uninhabited/coercions.rs
1 // aux-build:uninhabited.rs
2 #![feature(never_type)]
4 extern crate uninhabited
;
9 UninhabitedTupleStruct
,
13 // This test checks that uninhabited non-exhaustive types cannot coerce to any type, as the never
18 fn can_coerce_never_type_to_anything(x
: !) -> A
{
22 fn cannot_coerce_empty_enum_to_anything(x
: UninhabitedEnum
) -> A
{
23 x
//~ ERROR mismatched types
26 fn cannot_coerce_empty_tuple_struct_to_anything(x
: UninhabitedTupleStruct
) -> A
{
27 x
//~ ERROR mismatched types
30 fn cannot_coerce_empty_struct_to_anything(x
: UninhabitedStruct
) -> A
{
31 x
//~ ERROR mismatched types
34 fn cannot_coerce_enum_with_empty_variants_to_anything(x
: UninhabitedVariants
) -> A
{
35 x
//~ ERROR mismatched types