File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,11 +9,11 @@ use crate::arena::{Handle, HandleVec};
99pub struct Alignment ( NonZeroU32 ) ;
1010
1111impl Alignment {
12- pub const ONE : Self = Self ( unsafe { NonZeroU32 :: new_unchecked ( 1 ) } ) ;
13- pub const TWO : Self = Self ( unsafe { NonZeroU32 :: new_unchecked ( 2 ) } ) ;
14- pub const FOUR : Self = Self ( unsafe { NonZeroU32 :: new_unchecked ( 4 ) } ) ;
15- pub const EIGHT : Self = Self ( unsafe { NonZeroU32 :: new_unchecked ( 8 ) } ) ;
16- pub const SIXTEEN : Self = Self ( unsafe { NonZeroU32 :: new_unchecked ( 16 ) } ) ;
12+ pub const ONE : Self = Self ( NonZeroU32 :: new ( 1 ) . unwrap ( ) ) ;
13+ pub const TWO : Self = Self ( NonZeroU32 :: new ( 2 ) . unwrap ( ) ) ;
14+ pub const FOUR : Self = Self ( NonZeroU32 :: new ( 4 ) . unwrap ( ) ) ;
15+ pub const EIGHT : Self = Self ( NonZeroU32 :: new ( 8 ) . unwrap ( ) ) ;
16+ pub const SIXTEEN : Self = Self ( NonZeroU32 :: new ( 16 ) . unwrap ( ) ) ;
1717
1818 pub const MIN_UNIFORM : Self = Self :: SIXTEEN ;
1919
Original file line number Diff line number Diff line change @@ -85,16 +85,12 @@ impl IndirectValidation {
8585 "
8686 ) ;
8787
88- // SAFETY: The value we are passing to `new_unchecked` is not zero, so this is safe.
89- const SRC_BUFFER_SIZE : NonZeroU64 =
90- unsafe { NonZeroU64 :: new_unchecked ( size_of :: < u32 > ( ) as u64 * 3 ) } ;
88+ const SRC_BUFFER_SIZE : NonZeroU64 = NonZeroU64 :: new ( size_of :: < u32 > ( ) as u64 * 3 ) . unwrap ( ) ;
9189
92- // SAFETY: The value we are passing to `new_unchecked` is not zero, so this is safe.
93- const DST_BUFFER_SIZE : NonZeroU64 = unsafe {
94- NonZeroU64 :: new_unchecked (
95- SRC_BUFFER_SIZE . get ( ) * 2 , // From above: `dst: array<u32, 6>`
96- )
97- } ;
90+ const DST_BUFFER_SIZE : NonZeroU64 = NonZeroU64 :: new (
91+ SRC_BUFFER_SIZE . get ( ) * 2 , // From above: `dst: array<u32, 6>`
92+ )
93+ . unwrap ( ) ;
9894
9995 let module = naga:: front:: wgsl:: parse_str ( & src) . map_err ( |inner| {
10096 CreateShaderModuleError :: Parsing ( naga:: error:: ShaderError {
You can’t perform that action at this time.
0 commit comments