@@ -321,6 +321,36 @@ error: casting `isize` to `usize` may lose the sign of the value
321
321
LL | -1isize as usize;
322
322
| ^^^^^^^^^^^^^^^^
323
323
324
+ error: casting `i8` to `u8` may lose the sign of the value
325
+ --> tests/ui/cast.rs:119:5
326
+ |
327
+ LL | (-1i8).abs() as u8;
328
+ | ^^^^^^^^^^^^^^^^^^
329
+
330
+ error: casting `i16` to `u16` may lose the sign of the value
331
+ --> tests/ui/cast.rs:120:5
332
+ |
333
+ LL | (-1i16).abs() as u16;
334
+ | ^^^^^^^^^^^^^^^^^^^^
335
+
336
+ error: casting `i32` to `u32` may lose the sign of the value
337
+ --> tests/ui/cast.rs:121:5
338
+ |
339
+ LL | (-1i32).abs() as u32;
340
+ | ^^^^^^^^^^^^^^^^^^^^
341
+
342
+ error: casting `i64` to `u64` may lose the sign of the value
343
+ --> tests/ui/cast.rs:122:5
344
+ |
345
+ LL | (-1i64).abs() as u64;
346
+ | ^^^^^^^^^^^^^^^^^^^^
347
+
348
+ error: casting `isize` to `usize` may lose the sign of the value
349
+ --> tests/ui/cast.rs:123:5
350
+ |
351
+ LL | (-1isize).abs() as usize;
352
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
353
+
324
354
error: casting `i64` to `i8` may truncate the value
325
355
--> tests/ui/cast.rs:179:5
326
356
|
@@ -444,12 +474,36 @@ help: ... or use `try_from` and handle the error accordingly
444
474
LL | let c = u8::try_from(q / 1000);
445
475
| ~~~~~~~~~~~~~~~~~~~~~~
446
476
477
+ error: casting `i32` to `u32` may lose the sign of the value
478
+ --> tests/ui/cast.rs:372:9
479
+ |
480
+ LL | (x * x) as u32;
481
+ | ^^^^^^^^^^^^^^
482
+
483
+ error: casting `i32` to `u32` may lose the sign of the value
484
+ --> tests/ui/cast.rs:373:9
485
+ |
486
+ LL | x.pow(2) as u32;
487
+ | ^^^^^^^^^^^^^^^
488
+
489
+ error: casting `i32` to `u32` may lose the sign of the value
490
+ --> tests/ui/cast.rs:377:32
491
+ |
492
+ LL | let _a = |x: i32| -> u32 { (x * x * x * x) as u32 };
493
+ | ^^^^^^^^^^^^^^^^^^^^^^
494
+
447
495
error: casting `i32` to `u32` may lose the sign of the value
448
496
--> tests/ui/cast.rs:379:5
449
497
|
450
498
LL | (-2_i32).pow(3) as u32;
451
499
| ^^^^^^^^^^^^^^^^^^^^^^
452
500
501
+ error: casting `i32` to `u32` may lose the sign of the value
502
+ --> tests/ui/cast.rs:383:5
503
+ |
504
+ LL | (x * x) as u32;
505
+ | ^^^^^^^^^^^^^^
506
+
453
507
error: casting `i32` to `u32` may lose the sign of the value
454
508
--> tests/ui/cast.rs:384:5
455
509
|
@@ -462,6 +516,12 @@ error: casting `i16` to `u16` may lose the sign of the value
462
516
LL | (y * y * y * y * -2) as u16;
463
517
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
464
518
519
+ error: casting `i16` to `u16` may lose the sign of the value
520
+ --> tests/ui/cast.rs:390:5
521
+ |
522
+ LL | (y * y * y * y * 2) as u16;
523
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
524
+
465
525
error: casting `i16` to `u16` may lose the sign of the value
466
526
--> tests/ui/cast.rs:391:5
467
527
|
@@ -474,6 +534,12 @@ error: casting `i16` to `u16` may lose the sign of the value
474
534
LL | (y * y * y * -2) as u16;
475
535
| ^^^^^^^^^^^^^^^^^^^^^^^
476
536
537
+ error: casting `i32` to `u32` may lose the sign of the value
538
+ --> tests/ui/cast.rs:397:9
539
+ |
540
+ LL | (a * a * b * b * c * c) as u32;
541
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
542
+
477
543
error: casting `i32` to `u32` may lose the sign of the value
478
544
--> tests/ui/cast.rs:398:9
479
545
|
@@ -486,6 +552,12 @@ error: casting `i32` to `u32` may lose the sign of the value
486
552
LL | (a * -b * c) as u32;
487
553
| ^^^^^^^^^^^^^^^^^^^
488
554
555
+ error: casting `i32` to `u32` may lose the sign of the value
556
+ --> tests/ui/cast.rs:402:9
557
+ |
558
+ LL | (a * b * c * c) as u32;
559
+ | ^^^^^^^^^^^^^^^^^^^^^^
560
+
489
561
error: casting `i32` to `u32` may lose the sign of the value
490
562
--> tests/ui/cast.rs:403:9
491
563
|
@@ -498,6 +570,12 @@ error: casting `i32` to `u32` may lose the sign of the value
498
570
LL | (a * b * c * -2) as u32;
499
571
| ^^^^^^^^^^^^^^^^^^^^^^^
500
572
573
+ error: casting `i32` to `u32` may lose the sign of the value
574
+ --> tests/ui/cast.rs:407:9
575
+ |
576
+ LL | (a / b) as u32;
577
+ | ^^^^^^^^^^^^^^
578
+
501
579
error: casting `i32` to `u32` may lose the sign of the value
502
580
--> tests/ui/cast.rs:408:9
503
581
|
@@ -516,5 +594,11 @@ error: casting `i32` to `u32` may lose the sign of the value
516
594
LL | a.pow(3) as u32;
517
595
| ^^^^^^^^^^^^^^^
518
596
519
- error: aborting due to 63 previous errors
597
+ error: casting `i32` to `u32` may lose the sign of the value
598
+ --> tests/ui/cast.rs:414:9
599
+ |
600
+ LL | (a.abs() * b.pow(2) / c.abs()) as u32
601
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
602
+
603
+ error: aborting due to 77 previous errors
520
604
0 commit comments