Implement char type in adapter fusion (#4544)
This commit implements the translation of `char` which validates that it's in the valid range of unicode scalar values. The precise validation here is lifted from LLVM in the hopes that it's probably better than whatever I would concoct by hand.
This commit is contained in:
@@ -28,6 +28,7 @@ pub enum Trap {
|
||||
CannotEnter,
|
||||
UnalignedPointer,
|
||||
InvalidDiscriminant,
|
||||
InvalidChar,
|
||||
AssertFailed(&'static str),
|
||||
}
|
||||
|
||||
@@ -101,6 +102,7 @@ impl fmt::Display for Trap {
|
||||
Trap::CannotEnter => "cannot enter instance".fmt(f),
|
||||
Trap::UnalignedPointer => "pointer not aligned correctly".fmt(f),
|
||||
Trap::InvalidDiscriminant => "invalid variant discriminant".fmt(f),
|
||||
Trap::InvalidChar => "invalid char value specified".fmt(f),
|
||||
Trap::AssertFailed(s) => write!(f, "assertion failure: {}", s),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user