Auto merge of #116052 - oli-obk:ceci_nest_pas_une_query, r=WaffleLapkin

Add a way to decouple the implementation and the declaration of a TyCtxt method.

properly addresses https://github.com/rust-lang/rust/pull/115819

accepted MCP: https://github.com/rust-lang/compiler-team/issues/395
This commit is contained in:
bors 2023-09-23 04:41:09 +00:00
commit 3da69c7041

View file

@ -718,7 +718,7 @@ fn field_of_struct<'tcx>(
field: &Ident,
) -> Option<mir::Const<'tcx>> {
if let mir::Const::Val(result, ty) = result
&& let Some(dc) = lcx.tcx.try_destructure_mir_constant_for_diagnostics((result, ty))
&& let Some(dc) = lcx.tcx.try_destructure_mir_constant_for_diagnostics(result, ty)
&& let Some(dc_variant) = dc.variant
&& let Some(variant) = adt_def.variants().get(dc_variant)
&& let Some(field_idx) = variant.fields.iter().position(|el| el.name == field.name)