Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dario23 committed May 6, 2022
1 parent be85c12 commit 8ef45e8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NOTE: Keep in sync with nightly date on README
[toolchain]
channel = "nightly-2022-02-26"
channel = "nightly-2022-03-13"
components = ["llvm-tools-preview", "rustc-dev"]
18 changes: 9 additions & 9 deletions src/mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
let matching = match (a.kind(), b.kind()) {
(&TyKind::Adt(a_def, a_substs), &TyKind::Adt(b_def, b_substs)) => {
if self.check_substs(a_substs, b_substs) {
let _ = self.relate_item_substs(a_def.did, a_substs, b_substs)?;
let a_adt = self.tcx.adt_def(a_def.did);
let b_adt = self.tcx.adt_def(b_def.did);
let _ = self.relate_item_substs(a_def.did(), a_substs, b_substs)?;
let a_adt = self.tcx.adt_def(a_def.did());
let b_adt = self.tcx.adt_def(b_def.did());

let b_fields: HashMap<_, _> = b_adt.all_fields().map(|f| (f.did, f)).collect();

Expand All @@ -172,19 +172,19 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
}

let a = if a_def.is_struct() {
Res::Def(DefKind::Struct, a_def.did)
Res::Def(DefKind::Struct, a_def.did())
} else if a_def.is_union() {
Res::Def(DefKind::Union, a_def.did)
Res::Def(DefKind::Union, a_def.did())
} else {
Res::Def(DefKind::Enum, a_def.did)
Res::Def(DefKind::Enum, a_def.did())
};

let b = if b_def.is_struct() {
Res::Def(DefKind::Struct, b_def.did)
Res::Def(DefKind::Struct, b_def.did())
} else if b_def.is_union() {
Res::Def(DefKind::Union, b_def.did)
Res::Def(DefKind::Union, b_def.did())
} else {
Res::Def(DefKind::Enum, b_def.did)
Res::Def(DefKind::Enum, b_def.did())
};

Some((a, b))
Expand Down
10 changes: 5 additions & 5 deletions src/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,18 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
use rustc_middle::ty::ExistentialPredicate::*;
use rustc_middle::ty::TyKind;
use rustc_middle::ty::TypeAndMut;
use rustc_middle::ty::{AdtDef, Binder, ExistentialProjection, ExistentialTraitRef};
use rustc_middle::ty::{Binder, ExistentialProjection, ExistentialTraitRef};

orig.fold_with(&mut BottomUpFolder {
tcx: self.tcx,
ty_op: |ty| {
match *ty.kind() {
TyKind::Adt(&AdtDef { ref did, .. }, substs)
if self.needs_translation(*did) =>
{
TyKind::Adt(adt_def, substs) if self.needs_translation(adt_def.did()) => {
// we fold bottom-up, so the code above is invalid, as it assumes the
// substs (that have been folded already) are yet untranslated
if let Some(target_def_id) = (self.translate_orig)(self.id_mapping, *did) {
if let Some(target_def_id) =
(self.translate_orig)(self.id_mapping, adt_def.did())
{
let target_adt = self.tcx.adt_def(target_def_id);
self.tcx.mk_adt(target_adt, substs)
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,14 @@ fn diff_adts(changes: &mut ChangeSet, id_mapping: &mut IdMapping, tcx: TyCtxt, o
let mut variants = BTreeMap::new();
let mut fields = BTreeMap::new();

for variant in &old_def.variants {
for variant in old_def.variants() {
variants
.entry(variant.ident(tcx).name)
.or_insert((None, None))
.0 = Some(variant);
}

for variant in &new_def.variants {
for variant in new_def.variants() {
variants
.entry(variant.ident(tcx).name)
.or_insert((None, None))
Expand Down Expand Up @@ -1106,7 +1106,7 @@ fn diff_inherent_impls<'tcx>(
fn is_impl_trait_public<'tcx>(tcx: TyCtxt<'tcx>, impl_def_id: DefId) -> bool {
fn type_visibility(tcx: TyCtxt, ty: Ty) -> Visibility {
match ty.kind() {
TyKind::Adt(def, _) => tcx.visibility(def.did),
TyKind::Adt(def, _) => tcx.visibility(def.did()),

TyKind::Array(t, _)
| TyKind::Slice(t)
Expand Down

0 comments on commit 8ef45e8

Please sign in to comment.