Rollup merge of #152565 - Kivooeo:ctor-diag, r=BoxyUwU

fix missleading error for tuple ctor

r? BoxyUwU

fixes https://github.com/rust-lang/rust/issues/151414
This commit is contained in:
Jonathan Brouwer 2026-02-13 13:35:04 +01:00 committed by GitHub
commit d93a38a488
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 5 deletions

View file

@ -2465,7 +2465,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
let parent_did = tcx.parent(*def_id);
(tcx.adt_def(parent_did), fn_args, parent_did)
}
_ => return non_adt_or_variant_res(),
_ => {
let e = self.dcx().span_err(
span,
"complex const arguments must be placed inside of a `const` block",
);
return Const::new_error(tcx, e);
}
};
let variant_def = adt_def.variant_with_id(variant_did);