Skip to content

Rollup of 22 pull requests #59364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 81 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
7e1914f
hir: replace NodeId with HirId in trait_impls
ljedrz Mar 10, 2019
401329e
HirIdification: remove all NodeIds from borrowck
ljedrz Mar 10, 2019
aa53741
HirIdification: remove all NodeIds from typeck
ljedrz Mar 10, 2019
9151eab
HirIdification: remove all NodeIds from rustc_mir
ljedrz Mar 10, 2019
584d61a
hir: remove trait_auto_impl
ljedrz Mar 10, 2019
18229bb
syntax: Better recovery for `$ty::AssocItem` and `ty!()::AssocItem`
petrochenkov Mar 9, 2019
79c3651
syntax: Optimize `maybe_whole`/`maybe_whole_expr` slightly
petrochenkov Mar 10, 2019
1ab8ca3
Address review comments
petrochenkov Mar 12, 2019
856b081
middle: replace NodeId with HirId in AccessLevels
ljedrz Mar 11, 2019
ff5e31f
Fix a broken link to the rustc-guide
varkor Mar 14, 2019
6e449da
Remove trailing newlines
varkor Mar 14, 2019
205ab0c
Add a link to the Discord and Zulip servers
varkor Mar 14, 2019
6f3fda9
Add links to @rust-highfive and @bors
varkor Mar 14, 2019
eadb844
Update r+ syntax
varkor Mar 14, 2019
308a002
Make all references to @bors or users links
varkor Mar 14, 2019
3a00649
Move rollup description earlier
varkor Mar 14, 2019
037596c
Fix capitalisation problem
varkor Mar 14, 2019
b392c5e
use the identifier span for missing struct field
euclio Mar 16, 2019
498bead
Tweak spans for E0599
estebank Mar 10, 2019
713f96d
Swap const evaluation lint spans to point at problem in primary span
estebank Mar 11, 2019
690bc57
Swap primary/secondary spans for E0458
estebank Mar 11, 2019
18d727f
Tweak unsupported negative trait bounds message
estebank Mar 11, 2019
bb15af1
Tweak unnecessary import suggestion
estebank Mar 11, 2019
b616cca
Hide obvious suggestion from cli output
estebank Mar 11, 2019
743d019
Deduplicate const eval error spans for better output
estebank Mar 11, 2019
b53ca90
Mark duplicate import removal suggestion tool only
estebank Mar 11, 2019
d1656f1
Fix rebase
estebank Mar 17, 2019
6007e6f
Do not complain about non-existing fields after parse recovery
estebank Mar 18, 2019
bb832c2
some small HIR doc improvements
llogiq Mar 18, 2019
ec6f983
Rename typarams to param_names
varkor Mar 13, 2019
c915fe0
Rename external_typarams to external_param_names
varkor Mar 13, 2019
1491315
Implement `Clean` for const generics
varkor Mar 13, 2019
29ed491
Add `GenericArg`
varkor Mar 13, 2019
cd9a2c0
Refactor `GenericArgs` to include const generics
varkor Mar 13, 2019
38d98a1
Implement const generics in `generics_to_path_params`
varkor Mar 13, 2019
9925d9b
Fix indentation issue
varkor Mar 14, 2019
b39e664
Make clean::Constant display respect f.alternate()
varkor Mar 18, 2019
f93ad41
Rename first_ty_sty to ty_sty
varkor Mar 18, 2019
9bc5811
Rebase over LazyConst changes
varkor Mar 18, 2019
37789c4
Update src/librustc/hir/mod.rs
Centril Mar 19, 2019
8cf720b
Make Option<ThreadId> no larger than ThreadId, with NonZeroU64
SimonSapin Mar 19, 2019
a291d4e
convert field/method confusion help to suggestions
euclio Mar 19, 2019
757eb67
review comments
estebank Mar 19, 2019
46a8beb
Move some bench tests back from libtest
gnzlbg Mar 20, 2019
b6e5d73
Add messages for different verbosity levels.
o01eg Mar 20, 2019
c1d9191
Add a test for size_of Option<ThreadId>
SimonSapin Mar 20, 2019
a8120d6
Tweak incorrect escaped char diagnostic
estebank Mar 20, 2019
2f8d9a2
Add NAN test to docs
Xaeroxe Mar 20, 2019
e2b5a03
Fix formatting and add unit tests for panic cases
Xaeroxe Mar 20, 2019
295cc77
cleanup: Remove compile-fail-fulldeps directory again
petrochenkov Mar 20, 2019
72f5d91
Fix f64 test
Xaeroxe Mar 20, 2019
830c98d
Fix undefined behavior in hint::spin_loop for x86 targets without SSE2
gnzlbg Mar 16, 2019
16a8abe
use suggestions for "enum instead of variant" error
euclio Mar 20, 2019
de021e3
FreeBSD 10.x is EOL, in FreeBSD 11 and later, ss_sp is actually a voi…
Jan 21, 2019
6b766ba
Update cargo
Mar 21, 2019
6389478
Move one test from run-make-fulldeps to ui
petrochenkov Mar 21, 2019
c97d3d4
Add tracking issue number for `seek_convenience`
LukasKalbertodt Mar 22, 2019
48af718
Expand `impl FromIterator for Option` doc to include example of early…
pnkfelix Mar 20, 2019
d5a61c0
Expand `impl FromIterator for Result` doc to include examples of `Err…
pnkfelix Mar 20, 2019
9c53011
Rollup merge of #57810 - MikaelUrankar:stack_t_bsd, r=nagisa
Mark-Simulacrum Mar 22, 2019
1f2ba0d
Rollup merge of #59058 - petrochenkov:assocrecov3, r=estebank
Mark-Simulacrum Mar 22, 2019
b76fa33
Rollup merge of #59068 - ljedrz:kill_off_NodeId_stragglers, r=Zoxc
Mark-Simulacrum Mar 22, 2019
ae89abd
Rollup merge of #59084 - estebank:diagnostic-spans, r=davidtwco
Mark-Simulacrum Mar 22, 2019
dbe70a3
Rollup merge of #59096 - ljedrz:HirIdify_AccessLevel, r=Zoxc
Mark-Simulacrum Mar 22, 2019
69a69bc
Rollup merge of #59170 - varkor:const-generics-rustdoc, r=QuietMisdre…
Mark-Simulacrum Mar 22, 2019
c9f6316
Rollup merge of #59172 - varkor:contributing-contributions, r=stevekl…
Mark-Simulacrum Mar 22, 2019
8f170fe
Rollup merge of #59239 - gnzlbg:fix_spin_loop, r=nagisa
Mark-Simulacrum Mar 22, 2019
20211eb
Rollup merge of #59240 - euclio:struct-field-span, r=oli-obk
Mark-Simulacrum Mar 22, 2019
4103238
Rollup merge of #59266 - estebank:struct-parse-recovery, r=petrochenkov
Mark-Simulacrum Mar 22, 2019
bd6a70d
Rollup merge of #59273 - llogiq:hir-docs, r=matthewjasper
Mark-Simulacrum Mar 22, 2019
2a5c042
Rollup merge of #59291 - SimonSapin:nonzero-thread-id, r=alexcrichton
Mark-Simulacrum Mar 22, 2019
fc1a533
Rollup merge of #59297 - euclio:field-method-suggestions, r=estebank
Mark-Simulacrum Mar 22, 2019
3da4970
Rollup merge of #59304 - gnzlbg:bench_tests, r=alexcrichton
Mark-Simulacrum Mar 22, 2019
e90bf70
Rollup merge of #59309 - o01eg:verbose-copy-files, r=alexcrichton
Mark-Simulacrum Mar 22, 2019
0d456f4
Rollup merge of #59322 - estebank:diag-tweak, r=davidtwco
Mark-Simulacrum Mar 22, 2019
5fa6896
Rollup merge of #59323 - euclio:enum-instead-of-variant, r=varkor
Mark-Simulacrum Mar 22, 2019
ff929e5
Rollup merge of #59327 - Xaeroxe:clamp-doc, r=scottmcm
Mark-Simulacrum Mar 22, 2019
ad30404
Rollup merge of #59329 - petrochenkov:rmcff, r=alexcrichton
Mark-Simulacrum Mar 22, 2019
b5424a0
Rollup merge of #59347 - petrochenkov:nomake, r=davidtwco
Mark-Simulacrum Mar 22, 2019
ab4c5b3
Rollup merge of #59360 - LukasKalbertodt:patch-2, r=rkruppe
Mark-Simulacrum Mar 22, 2019
f90f0b3
Rollup merge of #59362 - pnkfelix:demo-from-iterator-short-circuiting…
Mark-Simulacrum Mar 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ fn create_and_seed_worklist<'a, 'tcx>(
) -> (Vec<hir::HirId>, FxHashMap<hir::HirId, hir::HirId>) {
let worklist = access_levels.map.iter().filter_map(|(&id, level)| {
if level >= &privacy::AccessLevel::Reachable {
Some(tcx.hir().node_to_hir_id(id))
Some(id)
} else {
None
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
//! outside their scopes. This pass will also generate a set of exported items
//! which are available for use externally when compiled as a library.

use crate::hir::HirId;
use crate::util::nodemap::{DefIdSet, FxHashMap};

use std::hash::Hash;
use std::fmt;
use syntax::ast::NodeId;
use rustc_macros::HashStable;

// Accessibility levels, sorted in ascending order
Expand All @@ -27,7 +27,7 @@ pub enum AccessLevel {

// Accessibility levels for reachable HIR nodes
#[derive(Clone)]
pub struct AccessLevels<Id = NodeId> {
pub struct AccessLevels<Id = HirId> {
pub map: FxHashMap<Id, AccessLevel>
}

Expand Down
5 changes: 2 additions & 3 deletions src/librustc/middle/reachable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a,

// We need only trait impls here, not inherent impls, and only non-exported ones
if let hir::ItemKind::Impl(.., Some(ref trait_ref), _, ref impl_item_refs) = item.node {
let node_id = self.tcx.hir().hir_to_node_id(item.hir_id);
if !self.access_levels.is_reachable(node_id) {
if !self.access_levels.is_reachable(item.hir_id) {
self.worklist.extend(impl_item_refs.iter().map(|ii_ref| ii_ref.id.hir_id));

let trait_def_id = match trait_ref.path.def {
Expand Down Expand Up @@ -415,7 +414,7 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) ->
// use the lang items, so we need to be sure to mark them as
// exported.
reachable_context.worklist.extend(
access_levels.map.iter().map(|(id, _)| tcx.hir().node_to_hir_id(*id)));
access_levels.map.iter().map(|(id, _)| *id));
for item in tcx.lang_items().items().iter() {
if let Some(did) = *item {
if let Some(hir_id) = tcx.hir().as_local_hir_id(did) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> {
let stab = self.tcx.stability().local_stability(hir_id);
let is_error = !self.tcx.sess.opts.test &&
stab.is_none() &&
self.access_levels.is_reachable(self.tcx.hir().hir_to_node_id(hir_id));
self.access_levels.is_reachable(hir_id);
if is_error {
self.tcx.sess.span_err(
span,
Expand Down
12 changes: 4 additions & 8 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ impl MissingDoc {
// It's an option so the crate root can also use this function (it doesn't
// have a NodeId).
if let Some(id) = id {
let node_id = cx.tcx.hir().hir_to_node_id(id);
if !cx.access_levels.is_exported(node_id) {
if !cx.access_levels.is_exported(id) {
return;
}
}
Expand Down Expand Up @@ -557,8 +556,7 @@ impl LintPass for MissingCopyImplementations {

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
let node_id = cx.tcx.hir().hir_to_node_id(item.hir_id);
if !cx.access_levels.is_reachable(node_id) {
if !cx.access_levels.is_reachable(item.hir_id) {
return;
}
let (def, ty) = match item.node {
Expand Down Expand Up @@ -629,8 +627,7 @@ impl LintPass for MissingDebugImplementations {

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
let node_id = cx.tcx.hir().hir_to_node_id(item.hir_id);
if !cx.access_levels.is_reachable(node_id) {
if !cx.access_levels.is_reachable(item.hir_id) {
return;
}

Expand Down Expand Up @@ -1169,9 +1166,8 @@ impl UnreachablePub {
fn perform_lint(&self, cx: &LateContext<'_, '_>, what: &str, id: hir::HirId,
vis: &hir::Visibility, span: Span, exportable: bool) {
let mut applicability = Applicability::MachineApplicable;
let node_id = cx.tcx.hir().hir_to_node_id(id);
match vis.node {
hir::VisibilityKind::Public if !cx.access_levels.is_reachable(node_id) => {
hir::VisibilityKind::Public if !cx.access_levels.is_reachable(id) => {
if span.ctxt().outer().expn_info().is_some() {
applicability = Applicability::MaybeIncorrect;
}
Expand Down
25 changes: 9 additions & 16 deletions src/librustc_privacy/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ impl VisibilityLike for Option<AccessLevel> {
// (which require reaching the `DefId`s in them).
const SHALLOW: bool = true;
fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self {
cmp::min(if let Some(node_id) = find.tcx.hir().as_local_node_id(def_id) {
find.access_levels.map.get(&node_id).cloned()
cmp::min(if let Some(hir_id) = find.tcx.hir().as_local_hir_id(def_id) {
find.access_levels.map.get(&hir_id).cloned()
} else {
Self::MAX
}, find.min)
Expand Down Expand Up @@ -410,17 +410,15 @@ struct ReachEverythingInTheInterfaceVisitor<'b, 'a: 'b, 'tcx: 'a> {

impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> {
fn get(&self, id: hir::HirId) -> Option<AccessLevel> {
let node_id = self.tcx.hir().hir_to_node_id(id);
self.access_levels.map.get(&node_id).cloned()
self.access_levels.map.get(&id).cloned()
}

// Updates node level and returns the updated level.
fn update(&mut self, id: hir::HirId, level: Option<AccessLevel>) -> Option<AccessLevel> {
let old_level = self.get(id);
// Accessibility levels can only grow.
if level > old_level {
let node_id = self.tcx.hir().hir_to_node_id(id);
self.access_levels.map.insert(node_id, level.unwrap());
self.access_levels.map.insert(id, level.unwrap());
self.changed = true;
level
} else {
Expand Down Expand Up @@ -1197,8 +1195,7 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
fn trait_is_public(&self, trait_id: hir::HirId) -> bool {
// FIXME: this would preferably be using `exported_items`, but all
// traits are exported currently (see `EmbargoVisitor.exported_trait`).
let node_id = self.tcx.hir().hir_to_node_id(trait_id);
self.access_levels.is_public(node_id)
self.access_levels.is_public(trait_id)
}

fn check_generic_bound(&mut self, bound: &hir::GenericBound) {
Expand All @@ -1210,8 +1207,7 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
}

fn item_is_public(&self, id: &hir::HirId, vis: &hir::Visibility) -> bool {
let node_id = self.tcx.hir().hir_to_node_id(*id);
self.access_levels.is_reachable(node_id) || vis.node.is_pub()
self.access_levels.is_reachable(*id) || vis.node.is_pub()
}
}

Expand Down Expand Up @@ -1325,8 +1321,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
hir::ImplItemKind::Const(..) |
hir::ImplItemKind::Method(..) => {
self.access_levels.is_reachable(
self.tcx.hir().hir_to_node_id(
impl_item_ref.id.hir_id))
impl_item_ref.id.hir_id)
}
hir::ImplItemKind::Existential(..) |
hir::ImplItemKind::Type(_) => false,
Expand Down Expand Up @@ -1455,8 +1450,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
}

fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem) {
let node_id = self.tcx.hir().hir_to_node_id(item.hir_id);
if self.access_levels.is_reachable(node_id) {
if self.access_levels.is_reachable(item.hir_id) {
intravisit::walk_foreign_item(self, item)
}
}
Expand All @@ -1474,8 +1468,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
v: &'tcx hir::Variant,
g: &'tcx hir::Generics,
item_id: hir::HirId) {
let node_id = self.tcx.hir().hir_to_node_id(v.node.data.hir_id());
if self.access_levels.is_reachable(node_id) {
if self.access_levels.is_reachable(v.node.data.hir_id()) {
self.in_variant = true;
intravisit::walk_variant(self, v, g, item_id);
self.in_variant = false;
Expand Down
51 changes: 33 additions & 18 deletions src/librustc_save_analysis/dump_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,19 @@ macro_rules! down_cast_data {
}

macro_rules! access_from {
($save_ctxt:expr, $vis:expr, $id:expr) => {
($save_ctxt:expr, $item:expr, $id:expr) => {
Access {
public: $vis.node.is_pub(),
public: $item.vis.node.is_pub(),
reachable: $save_ctxt.access_levels.is_reachable($id),
}
};
}

($save_ctxt:expr, $item:expr) => {
macro_rules! access_from_vis {
($save_ctxt:expr, $vis:expr, $id:expr) => {
Access {
public: $item.vis.node.is_pub(),
reachable: $save_ctxt.access_levels.is_reachable($item.id),
public: $vis.node.is_pub(),
reachable: $save_ctxt.access_levels.is_reachable($id),
}
};
}
Expand Down Expand Up @@ -303,7 +305,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {

method_data.value = sig_str;
method_data.sig = sig::method_signature(id, ident, generics, sig, &self.save_ctxt);
self.dumper.dump_def(&access_from!(self.save_ctxt, vis, id), method_data);
let hir_id = self.tcx.hir().node_to_hir_id(id);
self.dumper.dump_def(&access_from_vis!(self.save_ctxt, vis, hir_id), method_data);
}

// walk arg and return types
Expand All @@ -324,7 +327,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
fn process_struct_field_def(&mut self, field: &ast::StructField, parent_id: NodeId) {
let field_data = self.save_ctxt.get_field_data(field, parent_id);
if let Some(field_data) = field_data {
self.dumper.dump_def(&access_from!(self.save_ctxt, field), field_data);
let hir_id = self.tcx.hir().node_to_hir_id(field.id);
self.dumper.dump_def(&access_from!(self.save_ctxt, field, hir_id), field_data);
}
}

Expand Down Expand Up @@ -389,7 +393,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
|v| v.process_formals(&decl.inputs, &fn_data.qualname),
);
self.process_generic_params(ty_params, &fn_data.qualname, item.id);
self.dumper.dump_def(&access_from!(self.save_ctxt, item), fn_data);
let hir_id = self.tcx.hir().node_to_hir_id(item.id);
self.dumper.dump_def(&access_from!(self.save_ctxt, item, hir_id), fn_data);
}

for arg in &decl.inputs {
Expand All @@ -409,10 +414,11 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
typ: &'l ast::Ty,
expr: &'l ast::Expr,
) {
let hir_id = self.tcx.hir().node_to_hir_id(item.id);
self.nest_tables(item.id, |v| {
if let Some(var_data) = v.save_ctxt.get_item_data(item) {
down_cast_data!(var_data, DefData, item.span);
v.dumper.dump_def(&access_from!(v.save_ctxt, item), var_data);
v.dumper.dump_def(&access_from!(v.save_ctxt, item, hir_id), var_data);
}
v.visit_ty(&typ);
v.visit_expr(expr);
Expand All @@ -435,9 +441,10 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
if !self.span.filter_generated(ident.span) {
let sig = sig::assoc_const_signature(id, ident.name, typ, expr, &self.save_ctxt);
let span = self.span_from_span(ident.span);
let hir_id = self.tcx.hir().node_to_hir_id(id);

self.dumper.dump_def(
&access_from!(self.save_ctxt, vis, id),
&access_from_vis!(self.save_ctxt, vis, hir_id),
Def {
kind: DefKind::Const,
id: id_from_node_id(id, &self.save_ctxt),
Expand Down Expand Up @@ -512,8 +519,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {

if !self.span.filter_generated(item.ident.span) {
let span = self.span_from_span(item.ident.span);
let hir_id = self.tcx.hir().node_to_hir_id(item.id);
self.dumper.dump_def(
&access_from!(self.save_ctxt, item),
&access_from!(self.save_ctxt, item, hir_id),
Def {
kind,
id: id_from_node_id(item.id, &self.save_ctxt),
Expand Down Expand Up @@ -552,7 +560,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
};
down_cast_data!(enum_data, DefData, item.span);

let access = access_from!(self.save_ctxt, item);
let hir_id = self.tcx.hir().node_to_hir_id(item.id);
let access = access_from!(self.save_ctxt, item, hir_id);

for variant in &enum_definition.variants {
let name = variant.node.ident.name.to_string();
Expand Down Expand Up @@ -701,8 +710,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
.iter()
.map(|i| id_from_node_id(i.id, &self.save_ctxt))
.collect();
let hir_id = self.tcx.hir().node_to_hir_id(item.id);
self.dumper.dump_def(
&access_from!(self.save_ctxt, item),
&access_from!(self.save_ctxt, item, hir_id),
Def {
kind: DefKind::Trait,
id,
Expand Down Expand Up @@ -760,7 +770,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
fn process_mod(&mut self, item: &ast::Item) {
if let Some(mod_data) = self.save_ctxt.get_item_data(item) {
down_cast_data!(mod_data, DefData, item.span);
self.dumper.dump_def(&access_from!(self.save_ctxt, item), mod_data);
let hir_id = self.tcx.hir().node_to_hir_id(item.id);
self.dumper.dump_def(&access_from!(self.save_ctxt, item, hir_id), mod_data);
}
}

Expand Down Expand Up @@ -1201,7 +1212,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {

// The access is calculated using the current tree ID, but with the root tree's visibility
// (since nested trees don't have their own visibility).
let access = access_from!(self.save_ctxt, root_item.vis, id);
let hir_id = self.tcx.hir().node_to_hir_id(id);
let access = access_from!(self.save_ctxt, root_item, hir_id);

// The parent def id of a given use tree is always the enclosing item.
let parent = self.save_ctxt.tcx.hir().opt_local_def_id(id)
Expand Down Expand Up @@ -1400,9 +1412,10 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
if !self.span.filter_generated(item.ident.span) {
let span = self.span_from_span(item.ident.span);
let id = id_from_node_id(item.id, &self.save_ctxt);
let hir_id = self.tcx.hir().node_to_hir_id(item.id);

self.dumper.dump_def(
&access_from!(self.save_ctxt, item),
&access_from!(self.save_ctxt, item, hir_id),
Def {
kind: DefKind::Type,
id,
Expand Down Expand Up @@ -1431,9 +1444,10 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
if !self.span.filter_generated(item.ident.span) {
let span = self.span_from_span(item.ident.span);
let id = id_from_node_id(item.id, &self.save_ctxt);
let hir_id = self.tcx.hir().node_to_hir_id(item.id);

self.dumper.dump_def(
&access_from!(self.save_ctxt, item),
&access_from!(self.save_ctxt, item, hir_id),
Def {
kind: DefKind::Type,
id,
Expand Down Expand Up @@ -1631,7 +1645,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
}

fn visit_foreign_item(&mut self, item: &'l ast::ForeignItem) {
let access = access_from!(self.save_ctxt, item);
let hir_id = self.tcx.hir().node_to_hir_id(item.id);
let access = access_from!(self.save_ctxt, item, hir_id);

match item.node {
ast::ForeignItemKind::Fn(ref decl, ref generics) => {
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,11 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
sess.abort_if_errors();

let access_levels = tcx.privacy_access_levels(LOCAL_CRATE);
// Convert from a NodeId set to a DefId set since we don't always have easy access
// to the map from defid -> nodeid
// Convert from a HirId set to a DefId set since we don't always have easy access
// to the map from defid -> hirid
let access_levels = AccessLevels {
map: access_levels.map.iter()
.map(|(&k, &v)| (tcx.hir().local_def_id(k), v))
.map(|(&k, &v)| (tcx.hir().local_def_id_from_hir_id(k), v))
.collect()
};

Expand Down