@@ -303,12 +303,12 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
303303
304304 // Check if adding this static would exceed the cumulative limit
305305 if new_usage > CONSTANT_MEMORY_SIZE_LIMIT_BYTES {
306- self . tcx . sess . dcx ( ) . emit_err ( format ! (
306+ self . tcx . sess . dcx ( ) . err ( format ! (
307307 "cannot place static `{instance}` ({size_bytes} bytes) in constant memory: \
308- cumulative constant memory usage would be {new_usage} bytes, exceeding the {} byte limit. \
309- Current usage: {current_usage} bytes. \
310- Consider: (1) using `#[cuda_std::address_space(global)]` on less frequently accessed statics, \
311- (2) reducing static data sizes, or (3) disabling automatic constant memory placement",
308+ cumulative constant memory usage would be {new_usage} bytes, exceeding the {} byte limit. \
309+ Current usage: {current_usage} bytes. \
310+ Consider: (1) using `#[cuda_std::address_space(global)]` on less frequently accessed statics, \
311+ (2) reducing static data sizes, or (3) disabling automatic constant memory placement",
312312 CONSTANT_MEMORY_SIZE_LIMIT_BYTES
313313 ) ) ;
314314 return AddressSpace ( 1 ) ;
@@ -318,16 +318,19 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
318318 self . constant_memory_usage . set ( new_usage) ;
319319
320320 // If approaching the threshold: warns
321- if new_usage > CONSTANT_MEMORY_WARNING_THRESHOLD_BYTES &&
322- current_usage <= CONSTANT_MEMORY_WARNING_THRESHOLD_BYTES {
321+ if new_usage > CONSTANT_MEMORY_WARNING_THRESHOLD_BYTES
322+ && current_usage <= CONSTANT_MEMORY_WARNING_THRESHOLD_BYTES
323+ {
323324 self . tcx . sess . dcx ( ) . warn ( format ! (
324325 "constant memory usage is approaching the limit: {new_usage} / {} bytes ({:.1}% used)" ,
325326 CONSTANT_MEMORY_SIZE_LIMIT_BYTES ,
326327 ( new_usage as f64 / CONSTANT_MEMORY_SIZE_LIMIT_BYTES as f64 ) * 100.0
327328 ) ) ;
328329 }
329330
330- trace ! ( "Placing static `{instance}` ({size_bytes} bytes) in constant memory. Total usage: {new_usage} bytes" ) ;
331+ trace ! (
332+ "Placing static `{instance}` ({size_bytes} bytes) in constant memory. Total usage: {new_usage} bytes"
333+ ) ;
331334 AddressSpace ( 4 )
332335 }
333336 } else {
0 commit comments