@@ -201,7 +201,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
201
201
64 => self
202
202
. constant_u64 ( self . span ( ) , memset_fill_u64 ( fill_byte) )
203
203
. def ( self ) ,
204
- _ => self . fatal ( & format ! (
204
+ _ => self . fatal ( format ! (
205
205
"memset on integer width {width} not implemented yet"
206
206
) ) ,
207
207
} ,
@@ -212,9 +212,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
212
212
64 => self
213
213
. constant_f64 ( self . span ( ) , f64:: from_bits ( memset_fill_u64 ( fill_byte) ) )
214
214
. 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" ) ) ,
218
216
} ,
219
217
SpirvType :: Adt { .. } => self . fatal ( "memset on structs not implemented yet" ) ,
220
218
SpirvType :: Vector { element, count } | SpirvType :: Matrix { element, count } => {
@@ -259,16 +257,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
259
257
16 => memset_dynamic_scalar ( self , fill_var, 2 , false ) ,
260
258
32 => memset_dynamic_scalar ( self , fill_var, 4 , false ) ,
261
259
64 => memset_dynamic_scalar ( self , fill_var, 8 , false ) ,
262
- _ => self . fatal ( & format ! (
260
+ _ => self . fatal ( format ! (
263
261
"memset on integer width {width} not implemented yet"
264
262
) ) ,
265
263
} ,
266
264
SpirvType :: Float ( width) => match width {
267
265
32 => memset_dynamic_scalar ( self , fill_var, 4 , true ) ,
268
266
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" ) ) ,
272
268
} ,
273
269
SpirvType :: Adt { .. } => self . fatal ( "memset on structs not implemented yet" ) ,
274
270
SpirvType :: Array { element, count } => {
@@ -805,7 +801,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
805
801
) {
806
802
fn construct_8 ( self_ : & Builder < ' _ , ' _ > , signed : bool , v : u128 ) -> Operand {
807
803
if v > u8:: MAX as u128 {
808
- self_. fatal ( & format ! (
804
+ self_. fatal ( format ! (
809
805
"Switches to values above u8::MAX not supported: {v:?}"
810
806
) )
811
807
} else if signed {
@@ -817,7 +813,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
817
813
}
818
814
fn construct_16 ( self_ : & Builder < ' _ , ' _ > , signed : bool , v : u128 ) -> Operand {
819
815
if v > u16:: MAX as u128 {
820
- self_. fatal ( & format ! (
816
+ self_. fatal ( format ! (
821
817
"Switches to values above u16::MAX not supported: {v:?}"
822
818
) )
823
819
} else if signed {
@@ -828,7 +824,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
828
824
}
829
825
fn construct_32 ( self_ : & Builder < ' _ , ' _ > , _signed : bool , v : u128 ) -> Operand {
830
826
if v > u32:: MAX as u128 {
831
- self_. fatal ( & format ! (
827
+ self_. fatal ( format ! (
832
828
"Switches to values above u32::MAX not supported: {v:?}"
833
829
) )
834
830
} else {
@@ -837,7 +833,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
837
833
}
838
834
fn construct_64 ( self_ : & Builder < ' _ , ' _ > , _signed : bool , v : u128 ) -> Operand {
839
835
if v > u64:: MAX as u128 {
840
- self_. fatal ( & format ! (
836
+ self_. fatal ( format ! (
841
837
"Switches to values above u64::MAX not supported: {v:?}"
842
838
) )
843
839
} else {
@@ -852,13 +848,13 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
852
848
16 => construct_16,
853
849
32 => construct_32,
854
850
64 => construct_64,
855
- other => self . fatal ( & format ! (
851
+ other => self . fatal ( format ! (
856
852
"switch selector cannot have width {other} (only 8, 16, 32, and 64 bits allowed)"
857
853
) ) ,
858
854
} ;
859
855
( signed, construct_case)
860
856
}
861
- other => self . fatal ( & format ! (
857
+ other => self . fatal ( format ! (
862
858
"switch selector cannot have non-integer type {}" ,
863
859
other. debug( v. ty, self )
864
860
) ) ,
@@ -947,7 +943,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
947
943
SpirvType :: Bool => self
948
944
. emit ( )
949
945
. logical_and ( ty, None , lhs. def ( self ) , rhs. def ( self ) ) ,
950
- o => self . fatal ( & format ! (
946
+ o => self . fatal ( format ! (
951
947
"and() not implemented for type {}" ,
952
948
o. debug( ty, self )
953
949
) ) ,
@@ -966,7 +962,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
966
962
SpirvType :: Bool => self
967
963
. emit ( )
968
964
. logical_or ( ty, None , lhs. def ( self ) , rhs. def ( self ) ) ,
969
- o => self . fatal ( & format ! (
965
+ o => self . fatal ( format ! (
970
966
"or() not implemented for type {}" ,
971
967
o. debug( ty, self )
972
968
) ) ,
@@ -986,7 +982,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
986
982
self . emit ( )
987
983
. logical_not_equal ( ty, None , lhs. def ( self ) , rhs. def ( self ) )
988
984
}
989
- o => self . fatal ( & format ! (
985
+ o => self . fatal ( format ! (
990
986
"xor() not implemented for type {}" ,
991
987
o. debug( ty, self )
992
988
) ) ,
@@ -1003,7 +999,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1003
999
self . emit ( )
1004
1000
. logical_not_equal ( val. ty , None , val. def ( self ) , true_. def ( self ) )
1005
1001
}
1006
- o => self . fatal ( & format ! (
1002
+ o => self . fatal ( format ! (
1007
1003
"not() not implemented for type {}" ,
1008
1004
o. debug( val. ty, self )
1009
1005
) ) ,
@@ -1104,7 +1100,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1104
1100
assert_ty_eq ! ( self , ty, pointee) ;
1105
1101
pointee
1106
1102
}
1107
- ty => self . fatal ( & format ! (
1103
+ ty => self . fatal ( format ! (
1108
1104
"load called on variable that wasn't a pointer: {ty:?}"
1109
1105
) ) ,
1110
1106
} ;
@@ -1133,7 +1129,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1133
1129
assert_ty_eq ! ( self , ty, pointee) ;
1134
1130
pointee
1135
1131
}
1136
- ty => self . fatal ( & format ! (
1132
+ ty => self . fatal ( format ! (
1137
1133
"atomic_load called on variable that wasn't a pointer: {ty:?}"
1138
1134
) ) ,
1139
1135
} ;
@@ -1160,7 +1156,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1160
1156
place : PlaceRef < ' tcx , Self :: Value > ,
1161
1157
) -> OperandRef < ' tcx , Self :: Value > {
1162
1158
if place. layout . is_zst ( ) {
1163
- return OperandRef :: new_zst ( self , place. layout ) ;
1159
+ return OperandRef :: zero_sized ( place. layout ) ;
1164
1160
}
1165
1161
1166
1162
let val = if let Some ( llextra) = place. llextra {
@@ -1236,7 +1232,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1236
1232
fn store ( & mut self , val : Self :: Value , ptr : Self :: Value , _align : Align ) -> Self :: Value {
1237
1233
let ptr_elem_ty = match self . lookup_type ( ptr. ty ) {
1238
1234
SpirvType :: Pointer { pointee } => pointee,
1239
- ty => self . fatal ( & format ! (
1235
+ ty => self . fatal ( format ! (
1240
1236
"store called on variable that wasn't a pointer: {ty:?}"
1241
1237
) ) ,
1242
1238
} ;
@@ -1268,7 +1264,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1268
1264
flags : MemFlags ,
1269
1265
) -> Self :: Value {
1270
1266
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:?}" ) ) ;
1272
1268
}
1273
1269
self . store ( val, ptr, align)
1274
1270
}
@@ -1282,7 +1278,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1282
1278
) {
1283
1279
let ptr_elem_ty = match self . lookup_type ( ptr. ty ) {
1284
1280
SpirvType :: Pointer { pointee } => pointee,
1285
- ty => self . fatal ( & format ! (
1281
+ ty => self . fatal ( format ! (
1286
1282
"atomic_store called on variable that wasn't a pointer: {ty:?}"
1287
1283
) ) ,
1288
1284
} ;
@@ -1320,7 +1316,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1320
1316
assert_ty_eq ! ( self , ty, pointee) ;
1321
1317
pointee
1322
1318
}
1323
- other => self . fatal ( & format ! (
1319
+ other => self . fatal ( format ! (
1324
1320
"struct_gep not on pointer type: {other:?}, index {idx}"
1325
1321
) ) ,
1326
1322
} ;
@@ -1335,7 +1331,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1335
1331
assert_eq ! ( idx, 0 ) ;
1336
1332
inner_type
1337
1333
}
1338
- other => self . fatal ( & format ! (
1334
+ other => self . fatal ( format ! (
1339
1335
"struct_gep not on struct, array, or vector type: {other:?}, index {idx}"
1340
1336
) ) ,
1341
1337
} ;
@@ -1480,7 +1476,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1480
1476
fn ptrtoint ( & mut self , val : Self :: Value , dest_ty : Self :: Type ) -> Self :: Value {
1481
1477
match self . lookup_type ( val. ty ) {
1482
1478
SpirvType :: Pointer { .. } => ( ) ,
1483
- other => self . fatal ( & format ! (
1479
+ other => self . fatal ( format ! (
1484
1480
"ptrtoint called on non-pointer source type: {other:?}"
1485
1481
) ) ,
1486
1482
}
@@ -1500,7 +1496,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1500
1496
fn inttoptr ( & mut self , val : Self :: Value , dest_ty : Self :: Type ) -> Self :: Value {
1501
1497
match self . lookup_type ( dest_ty) {
1502
1498
SpirvType :: Pointer { .. } => ( ) ,
1503
- other => self . fatal ( & format ! (
1499
+ other => self . fatal ( format ! (
1504
1500
"inttoptr called on non-pointer dest type: {other:?}"
1505
1501
) ) ,
1506
1502
}
@@ -1603,7 +1599,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1603
1599
. unwrap ( )
1604
1600
. with_type ( dest_ty)
1605
1601
}
1606
- ( val_ty, dest_ty_spv) => self . fatal ( & format ! (
1602
+ ( val_ty, dest_ty_spv) => self . fatal ( format ! (
1607
1603
"TODO: intcast not implemented yet: val={val:?} val.ty={val_ty:?} dest_ty={dest_ty_spv:?} is_signed={is_signed}"
1608
1604
) ) ,
1609
1605
}
@@ -1628,14 +1624,14 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1628
1624
1629
1625
_ => match self . lookup_type ( val. ty ) {
1630
1626
SpirvType :: Pointer { pointee } => ( val, pointee) ,
1631
- other => self . fatal ( & format ! (
1627
+ other => self . fatal ( format ! (
1632
1628
"pointercast called on non-pointer source type: {other:?}"
1633
1629
) ) ,
1634
1630
} ,
1635
1631
} ;
1636
1632
let dest_pointee = match self . lookup_type ( dest_ty) {
1637
1633
SpirvType :: Pointer { pointee } => pointee,
1638
- other => self . fatal ( & format ! (
1634
+ other => self . fatal ( format ! (
1639
1635
"pointercast called on non-pointer dest type: {other:?}"
1640
1636
) ) ,
1641
1637
} ;
@@ -1860,7 +1856,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1860
1856
IntSLT => self . fatal ( "TODO: boolean operator IntSLT not implemented yet" ) ,
1861
1857
IntSLE => self . fatal ( "TODO: boolean operator IntSLE not implemented yet" ) ,
1862
1858
} ,
1863
- other => self . fatal ( & format ! (
1859
+ other => self . fatal ( format ! (
1864
1860
"Int comparison not implemented on {}" ,
1865
1861
other. debug( lhs. ty, self )
1866
1862
) ) ,
@@ -1930,7 +1926,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1930
1926
flags : MemFlags ,
1931
1927
) {
1932
1928
if flags != MemFlags :: empty ( ) {
1933
- self . err ( & format ! (
1929
+ self . err ( format ! (
1934
1930
"memcpy with mem flags is not supported yet: {flags:?}"
1935
1931
) ) ;
1936
1932
}
@@ -1988,13 +1984,13 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
1988
1984
flags : MemFlags ,
1989
1985
) {
1990
1986
if flags != MemFlags :: empty ( ) {
1991
- self . err ( & format ! (
1987
+ self . err ( format ! (
1992
1988
"memset with mem flags is not supported yet: {flags:?}"
1993
1989
) ) ;
1994
1990
}
1995
1991
let elem_ty = match self . lookup_type ( ptr. ty ) {
1996
1992
SpirvType :: Pointer { pointee } => pointee,
1997
- _ => self . fatal ( & format ! (
1993
+ _ => self . fatal ( format ! (
1998
1994
"memset called on non-pointer type: {}" ,
1999
1995
self . debug_type( ptr. ty)
2000
1996
) ) ,
@@ -2038,9 +2034,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
2038
2034
fn extract_element ( & mut self , vec : Self :: Value , idx : Self :: Value ) -> Self :: Value {
2039
2035
let result_type = match self . lookup_type ( vec. ty ) {
2040
2036
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:?}" ) ) ,
2044
2038
} ;
2045
2039
match self . builder . lookup_const_u64 ( idx) {
2046
2040
Some ( const_index) => self . emit ( ) . composite_extract (
@@ -2084,7 +2078,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
2084
2078
SpirvType :: Array { element, .. }
2085
2079
| SpirvType :: Vector { element, .. }
2086
2080
| SpirvType :: Matrix { element, .. } => element,
2087
- other => self . fatal ( & format ! (
2081
+ other => self . fatal ( format ! (
2088
2082
"extract_value not implemented on type {}" ,
2089
2083
other. debug( agg_val. ty, self )
2090
2084
) ) ,
@@ -2105,7 +2099,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
2105
2099
SpirvType :: Adt { field_types, .. } => {
2106
2100
assert_ty_eq ! ( self , field_types[ idx as usize ] , elt. ty) ;
2107
2101
}
2108
- other => self . fatal ( & format ! ( "insert_value not implemented on type {other:?}" ) ) ,
2102
+ other => self . fatal ( format ! ( "insert_value not implemented on type {other:?}" ) ) ,
2109
2103
} ;
2110
2104
self . emit ( )
2111
2105
. composite_insert (
@@ -2173,7 +2167,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
2173
2167
) -> Self :: Value {
2174
2168
let dst_pointee_ty = match self . lookup_type ( dst. ty ) {
2175
2169
SpirvType :: Pointer { pointee } => pointee,
2176
- ty => self . fatal ( & format ! (
2170
+ ty => self . fatal ( format ! (
2177
2171
"atomic_cmpxchg called on variable that wasn't a pointer: {ty:?}"
2178
2172
) ) ,
2179
2173
} ;
@@ -2209,7 +2203,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
2209
2203
) -> Self :: Value {
2210
2204
let dst_pointee_ty = match self . lookup_type ( dst. ty ) {
2211
2205
SpirvType :: Pointer { pointee } => pointee,
2212
- ty => self . fatal ( & format ! (
2206
+ ty => self . fatal ( format ! (
2213
2207
"atomic_rmw called on variable that wasn't a pointer: {ty:?}"
2214
2208
) ) ,
2215
2209
} ;
@@ -2562,8 +2556,8 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
2562
2556
enum Inst < ' tcx , ID > {
2563
2557
Bitcast ( ID , ID ) ,
2564
2558
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 > ) ,
2567
2561
Store ( ID , ID ) ,
2568
2562
Load ( ID , ID ) ,
2569
2563
Call ( ID , ID , SmallVec < [ ID ; 4 ] > ) ,
0 commit comments