Address a few more nits

This commit is contained in:
Michael Goulet 2022-12-13 17:54:52 +00:00
parent fbe66a6ef3
commit 99417d54af
2 changed files with 12 additions and 11 deletions

View File

@ -110,13 +110,14 @@ fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
#[instrument(level = "trace", skip(self), ret)]
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
// FIXME(alias): merge these
match t.kind() {
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => self.visit_opaque(*def_id, substs),
ty::Alias(ty::Projection, proj)
if self.tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder =>
ty::Alias(_, ty::AliasTy { def_id, substs })
if matches!(
self.tcx.def_kind(*def_id),
DefKind::OpaqueTy | DefKind::ImplTraitPlaceholder
) =>
{
self.visit_opaque(proj.def_id, proj.substs)
self.visit_opaque(*def_id, substs)
}
_ => t.super_visit_with(self),
}

View File

@ -338,13 +338,14 @@ pub fn unexpected_hidden_region_diagnostic<'tcx>(
impl<'tcx> InferCtxt<'tcx> {
pub fn get_impl_future_output_ty(&self, ty: Ty<'tcx>) -> Option<Ty<'tcx>> {
// FIXME(alias): Merge these
let (def_id, substs) = match *ty.kind() {
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => (def_id, substs),
ty::Alias(ty::Projection, data)
if self.tcx.def_kind(data.def_id) == DefKind::ImplTraitPlaceholder =>
ty::Alias(_, ty::AliasTy { def_id, substs })
if matches!(
self.tcx.def_kind(def_id),
DefKind::OpaqueTy | DefKind::ImplTraitPlaceholder
) =>
{
(data.def_id, data.substs)
(def_id, substs)
}
_ => return None,
};
@ -1730,7 +1731,6 @@ enum Similar<'tcx> {
TypeError::Sorts(values) => {
let extra = expected == found;
let sort_string = |ty: Ty<'tcx>, path: Option<PathBuf>| {
// FIXME(alias): Merge these
let mut s = match (extra, ty.kind()) {
(true, ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. })) => {
let sm = self.tcx.sess.source_map();