Skip to content

Commit 99417d5

Browse files
Address a few more nits
1 parent fbe66a6 commit 99417d5

File tree

2 files changed

+12
-11
lines changed
  • compiler
    • rustc_hir_analysis/src/variance
    • rustc_infer/src/infer/error_reporting

2 files changed

+12
-11
lines changed

compiler/rustc_hir_analysis/src/variance/mod.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,14 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
110110

111111
#[instrument(level = "trace", skip(self), ret)]
112112
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
113-
// FIXME(alias): merge these
114113
match t.kind() {
115-
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => self.visit_opaque(*def_id, substs),
116-
ty::Alias(ty::Projection, proj)
117-
if self.tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder =>
114+
ty::Alias(_, ty::AliasTy { def_id, substs })
115+
if matches!(
116+
self.tcx.def_kind(*def_id),
117+
DefKind::OpaqueTy | DefKind::ImplTraitPlaceholder
118+
) =>
118119
{
119-
self.visit_opaque(proj.def_id, proj.substs)
120+
self.visit_opaque(*def_id, substs)
120121
}
121122
_ => t.super_visit_with(self),
122123
}

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,14 @@ pub fn unexpected_hidden_region_diagnostic<'tcx>(
338338

339339
impl<'tcx> InferCtxt<'tcx> {
340340
pub fn get_impl_future_output_ty(&self, ty: Ty<'tcx>) -> Option<Ty<'tcx>> {
341-
// FIXME(alias): Merge these
342341
let (def_id, substs) = match *ty.kind() {
343-
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs }) => (def_id, substs),
344-
ty::Alias(ty::Projection, data)
345-
if self.tcx.def_kind(data.def_id) == DefKind::ImplTraitPlaceholder =>
342+
ty::Alias(_, ty::AliasTy { def_id, substs })
343+
if matches!(
344+
self.tcx.def_kind(def_id),
345+
DefKind::OpaqueTy | DefKind::ImplTraitPlaceholder
346+
) =>
346347
{
347-
(data.def_id, data.substs)
348+
(def_id, substs)
348349
}
349350
_ => return None,
350351
};
@@ -1730,7 +1731,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
17301731
TypeError::Sorts(values) => {
17311732
let extra = expected == found;
17321733
let sort_string = |ty: Ty<'tcx>, path: Option<PathBuf>| {
1733-
// FIXME(alias): Merge these
17341734
let mut s = match (extra, ty.kind()) {
17351735
(true, ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. })) => {
17361736
let sm = self.tcx.sess.source_map();

0 commit comments

Comments
 (0)