summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_hir_typeck/src/intrinsicck.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_hir_typeck/src/intrinsicck.rs')
-rw-r--r--compiler/rustc_hir_typeck/src/intrinsicck.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/compiler/rustc_hir_typeck/src/intrinsicck.rs b/compiler/rustc_hir_typeck/src/intrinsicck.rs
index e58efc9d1..4e65182f1 100644
--- a/compiler/rustc_hir_typeck/src/intrinsicck.rs
+++ b/compiler/rustc_hir_typeck/src/intrinsicck.rs
@@ -11,7 +11,7 @@ use super::FnCtxt;
/// If the type is `Option<T>`, it will return `T`, otherwise
/// the type itself. Works on most `Option`-like types.
fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
- let ty::Adt(def, substs) = *ty.kind() else { return ty };
+ let ty::Adt(def, args) = *ty.kind() else { return ty };
if def.variants().len() == 2 && !def.repr().c() && def.repr().int.is_none() {
let data_idx;
@@ -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).single_field().ty(tcx, substs);
+ return def.variant(data_idx).single_field().ty(tcx, args);
}
}
@@ -85,7 +85,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
Ok(SizeSkeleton::Pointer { tail, .. }) => format!("pointer to `{tail}`"),
Ok(SizeSkeleton::Known(size)) => {
if let Some(v) = u128::from(size.bytes()).checked_mul(8) {
- format!("{} bits", v)
+ format!("{v} bits")
} else {
// `u128` should definitely be able to hold the size of different architectures
// larger sizes should be reported as error `are too big for the current architecture`
@@ -122,14 +122,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
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;
- }
- if let Err(LayoutError::Unknown(bad_to)) = sk_to && bad_to.references_error() {
- should_delay_as_bug = true;
- }
- if should_delay_as_bug {
+ if let Err(LayoutError::ReferencesError(_)) = sk_from {
+ err.delay_as_bug();
+ } else if let Err(LayoutError::ReferencesError(_)) = sk_to {
err.delay_as_bug();
}
}