about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-20 04:43:38 +0000
committerbors <bors@rust-lang.org>2023-06-20 04:43:38 +0000
commit1919dff4eefb55448d83174af596f3edb5826068 (patch)
tree9b3acc594ca1f8e3b6b6fbd8a791790cb62b0b92 /tests
parent89294e1756309da6e5ea0056222c19a09898af2c (diff)
parent9bc6e114e0f8f775869bc6d23b4cb9207941b5b0 (diff)
downloadrust-1919dff4eefb55448d83174af596f3edb5826068.tar.gz
rust-1919dff4eefb55448d83174af596f3edb5826068.zip
Auto merge of #10989 - ericmarkmartin:use-placeref-abstraction, r=Manishearth
Use placeref abstraction

rust-lang/rust#80647 suggests refactoring certain patterns with MIR places to use higher-level abstractions provided by the [`Place`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_middle/mir/struct.Place.html)/[`PlaceRef`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_middle/mir/struct.PlaceRef.html). While working on that issue, I found a couple candidates for such refactoring in clippy.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: none
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/missing_const_for_fn/cant_be_const.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/ui/missing_const_for_fn/cant_be_const.rs b/tests/ui/missing_const_for_fn/cant_be_const.rs
index 286d208b25b..abadf82fe4b 100644
--- a/tests/ui/missing_const_for_fn/cant_be_const.rs
+++ b/tests/ui/missing_const_for_fn/cant_be_const.rs
@@ -157,3 +157,12 @@ impl Issue10617 {
         self.0
     }
 }
+
+union U {
+    f: u32,
+}
+
+// Do not lint because accessing union fields from const functions is unstable
+fn h(u: U) -> u32 {
+    unsafe { u.f }
+}