Rollup merge of #140284 - bend-n:fix-expectation-unmet, r=jieyouxu
remove expect() in `unnecessary_transmutes` removes expect() from #136083 and fixes #140277 includes regression test r? lcnr
This commit is contained in:
commit
432393972c
3 changed files with 22 additions and 5 deletions
|
|
@ -0,0 +1,10 @@
|
|||
//@ compile-flags: --remap-path-prefix=/=/non-existent
|
||||
// helper for ../unnecessary-transmute-path-remap-ice-140277.rs
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! transmute {
|
||||
($e:expr) => {{
|
||||
let e = $e;
|
||||
std::mem::transmute(e)
|
||||
}};
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
//@ aux-crate: zerocopy=unnecessary-transmute-path-remap-ice-140277-trans.rs
|
||||
//@ check-pass
|
||||
// tests for a regression in linting for unnecessary transmutes
|
||||
// where a span was inacessible for snippet procuring,
|
||||
// when remap-path-prefix was set, causing a panic.
|
||||
|
||||
fn bytes_at_home(x: [u8; 4]) -> u32 {
|
||||
unsafe { zerocopy::transmute!(x) }
|
||||
}
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue