]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/non_copy_const.rs
Auto merge of #9546 - kraktus:default_not_default_trait, r=xFrednet
[rust.git] / clippy_lints / src / non_copy_const.rs
index 72c86f28bbc6c4e4193894a6cbf4dedf09f2ea54..ea76ce2c57357c7183e70cdfb97042674c5e0e1b 100644 (file)
@@ -149,6 +149,9 @@ fn inner<'tcx>(cx: &LateContext<'tcx>, val: mir::ConstantKind<'tcx>) -> bool {
             // the fact that we have to dig into every structs to search enums
             // leads us to the point checking `UnsafeCell` directly is the only option.
             ty::Adt(ty_def, ..) if ty_def.is_unsafe_cell() => true,
+            // As of 2022-09-08 miri doesn't track which union field is active so there's no safe way to check the
+            // contained value.
+            ty::Adt(def, ..) if def.is_union() => false,
             ty::Array(..) | ty::Adt(..) | ty::Tuple(..) => {
                 let val = cx.tcx.destructure_mir_constant(cx.param_env, val);
                 val.fields.iter().any(|field| inner(cx, *field))