1
Fork 0

Auto merge of #108128 - clubby789:builtin-derived-attr, r=jackh726

Properly check for builtin derived code

Fixes #108122
This commit is contained in:
bors 2023-02-19 21:18:07 +00:00
commit 21e5b941e0
8 changed files with 60 additions and 34 deletions

View file

@ -42,12 +42,12 @@ impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> {
if util::is_disaligned(self.tcx, self.body, self.param_env, *place) {
let def_id = self.body.source.instance.def_id();
if let Some(impl_def_id) = self.tcx.impl_of_method(def_id)
&& self.tcx.is_builtin_derive(impl_def_id)
&& self.tcx.is_builtin_derived(impl_def_id)
{
// If we ever reach here it means that the generated derive
// code is somehow doing an unaligned reference, which it
// shouldn't do.
unreachable!();
span_bug!(self.source_info.span, "builtin derive created an unaligned reference");
} else {
struct_span_err!(
self.tcx.sess,