mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-18 21:07:10 +00:00
The previous implementation was inconsistent about transitions that apply for an init byte. For example, when answering a query, an init byte could use corresponding init transition. Init byte could also use uninit transition, but only when the corresponding init transition was absent. This behaviour was incompatible with DFA union construction. Define an uninit transition to match an uninit byte only and update implementation accordingly. To describe that `Tree::uninit` is valid for any value, build an automaton that accepts any byte value. Additionally, represent byte ranges uniformly as a pair of integers to avoid special case for uninit byte.
27 lines
642 B
Rust
27 lines
642 B
Rust
//@ check-pass
|
|
// Regression test for issue #140337.
|
|
#![crate_type = "lib"]
|
|
#![feature(transmutability)]
|
|
#![allow(dead_code)]
|
|
use std::mem::{Assume, MaybeUninit, TransmuteFrom};
|
|
|
|
pub fn is_transmutable<Src, Dst>()
|
|
where
|
|
Dst: TransmuteFrom<Src, { Assume::SAFETY }>
|
|
{}
|
|
|
|
#[derive(Copy, Clone)]
|
|
#[repr(u8)]
|
|
pub enum B0 { Value = 0 }
|
|
|
|
#[derive(Copy, Clone)]
|
|
#[repr(u8)]
|
|
pub enum B1 { Value = 1 }
|
|
|
|
fn main() {
|
|
is_transmutable::<(B0, B0), MaybeUninit<(B0, B0)>>();
|
|
is_transmutable::<(B0, B0), MaybeUninit<(B0, B1)>>();
|
|
is_transmutable::<(B0, B0), MaybeUninit<(B1, B0)>>();
|
|
is_transmutable::<(B0, B0), MaybeUninit<(B1, B1)>>();
|
|
}
|