Skip to content

Commit fc9c4b9

Browse files
committed
Auto merge of #120991 - matthiaskrgr:rollup-f8kw2st, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #118983 (Warn on references casting to bigger memory layout) - #119451 (Gate PR CI on clippy correctness lints) - #120273 (compiletest: few naive improvements) - #120950 (Fix async closures in CTFE) - #120958 (Dejargonize `subst`) - #120965 (Add lahfsahf and prfchw target feature) - #120970 (add another test for promoteds-in-static) - #120979 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 18f02ea + bcae44a commit fc9c4b9

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

clippy_lints/src/redundant_locals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantLocals {
101101
fn is_by_value_closure_capture(cx: &LateContext<'_>, redefinition: HirId, root_variable: HirId) -> bool {
102102
let closure_def_id = cx.tcx.hir().enclosing_body_owner(redefinition);
103103

104-
cx.tcx.is_closure_or_coroutine(closure_def_id.to_def_id())
104+
cx.tcx.is_closure_like(closure_def_id.to_def_id())
105105
&& cx.tcx.closure_captures(closure_def_id).iter().any(|c| {
106106
matches!(c.info.capture_kind, UpvarCapture::ByValue)
107107
&& matches!(c.place.base, PlaceBase::Upvar(upvar) if upvar.var_path.hir_id == root_variable)

tests/ui/transmute_ptr_to_ptr.fixed

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ fn transmute_ptr_to_ptr() {
3535
// ref-ref transmutes; bad
3636
let _: &f32 = &*(&1u32 as *const u32 as *const f32);
3737
//~^ ERROR: transmute from a reference to a reference
38-
let _: &f64 = &*(&1f32 as *const f32 as *const f64);
38+
let _: &f32 = &*(&1f64 as *const f64 as *const f32);
3939
//~^ ERROR: transmute from a reference to a reference
4040
//:^ this test is here because both f32 and f64 are the same TypeVariant, but they are not
4141
// the same type
4242
let _: &mut f32 = &mut *(&mut 1u32 as *mut u32 as *mut f32);
4343
//~^ ERROR: transmute from a reference to a reference
4444
let _: &GenericParam<f32> = &*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>);
4545
//~^ ERROR: transmute from a reference to a reference
46-
let u8_ref: &u8 = &0u8;
47-
let u64_ref: &u64 = unsafe { &*(u8_ref as *const u8 as *const u64) };
46+
let u64_ref: &u64 = &0u64;
47+
let u8_ref: &u8 = unsafe { &*(u64_ref as *const u64 as *const u8) };
4848
//~^ ERROR: transmute from a reference to a reference
4949
}
5050

tests/ui/transmute_ptr_to_ptr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ fn transmute_ptr_to_ptr() {
3535
// ref-ref transmutes; bad
3636
let _: &f32 = std::mem::transmute(&1u32);
3737
//~^ ERROR: transmute from a reference to a reference
38-
let _: &f64 = std::mem::transmute(&1f32);
38+
let _: &f32 = std::mem::transmute(&1f64);
3939
//~^ ERROR: transmute from a reference to a reference
4040
//:^ this test is here because both f32 and f64 are the same TypeVariant, but they are not
4141
// the same type
4242
let _: &mut f32 = std::mem::transmute(&mut 1u32);
4343
//~^ ERROR: transmute from a reference to a reference
4444
let _: &GenericParam<f32> = std::mem::transmute(&GenericParam { t: 1u32 });
4545
//~^ ERROR: transmute from a reference to a reference
46-
let u8_ref: &u8 = &0u8;
47-
let u64_ref: &u64 = unsafe { std::mem::transmute(u8_ref) };
46+
let u64_ref: &u64 = &0u64;
47+
let u8_ref: &u8 = unsafe { std::mem::transmute(u64_ref) };
4848
//~^ ERROR: transmute from a reference to a reference
4949
}
5050

tests/ui/transmute_ptr_to_ptr.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ LL | let _: &f32 = std::mem::transmute(&1u32);
2222
error: transmute from a reference to a reference
2323
--> $DIR/transmute_ptr_to_ptr.rs:38:23
2424
|
25-
LL | let _: &f64 = std::mem::transmute(&1f32);
26-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1f32 as *const f32 as *const f64)`
25+
LL | let _: &f32 = std::mem::transmute(&1f64);
26+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1f64 as *const f64 as *const f32)`
2727

2828
error: transmute from a reference to a reference
2929
--> $DIR/transmute_ptr_to_ptr.rs:42:27
@@ -38,10 +38,10 @@ LL | let _: &GenericParam<f32> = std::mem::transmute(&GenericParam { t:
3838
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`
3939

4040
error: transmute from a reference to a reference
41-
--> $DIR/transmute_ptr_to_ptr.rs:47:38
41+
--> $DIR/transmute_ptr_to_ptr.rs:47:36
4242
|
43-
LL | let u64_ref: &u64 = unsafe { std::mem::transmute(u8_ref) };
44-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(u8_ref as *const u8 as *const u64)`
43+
LL | let u8_ref: &u8 = unsafe { std::mem::transmute(u64_ref) };
44+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(u64_ref as *const u64 as *const u8)`
4545

4646
error: aborting due to 7 previous errors
4747

0 commit comments

Comments
 (0)