Only compute the DefId
when a diagnostic is definitely emitted
This commit is contained in:
parent
d35e830aad
commit
98d51fb44f
1 changed files with 22 additions and 22 deletions
|
@ -639,6 +639,16 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(glob_binding) = resolution.shadowed_glob {
|
if let Some(glob_binding) = resolution.shadowed_glob {
|
||||||
|
if binding.res() != Res::Err
|
||||||
|
&& glob_binding.res() != Res::Err
|
||||||
|
&& let NameBindingKind::Import { import: glob_import, .. } =
|
||||||
|
glob_binding.kind
|
||||||
|
&& let Some(glob_import_id) = glob_import.id()
|
||||||
|
&& let glob_import_def_id = self.local_def_id(glob_import_id)
|
||||||
|
&& self.effective_visibilities.is_exported(glob_import_def_id)
|
||||||
|
&& glob_binding.vis.is_public()
|
||||||
|
&& !binding.vis.is_public()
|
||||||
|
{
|
||||||
let binding_id = match binding.kind {
|
let binding_id = match binding.kind {
|
||||||
NameBindingKind::Res(res) => {
|
NameBindingKind::Res(res) => {
|
||||||
Some(self.def_id_to_node_id(res.def_id().expect_local()))
|
Some(self.def_id_to_node_id(res.def_id().expect_local()))
|
||||||
|
@ -648,18 +658,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||||
}
|
}
|
||||||
NameBindingKind::Import { import, .. } => import.id(),
|
NameBindingKind::Import { import, .. } => import.id(),
|
||||||
};
|
};
|
||||||
|
if let Some(binding_id) = binding_id {
|
||||||
if binding.res() != Res::Err
|
|
||||||
&& glob_binding.res() != Res::Err
|
|
||||||
&& let NameBindingKind::Import { import: glob_import, .. } =
|
|
||||||
glob_binding.kind
|
|
||||||
&& let Some(binding_id) = binding_id
|
|
||||||
&& let Some(glob_import_id) = glob_import.id()
|
|
||||||
&& let glob_import_def_id = self.local_def_id(glob_import_id)
|
|
||||||
&& self.effective_visibilities.is_exported(glob_import_def_id)
|
|
||||||
&& glob_binding.vis.is_public()
|
|
||||||
&& !binding.vis.is_public()
|
|
||||||
{
|
|
||||||
self.lint_buffer.buffer_lint(
|
self.lint_buffer.buffer_lint(
|
||||||
HIDDEN_GLOB_REEXPORTS,
|
HIDDEN_GLOB_REEXPORTS,
|
||||||
binding_id,
|
binding_id,
|
||||||
|
@ -676,6 +675,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn throw_unresolved_import_error(
|
fn throw_unresolved_import_error(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue