improve DiscriminantKind handling

This now reuses `fn discriminant_ty` in project, removing
some code duplication. Doing so made me realize that
we previously had a disagreement about the discriminant
type of generators, with MIR using `u32` and codegen and
trait selection using `i32`.

We now always use `u32`.
This commit is contained in:
Bastian Kauschke 2020-07-15 09:59:08 +02:00
parent 567ad7455d
commit fcf52c167f
5 changed files with 12 additions and 17 deletions

View file

@ -66,8 +66,8 @@ macro_rules! yield250 {
}
fn cycle(
gen: impl Generator<()> + Unpin + DiscriminantKind<Discriminant = i32>,
expected_max_discr: i32
gen: impl Generator<()> + Unpin + DiscriminantKind<Discriminant = u32>,
expected_max_discr: u32
) {
let mut gen = Box::pin(gen);
let mut max_discr = 0;