about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-22 05:27:04 +0000
committerbors <bors@rust-lang.org>2025-05-22 05:27:04 +0000
commit2cd37831b0706c9f2d6e7e20eb556dc7548bf732 (patch)
tree8eae85e0b199c35535351d335d0b2a6a8dc6d48e /compiler/rustc_mir_transform/src
parent6eef33bb399cabfab16aa4e0825895f5f32f4e26 (diff)
parenta31a39833afd0853c60629a8b6585b72b55685d1 (diff)
downloadrust-2cd37831b0706c9f2d6e7e20eb556dc7548bf732.tar.gz
rust-2cd37831b0706c9f2d6e7e20eb556dc7548bf732.zip
Auto merge of #141379 - matthiaskrgr:rollup-g1cz0ic, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #140431 (dont handle bool transmute)
 - #140868 (rustdoc: Fix links with inline code in trait impl docs)
 - #141323 (Add bors environment to CI)
 - #141337 (bump stdarch)
 - #141364 (rustdoc-json: Remove false docs and add test for inline attribute)
 - #141370 (add doc alias `replace_first` for `str::replacen`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/check_unnecessary_transmutes.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/check_unnecessary_transmutes.rs b/compiler/rustc_mir_transform/src/check_unnecessary_transmutes.rs
index 8da17a056e3..0514de3ea13 100644
--- a/compiler/rustc_mir_transform/src/check_unnecessary_transmutes.rs
+++ b/compiler/rustc_mir_transform/src/check_unnecessary_transmutes.rs
@@ -9,6 +9,7 @@ use crate::errors::UnnecessaryTransmute as Error;
 
 /// Check for transmutes that overlap with stdlib methods.
 /// For example, transmuting `[u8; 4]` to `u32`.
+/// We chose not to lint u8 -> bool transmutes, see #140431
 pub(super) struct CheckUnnecessaryTransmutes;
 
 impl<'tcx> crate::MirLint<'tcx> for CheckUnnecessaryTransmutes {
@@ -98,8 +99,6 @@ impl<'a, 'tcx> UnnecessaryTransmuteChecker<'a, 'tcx> {
             (Uint(_), Float(ty)) => err(format!("{}::from_bits({arg})", ty.name_str())),
             // bool → { x8 }
             (Bool, Int(..) | Uint(..)) => err(format!("({arg}) as {}", fn_sig.output())),
-            // u8 → bool
-            (Uint(_), Bool) => err(format!("({arg} == 1)")),
             _ => return None,
         })
     }