1
Fork 0

Rollup merge of #110394 - scottmcm:less-idx-new, r=WaffleLapkin

Various minor Idx-related tweaks

Nothing particularly exciting here, but a couple of things I noticed as I was looking for more index conversions to simplify.

cc https://github.com/rust-lang/compiler-team/issues/606
r? `@WaffleLapkin`
This commit is contained in:
Matthias Krüger 2023-04-17 18:13:35 +02:00 committed by GitHub
commit 0790996a07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 55 additions and 52 deletions

View file

@ -10,7 +10,6 @@ use rustc_middle::traits::{
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::{self as ty, GenericArgKind, IsSuggestable, Ty, TypeVisitableExt};
use rustc_span::{sym, BytePos, Span};
use rustc_target::abi::FieldIdx;
use crate::errors::{
ConsiderAddingAwait, FnConsiderCasting, FnItemsAreDistinct, FnUniqTypes,
@ -114,7 +113,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
variant.fields.len() == 1 && variant.ctor_kind() == Some(CtorKind::Fn)
})
.filter_map(|variant| {
let sole_field = &variant.fields[FieldIdx::from_u32(0)];
let sole_field = &variant.single_field();
let sole_field_ty = sole_field.ty(self.tcx, substs);
if self.same_type_modulo_infer(sole_field_ty, exp_found.found) {
let variant_path =