Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
For us this mostly means changing `hir::exports::Export` to
`metadata::ModChild` and `tcx.item_children` to `tcx.module_children`.
  • Loading branch information
dario23 committed May 4, 2022
1 parent 1246e15 commit 6ebd336
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 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-2021-12-31"
channel = "nightly-2022-01-10"
components = ["llvm-tools-preview", "rustc-dev"]
10 changes: 5 additions & 5 deletions src/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_hir::{
HirId,
};
use rustc_middle::{
hir::exports::Export,
metadata::ModChild,
ty::{AssocKind, GenericParamDef, GenericParamDefKind},
};
use rustc_span::symbol::Symbol;
Expand Down Expand Up @@ -325,7 +325,7 @@ impl IdMapping {
}

/// An export that could be missing from one of the crate versions.
type OptionalExport = Option<Export>;
type OptionalExport = Option<ModChild>;

/// A mapping from names to pairs of old and new exports.
///
Expand All @@ -343,7 +343,7 @@ pub struct NameMapping {

impl NameMapping {
/// Insert a single export in the appropriate map, at the appropriate position.
fn insert(&mut self, item: Export, old: bool) {
fn insert(&mut self, item: ModChild, old: bool) {
use rustc_hir::def::DefKind::*;
use rustc_hir::def::Res::*;

Expand Down Expand Up @@ -397,7 +397,7 @@ impl NameMapping {
}

/// Add all items from two vectors of old/new exports.
pub fn add(&mut self, old_items: Vec<Export>, new_items: Vec<Export>) {
pub fn add(&mut self, old_items: Vec<ModChild>, new_items: Vec<ModChild>) {
for item in old_items {
self.insert(item, true);
}
Expand All @@ -408,7 +408,7 @@ impl NameMapping {
}

/// Drain the item pairs being stored.
pub fn drain(&mut self) -> impl Iterator<Item = (Option<Export>, Option<Export>)> + '_ {
pub fn drain(&mut self) -> impl Iterator<Item = (Option<ModChild>, Option<ModChild>)> + '_ {
self.type_map
.drain()
.chain(self.value_map.drain())
Expand Down
10 changes: 5 additions & 5 deletions src/traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use rustc_hir::hir_id::HirId;
use rustc_hir::lang_items::LangItem;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::{
hir::exports::Export,
metadata::ModChild,
ty::{
subst::{InternalSubsts, Subst},
AssocItem, GenericParamDef, GenericParamDefKind, Generics, TraitRef, Ty, TyCtxt, TyKind,
Expand Down Expand Up @@ -67,7 +67,7 @@ pub fn run_analysis(tcx: TyCtxt, old: DefId, new: DefId) -> ChangeSet {
}

// Get the visibility of the inner item, given the outer item's visibility.
fn get_vis(outer_vis: Visibility, def: Export) -> Visibility {
fn get_vis(outer_vis: Visibility, def: ModChild) -> Visibility {
if outer_vis == Public {
def.vis
} else {
Expand All @@ -85,7 +85,7 @@ pub fn run_traversal(tcx: TyCtxt, new: DefId) {

// Pull a module from the queue, with its global visibility.
while let Some((new_def_id, idents, new_vis)) = mod_queue.pop_front() {
for item in tcx.item_children(new_def_id).iter().copied() {
for item in tcx.module_children(new_def_id).iter().copied() {
let n_vis = get_vis(new_vis, item);
match item.res {
Def(Mod, n_def_id) => {
Expand Down Expand Up @@ -147,8 +147,8 @@ fn diff_structure<'tcx>(
// Pull a matched module pair from the queue, with the modules' global visibility.
while let Some((old_def_id, new_def_id, old_vis, new_vis)) = mod_queue.pop_front() {
children.add(
tcx.item_children(old_def_id).to_vec(), // TODO: clean up
tcx.item_children(new_def_id).to_vec(),
tcx.module_children(old_def_id).to_vec(), // TODO: clean up
tcx.module_children(new_def_id).to_vec(),
);

for items in children.drain() {
Expand Down

0 comments on commit 6ebd336

Please sign in to comment.