diff --git a/src/test/ui/enum-discriminant/discriminant_value.rs b/src/test/ui/enum-discriminant/discriminant_value.rs index 32d2d40241c..eb60aaf4b2d 100644 --- a/src/test/ui/enum-discriminant/discriminant_value.rs +++ b/src/test/ui/enum-discriminant/discriminant_value.rs @@ -51,31 +51,31 @@ enum Mixed { } pub fn main() { - assert_eq!(discriminant_value(&CLike1::A), 0); + assert_eq!(discriminant_value(&CLike1::A), 0isize); assert_eq!(discriminant_value(&CLike1::B), 1); assert_eq!(discriminant_value(&CLike1::C), 2); assert_eq!(discriminant_value(&CLike1::D), 3); - assert_eq!(discriminant_value(&CLike2::A), 5); + assert_eq!(discriminant_value(&CLike2::A), 5isize); assert_eq!(discriminant_value(&CLike2::B), 2); assert_eq!(discriminant_value(&CLike2::C), 19); assert_eq!(discriminant_value(&CLike2::D), 20); - assert_eq!(discriminant_value(&CLike3::A), 5); + assert_eq!(discriminant_value(&CLike3::A), 5i8); assert_eq!(discriminant_value(&CLike3::B), 6); - assert_eq!(discriminant_value(&CLike3::C), -1_i8 as u64); + assert_eq!(discriminant_value(&CLike3::C), -1); assert_eq!(discriminant_value(&CLike3::D), 0); - assert_eq!(discriminant_value(&ADT::First(0,0)), 0); + assert_eq!(discriminant_value(&ADT::First(0,0)), 0isize); assert_eq!(discriminant_value(&ADT::Second(5)), 1); - assert_eq!(discriminant_value(&NullablePointer::Nothing), 1); + assert_eq!(discriminant_value(&NullablePointer::Nothing), 1isize); assert_eq!(discriminant_value(&NullablePointer::Something(&CONST)), 0); - assert_eq!(discriminant_value(&10), 0); - assert_eq!(discriminant_value(&"test"), 0); + assert_eq!(discriminant_value(&10), 0u8); + assert_eq!(discriminant_value(&"test"), 0u8); - assert_eq!(3, discriminant_value(&Mixed::Unit)); - assert_eq!(2, discriminant_value(&Mixed::Tuple(5))); - assert_eq!(1, discriminant_value(&Mixed::Struct{a: 7, b: 11})); + assert_eq!(discriminant_value(&Mixed::Unit), 3isize); + assert_eq!(discriminant_value(&Mixed::Tuple(5)), 2); + assert_eq!(discriminant_value(&Mixed::Struct{a: 7, b: 11}), 1); } diff --git a/src/test/ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs b/src/test/ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs index 05911a9a303..5a528379b04 100644 --- a/src/test/ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs +++ b/src/test/ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs @@ -13,5 +13,5 @@ enum MyWeirdOption { fn main() { assert_eq!(discriminant_value(&MyWeirdOption::<()>::None), 0); - assert_eq!(discriminant_value(&MyWeirdOption::Some(())), core::mem::size_of::() as u64); + assert_eq!(discriminant_value(&MyWeirdOption::Some(())), core::mem::size_of::()); } diff --git a/src/test/ui/generator/discriminant.rs b/src/test/ui/generator/discriminant.rs index 8a0f8a380ab..3d0930da422 100644 --- a/src/test/ui/generator/discriminant.rs +++ b/src/test/ui/generator/discriminant.rs @@ -3,10 +3,10 @@ // run-pass -#![feature(generators, generator_trait, core_intrinsics)] +#![feature(generators, generator_trait, core_intrinsics, discriminant_kind)] use std::intrinsics::discriminant_value; -use std::marker::Unpin; +use std::marker::{Unpin, DiscriminantKind}; use std::mem::size_of_val; use std::{cmp, ops::*}; @@ -65,7 +65,10 @@ macro_rules! yield250 { }; } -fn cycle(gen: impl Generator<()> + Unpin, expected_max_discr: u64) { +fn cycle( + gen: impl Generator<()> + Unpin + DiscriminantKind, + expected_max_discr: i32 +) { let mut gen = Box::pin(gen); let mut max_discr = 0; loop {