From 9835e2ae736235810b4ea1c162ca5e65c547e770 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:50 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_hir_typeck/src/intrinsicck.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'compiler/rustc_hir_typeck/src/intrinsicck.rs') diff --git a/compiler/rustc_hir_typeck/src/intrinsicck.rs b/compiler/rustc_hir_typeck/src/intrinsicck.rs index 106f5bcd7..3c5eafd94 100644 --- a/compiler/rustc_hir_typeck/src/intrinsicck.rs +++ b/compiler/rustc_hir_typeck/src/intrinsicck.rs @@ -1,10 +1,10 @@ use hir::HirId; use rustc_errors::struct_span_err; use rustc_hir as hir; -use rustc_index::vec::Idx; +use rustc_index::Idx; use rustc_middle::ty::layout::{LayoutError, SizeSkeleton}; use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt}; -use rustc_target::abi::{FieldIdx, Pointer, VariantIdx}; +use rustc_target::abi::{Pointer, VariantIdx}; use super::FnCtxt; @@ -28,7 +28,7 @@ fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { } if def.variant(data_idx).fields.len() == 1 { - return def.variant(data_idx).fields[FieldIdx::from_u32(0)].ty(tcx, substs); + return def.variant(data_idx).single_field().ty(tcx, substs); } } @@ -72,8 +72,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let from = unpack_option_like(tcx, from); if let (&ty::FnDef(..), SizeSkeleton::Known(size_to)) = (from.kind(), sk_to) && size_to == Pointer(dl.instruction_address_space).size(&tcx) { struct_span_err!(tcx.sess, span, E0591, "can't transmute zero-sized type") - .note(&format!("source type: {from}")) - .note(&format!("target type: {to}")) + .note(format!("source type: {from}")) + .note(format!("target type: {to}")) .help("cast with `as` to a pointer instead") .emit(); return; @@ -109,10 +109,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { or dependently-sized types" ); if from == to { - err.note(&format!("`{from}` does not have a fixed size")); + err.note(format!("`{from}` does not have a fixed size")); } else { - err.note(&format!("source type: `{}` ({})", from, skeleton_string(from, sk_from))) - .note(&format!("target type: `{}` ({})", to, skeleton_string(to, sk_to))); + err.note(format!("source type: `{}` ({})", from, skeleton_string(from, sk_from))) + .note(format!("target type: `{}` ({})", to, skeleton_string(to, sk_to))); let mut should_delay_as_bug = false; if let Err(LayoutError::Unknown(bad_from)) = sk_from && bad_from.references_error() { should_delay_as_bug = true; -- cgit v1.2.3