@@ -201,7 +201,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
201201 64 => self
202202 . constant_u64 ( self . span ( ) , memset_fill_u64 ( fill_byte) )
203203 . def ( self ) ,
204- _ => self . fatal ( & format ! (
204+ _ => self . fatal ( format ! (
205205 "memset on integer width {width} not implemented yet"
206206 ) ) ,
207207 } ,
@@ -212,9 +212,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
212212 64 => self
213213 . constant_f64 ( self . span ( ) , f64:: from_bits ( memset_fill_u64 ( fill_byte) ) )
214214 . def ( self ) ,
215- _ => self . fatal ( & format ! (
216- "memset on float width {width} not implemented yet"
217- ) ) ,
215+ _ => self . fatal ( format ! ( "memset on float width {width} not implemented yet" ) ) ,
218216 } ,
219217 SpirvType :: Adt { .. } => self . fatal ( "memset on structs not implemented yet" ) ,
220218 SpirvType :: Vector { element, count } | SpirvType :: Matrix { element, count } => {
@@ -259,16 +257,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
259257 16 => memset_dynamic_scalar ( self , fill_var, 2 , false ) ,
260258 32 => memset_dynamic_scalar ( self , fill_var, 4 , false ) ,
261259 64 => memset_dynamic_scalar ( self , fill_var, 8 , false ) ,
262- _ => self . fatal ( & format ! (
260+ _ => self . fatal ( format ! (
263261 "memset on integer width {width} not implemented yet"
264262 ) ) ,
265263 } ,
266264 SpirvType :: Float ( width) => match width {
267265 32 => memset_dynamic_scalar ( self , fill_var, 4 , true ) ,
268266 64 => memset_dynamic_scalar ( self , fill_var, 8 , true ) ,
269- _ => self . fatal ( & format ! (
270- "memset on float width {width} not implemented yet"
271- ) ) ,
267+ _ => self . fatal ( format ! ( "memset on float width {width} not implemented yet" ) ) ,
272268 } ,
273269 SpirvType :: Adt { .. } => self . fatal ( "memset on structs not implemented yet" ) ,
274270 SpirvType :: Array { element, count } => {
@@ -805,7 +801,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
805801 ) {
806802 fn construct_8 ( self_ : & Builder < ' _ , ' _ > , signed : bool , v : u128 ) -> Operand {
807803 if v > u8:: MAX as u128 {
808- self_. fatal ( & format ! (
804+ self_. fatal ( format ! (
809805 "Switches to values above u8::MAX not supported: {v:?}"
810806 ) )
811807 } else if signed {
@@ -817,7 +813,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
817813 }
818814 fn construct_16 ( self_ : & Builder < ' _ , ' _ > , signed : bool , v : u128 ) -> Operand {
819815 if v > u16:: MAX as u128 {
820- self_. fatal ( & format ! (
816+ self_. fatal ( format ! (
821817 "Switches to values above u16::MAX not supported: {v:?}"
822818 ) )
823819 } else if signed {
@@ -828,7 +824,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
828824 }
829825 fn construct_32 ( self_ : & Builder < ' _ , ' _ > , _signed : bool , v : u128 ) -> Operand {
830826 if v > u32:: MAX as u128 {
831- self_. fatal ( & format ! (
827+ self_. fatal ( format ! (
832828 "Switches to values above u32::MAX not supported: {v:?}"
833829 ) )
834830 } else {
@@ -837,7 +833,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
837833 }
838834 fn construct_64 ( self_ : & Builder < ' _ , ' _ > , _signed : bool , v : u128 ) -> Operand {
839835 if v > u64:: MAX as u128 {
840- self_. fatal ( & format ! (
836+ self_. fatal ( format ! (
841837 "Switches to values above u64::MAX not supported: {v:?}"
842838 ) )
843839 } else {
@@ -852,13 +848,13 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
852848 16 => construct_16,
853849 32 => construct_32,
854850 64 => construct_64,
855- other => self . fatal ( & format ! (
851+ other => self . fatal ( format ! (
856852 "switch selector cannot have width {other} (only 8, 16, 32, and 64 bits allowed)"
857853 ) ) ,
858854 } ;
859855 ( signed, construct_case)
860856 }
861- other => self . fatal ( & format ! (
857+ other => self . fatal ( format ! (
862858 "switch selector cannot have non-integer type {}" ,
863859 other. debug( v. ty, self )
864860 ) ) ,
@@ -947,7 +943,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
947943 SpirvType :: Bool => self
948944 . emit ( )
949945 . logical_and ( ty, None , lhs. def ( self ) , rhs. def ( self ) ) ,
950- o => self . fatal ( & format ! (
946+ o => self . fatal ( format ! (
951947 "and() not implemented for type {}" ,
952948 o. debug( ty, self )
953949 ) ) ,
@@ -966,7 +962,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
966962 SpirvType :: Bool => self
967963 . emit ( )
968964 . logical_or ( ty, None , lhs. def ( self ) , rhs. def ( self ) ) ,
969- o => self . fatal ( & format ! (
965+ o => self . fatal ( format ! (
970966 "or() not implemented for type {}" ,
971967 o. debug( ty, self )
972968 ) ) ,
@@ -986,7 +982,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
986982 self . emit ( )
987983 . logical_not_equal ( ty, None , lhs. def ( self ) , rhs. def ( self ) )
988984 }
989- o => self . fatal ( & format ! (
985+ o => self . fatal ( format ! (
990986 "xor() not implemented for type {}" ,
991987 o. debug( ty, self )
992988 ) ) ,
@@ -1003,7 +999,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1003999 self . emit ( )
10041000 . logical_not_equal ( val. ty , None , val. def ( self ) , true_. def ( self ) )
10051001 }
1006- o => self . fatal ( & format ! (
1002+ o => self . fatal ( format ! (
10071003 "not() not implemented for type {}" ,
10081004 o. debug( val. ty, self )
10091005 ) ) ,
@@ -1104,7 +1100,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
11041100 assert_ty_eq ! ( self , ty, pointee) ;
11051101 pointee
11061102 }
1107- ty => self . fatal ( & format ! (
1103+ ty => self . fatal ( format ! (
11081104 "load called on variable that wasn't a pointer: {ty:?}"
11091105 ) ) ,
11101106 } ;
@@ -1133,7 +1129,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
11331129 assert_ty_eq ! ( self , ty, pointee) ;
11341130 pointee
11351131 }
1136- ty => self . fatal ( & format ! (
1132+ ty => self . fatal ( format ! (
11371133 "atomic_load called on variable that wasn't a pointer: {ty:?}"
11381134 ) ) ,
11391135 } ;
@@ -1160,7 +1156,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
11601156 place : PlaceRef < ' tcx , Self :: Value > ,
11611157 ) -> OperandRef < ' tcx , Self :: Value > {
11621158 if place. layout . is_zst ( ) {
1163- return OperandRef :: new_zst ( self , place. layout ) ;
1159+ return OperandRef :: zero_sized ( place. layout ) ;
11641160 }
11651161
11661162 let val = if let Some ( llextra) = place. llextra {
@@ -1236,7 +1232,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
12361232 fn store ( & mut self , val : Self :: Value , ptr : Self :: Value , _align : Align ) -> Self :: Value {
12371233 let ptr_elem_ty = match self . lookup_type ( ptr. ty ) {
12381234 SpirvType :: Pointer { pointee } => pointee,
1239- ty => self . fatal ( & format ! (
1235+ ty => self . fatal ( format ! (
12401236 "store called on variable that wasn't a pointer: {ty:?}"
12411237 ) ) ,
12421238 } ;
@@ -1268,7 +1264,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
12681264 flags : MemFlags ,
12691265 ) -> Self :: Value {
12701266 if flags != MemFlags :: empty ( ) {
1271- self . err ( & format ! ( "store_with_flags is not supported yet: {flags:?}" ) ) ;
1267+ self . err ( format ! ( "store_with_flags is not supported yet: {flags:?}" ) ) ;
12721268 }
12731269 self . store ( val, ptr, align)
12741270 }
@@ -1282,7 +1278,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
12821278 ) {
12831279 let ptr_elem_ty = match self . lookup_type ( ptr. ty ) {
12841280 SpirvType :: Pointer { pointee } => pointee,
1285- ty => self . fatal ( & format ! (
1281+ ty => self . fatal ( format ! (
12861282 "atomic_store called on variable that wasn't a pointer: {ty:?}"
12871283 ) ) ,
12881284 } ;
@@ -1320,7 +1316,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
13201316 assert_ty_eq ! ( self , ty, pointee) ;
13211317 pointee
13221318 }
1323- other => self . fatal ( & format ! (
1319+ other => self . fatal ( format ! (
13241320 "struct_gep not on pointer type: {other:?}, index {idx}"
13251321 ) ) ,
13261322 } ;
@@ -1335,7 +1331,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
13351331 assert_eq ! ( idx, 0 ) ;
13361332 inner_type
13371333 }
1338- other => self . fatal ( & format ! (
1334+ other => self . fatal ( format ! (
13391335 "struct_gep not on struct, array, or vector type: {other:?}, index {idx}"
13401336 ) ) ,
13411337 } ;
@@ -1480,7 +1476,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
14801476 fn ptrtoint ( & mut self , val : Self :: Value , dest_ty : Self :: Type ) -> Self :: Value {
14811477 match self . lookup_type ( val. ty ) {
14821478 SpirvType :: Pointer { .. } => ( ) ,
1483- other => self . fatal ( & format ! (
1479+ other => self . fatal ( format ! (
14841480 "ptrtoint called on non-pointer source type: {other:?}"
14851481 ) ) ,
14861482 }
@@ -1500,7 +1496,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
15001496 fn inttoptr ( & mut self , val : Self :: Value , dest_ty : Self :: Type ) -> Self :: Value {
15011497 match self . lookup_type ( dest_ty) {
15021498 SpirvType :: Pointer { .. } => ( ) ,
1503- other => self . fatal ( & format ! (
1499+ other => self . fatal ( format ! (
15041500 "inttoptr called on non-pointer dest type: {other:?}"
15051501 ) ) ,
15061502 }
@@ -1603,7 +1599,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
16031599 . unwrap ( )
16041600 . with_type ( dest_ty)
16051601 }
1606- ( val_ty, dest_ty_spv) => self . fatal ( & format ! (
1602+ ( val_ty, dest_ty_spv) => self . fatal ( format ! (
16071603 "TODO: intcast not implemented yet: val={val:?} val.ty={val_ty:?} dest_ty={dest_ty_spv:?} is_signed={is_signed}"
16081604 ) ) ,
16091605 }
@@ -1628,14 +1624,14 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
16281624
16291625 _ => match self . lookup_type ( val. ty ) {
16301626 SpirvType :: Pointer { pointee } => ( val, pointee) ,
1631- other => self . fatal ( & format ! (
1627+ other => self . fatal ( format ! (
16321628 "pointercast called on non-pointer source type: {other:?}"
16331629 ) ) ,
16341630 } ,
16351631 } ;
16361632 let dest_pointee = match self . lookup_type ( dest_ty) {
16371633 SpirvType :: Pointer { pointee } => pointee,
1638- other => self . fatal ( & format ! (
1634+ other => self . fatal ( format ! (
16391635 "pointercast called on non-pointer dest type: {other:?}"
16401636 ) ) ,
16411637 } ;
@@ -1860,7 +1856,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
18601856 IntSLT => self . fatal ( "TODO: boolean operator IntSLT not implemented yet" ) ,
18611857 IntSLE => self . fatal ( "TODO: boolean operator IntSLE not implemented yet" ) ,
18621858 } ,
1863- other => self . fatal ( & format ! (
1859+ other => self . fatal ( format ! (
18641860 "Int comparison not implemented on {}" ,
18651861 other. debug( lhs. ty, self )
18661862 ) ) ,
@@ -1930,7 +1926,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
19301926 flags : MemFlags ,
19311927 ) {
19321928 if flags != MemFlags :: empty ( ) {
1933- self . err ( & format ! (
1929+ self . err ( format ! (
19341930 "memcpy with mem flags is not supported yet: {flags:?}"
19351931 ) ) ;
19361932 }
@@ -1988,13 +1984,13 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
19881984 flags : MemFlags ,
19891985 ) {
19901986 if flags != MemFlags :: empty ( ) {
1991- self . err ( & format ! (
1987+ self . err ( format ! (
19921988 "memset with mem flags is not supported yet: {flags:?}"
19931989 ) ) ;
19941990 }
19951991 let elem_ty = match self . lookup_type ( ptr. ty ) {
19961992 SpirvType :: Pointer { pointee } => pointee,
1997- _ => self . fatal ( & format ! (
1993+ _ => self . fatal ( format ! (
19981994 "memset called on non-pointer type: {}" ,
19991995 self . debug_type( ptr. ty)
20001996 ) ) ,
@@ -2038,9 +2034,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
20382034 fn extract_element ( & mut self , vec : Self :: Value , idx : Self :: Value ) -> Self :: Value {
20392035 let result_type = match self . lookup_type ( vec. ty ) {
20402036 SpirvType :: Vector { element, .. } => element,
2041- other => self . fatal ( & format ! (
2042- "extract_element not implemented on type {other:?}"
2043- ) ) ,
2037+ other => self . fatal ( format ! ( "extract_element not implemented on type {other:?}" ) ) ,
20442038 } ;
20452039 match self . builder . lookup_const_u64 ( idx) {
20462040 Some ( const_index) => self . emit ( ) . composite_extract (
@@ -2084,7 +2078,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
20842078 SpirvType :: Array { element, .. }
20852079 | SpirvType :: Vector { element, .. }
20862080 | SpirvType :: Matrix { element, .. } => element,
2087- other => self . fatal ( & format ! (
2081+ other => self . fatal ( format ! (
20882082 "extract_value not implemented on type {}" ,
20892083 other. debug( agg_val. ty, self )
20902084 ) ) ,
@@ -2105,7 +2099,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
21052099 SpirvType :: Adt { field_types, .. } => {
21062100 assert_ty_eq ! ( self , field_types[ idx as usize ] , elt. ty) ;
21072101 }
2108- other => self . fatal ( & format ! ( "insert_value not implemented on type {other:?}" ) ) ,
2102+ other => self . fatal ( format ! ( "insert_value not implemented on type {other:?}" ) ) ,
21092103 } ;
21102104 self . emit ( )
21112105 . composite_insert (
@@ -2173,7 +2167,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
21732167 ) -> Self :: Value {
21742168 let dst_pointee_ty = match self . lookup_type ( dst. ty ) {
21752169 SpirvType :: Pointer { pointee } => pointee,
2176- ty => self . fatal ( & format ! (
2170+ ty => self . fatal ( format ! (
21772171 "atomic_cmpxchg called on variable that wasn't a pointer: {ty:?}"
21782172 ) ) ,
21792173 } ;
@@ -2209,7 +2203,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
22092203 ) -> Self :: Value {
22102204 let dst_pointee_ty = match self . lookup_type ( dst. ty ) {
22112205 SpirvType :: Pointer { pointee } => pointee,
2212- ty => self . fatal ( & format ! (
2206+ ty => self . fatal ( format ! (
22132207 "atomic_rmw called on variable that wasn't a pointer: {ty:?}"
22142208 ) ) ,
22152209 } ;
@@ -2562,8 +2556,8 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
25622556 enum Inst < ' tcx , ID > {
25632557 Bitcast ( ID , ID ) ,
25642558 CompositeExtract ( ID , ID , u32 ) ,
2565- AccessChain ( ID , ID , SpirvConst < ' tcx > ) ,
2566- InBoundsAccessChain ( ID , ID , SpirvConst < ' tcx > ) ,
2559+ AccessChain ( ID , ID , SpirvConst < ' tcx , ' tcx > ) ,
2560+ InBoundsAccessChain ( ID , ID , SpirvConst < ' tcx , ' tcx > ) ,
25672561 Store ( ID , ID ) ,
25682562 Load ( ID , ID ) ,
25692563 Call ( ID , ID , SmallVec < [ ID ; 4 ] > ) ,
0 commit comments