diff options
| author | Michael Goulet <michael@errs.io> | 2023-09-07 06:27:10 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-09-07 06:48:24 +0000 |
| commit | 14e59bb317c3c901bce83deb16ee9bfa5cc90e28 (patch) | |
| tree | 289be334fa182127f440b893ee1d1b80471ebfe2 /compiler | |
| parent | f00c1399987c60b4e884afc42f4aa6226855e9ae (diff) | |
| download | rust-14e59bb317c3c901bce83deb16ee9bfa5cc90e28.tar.gz rust-14e59bb317c3c901bce83deb16ee9bfa5cc90e28.zip | |
Lint node for PRIVATE_BOUNDS is the item which has the bounds
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_privacy/src/lib.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 906a36cdb25..aedc7b22725 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -1463,14 +1463,15 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> { }; let vis = self.tcx.local_visibility(local_def_id); - let hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id); let span = self.tcx.def_span(self.item_def_id.to_def_id()); let vis_span = self.tcx.def_span(def_id); if self.in_assoc_ty && !vis.is_at_least(self.required_visibility, self.tcx) { let vis_descr = match vis { ty::Visibility::Public => "public", ty::Visibility::Restricted(vis_def_id) => { - if vis_def_id == self.tcx.parent_module(hir_id).to_local_def_id() { + if vis_def_id + == self.tcx.parent_module_from_def_id(local_def_id).to_local_def_id() + { "private" } else if vis_def_id.is_top_level_module() { "crate-private" @@ -1504,7 +1505,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> { }; self.tcx.emit_spanned_lint( lint, - hir_id, + self.tcx.hir().local_def_id_to_hir_id(self.item_def_id), span, PrivateInterfacesOrBoundsLint { item_span: span, |
