diff options
| author | Michael Goulet <michael@errs.io> | 2022-12-06 02:49:06 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-12-13 17:48:55 +0000 |
| commit | 4b19a2c119a7764ec81a122c4d6257715462e956 (patch) | |
| tree | 62c473025ed10706497b41c02905f7851d9d6eac /compiler | |
| parent | 96cb18e864eb31f164fdfee5cb011d3576415b5d (diff) | |
| download | rust-4b19a2c119a7764ec81a122c4d6257715462e956.tar.gz rust-4b19a2c119a7764ec81a122c4d6257715462e956.zip | |
Combine OfOpaque and OfProjection
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_typeck/src/cast.rs | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs index 235e9c661a9..b050ad20afb 100644 --- a/compiler/rustc_hir_typeck/src/cast.rs +++ b/compiler/rustc_hir_typeck/src/cast.rs @@ -38,7 +38,6 @@ use rustc_middle::mir::Mutability; use rustc_middle::ty::adjustment::AllowTwoPhase; use rustc_middle::ty::cast::{CastKind, CastTy}; use rustc_middle::ty::error::TypeError; -use rustc_middle::ty::subst::SubstsRef; use rustc_middle::ty::{self, Ty, TypeAndMut, TypeVisitable, VariantDef}; use rustc_session::lint; use rustc_session::Session; @@ -75,10 +74,8 @@ enum PointerKind<'tcx> { VTable(Option<DefId>), /// Slice Length, - /// The unsize info of this projection - OfProjection(ty::AliasTy<'tcx>), - /// The unsize info of this opaque ty - OfOpaque(DefId, SubstsRef<'tcx>), + /// The unsize info of this projection or opaque type + OfAlias(ty::AliasTy<'tcx>), /// The unsize info of this parameter OfParam(ty::ParamTy), } @@ -118,10 +115,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Pointers to foreign types are thin, despite being unsized ty::Foreign(..) => Some(PointerKind::Thin), // We should really try to normalize here. - ty::Alias(ty::Projection, pi) => Some(PointerKind::OfProjection(pi)), - ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => { - Some(PointerKind::OfOpaque(def_id, substs)) - } + ty::Alias(_, pi) => Some(PointerKind::OfAlias(pi)), ty::Param(p) => Some(PointerKind::OfParam(p)), // Insufficient type information. ty::Placeholder(..) | ty::Bound(..) | ty::Infer(_) => None, @@ -978,11 +972,9 @@ impl<'a, 'tcx> CastCheck<'tcx> { Some(PointerKind::Thin) => Ok(CastKind::AddrPtrCast), Some(PointerKind::VTable(_)) => Err(CastError::IntToFatCast(Some("a vtable"))), Some(PointerKind::Length) => Err(CastError::IntToFatCast(Some("a length"))), - Some( - PointerKind::OfProjection(_) - | PointerKind::OfOpaque(_, _) - | PointerKind::OfParam(_), - ) => Err(CastError::IntToFatCast(None)), + Some(PointerKind::OfAlias(_) | PointerKind::OfParam(_)) => { + Err(CastError::IntToFatCast(None)) + } } } |
