1
Fork 0

Rollup merge of #100147 - Bryanskiy:private-in-public, r=petrochenkov

optimization of access level table construction

Refactoring which was mentioned in #87487
This commit is contained in:
Guillaume Gomez 2022-09-02 11:34:48 +02:00 committed by GitHub
commit 1aaf9aec95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 326 additions and 125 deletions

View file

@ -2020,6 +2020,24 @@ impl<'a> Resolver<'a> {
}
self.main_def = Some(MainDefinition { res, is_import, span });
}
// Items that go to reexport table encoded to metadata and visible through it to other crates.
fn is_reexport(&self, binding: &NameBinding<'a>) -> Option<def::Res<!>> {
// FIXME: Consider changing the binding inserted by `#[macro_export] macro_rules`
// into the crate root to actual `NameBindingKind::Import`.
if binding.is_import()
|| matches!(binding.kind, NameBindingKind::Res(_, _is_macro_export @ true))
{
let res = binding.res().expect_non_local();
// Ambiguous imports are treated as errors at this point and are
// not exposed to other crates (see #36837 for more details).
if res != def::Res::Err && !binding.is_ambiguity() {
return Some(res);
}
}
return None;
}
}
fn names_to_string(names: &[Symbol]) -> String {