Use local key in providers
This commit is contained in:
parent
a01b4cc9f3
commit
2eb1c08e43
65 changed files with 458 additions and 395 deletions
|
@ -367,10 +367,7 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
|
|||
*providers = Providers {
|
||||
allocator_kind: |tcx, ()| CStore::from_tcx(tcx).allocator_kind(),
|
||||
alloc_error_handler_kind: |tcx, ()| CStore::from_tcx(tcx).alloc_error_handler_kind(),
|
||||
is_private_dep: |_tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
false
|
||||
},
|
||||
is_private_dep: |_tcx, ()| false,
|
||||
native_library: |tcx, id| {
|
||||
tcx.native_libraries(id.krate)
|
||||
.iter()
|
||||
|
@ -386,12 +383,8 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
|
|||
.contains(&id)
|
||||
})
|
||||
},
|
||||
native_libraries: |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
native_libs::collect(tcx)
|
||||
},
|
||||
foreign_modules: |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
native_libraries: |tcx, ()| native_libs::collect(tcx),
|
||||
foreign_modules: |tcx, ()| {
|
||||
foreign_modules::collect(tcx).into_iter().map(|m| (m.def_id, m)).collect()
|
||||
},
|
||||
|
||||
|
@ -489,14 +482,8 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
|
|||
},
|
||||
|
||||
dependency_formats: |tcx, ()| Lrc::new(crate::dependency_format::calculate(tcx)),
|
||||
has_global_allocator: |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
CStore::from_tcx(tcx).has_global_allocator()
|
||||
},
|
||||
has_alloc_error_handler: |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
CStore::from_tcx(tcx).has_alloc_error_handler()
|
||||
},
|
||||
has_global_allocator: |tcx, ()| CStore::from_tcx(tcx).has_global_allocator(),
|
||||
has_alloc_error_handler: |tcx, ()| CStore::from_tcx(tcx).has_alloc_error_handler(),
|
||||
postorder_cnums: |tcx, ()| {
|
||||
tcx.arena
|
||||
.alloc_slice(&CStore::from_tcx(tcx).crate_dependencies_in_postorder(LOCAL_CRATE))
|
||||
|
|
|
@ -2231,18 +2231,16 @@ pub fn provide(providers: &mut Providers) {
|
|||
doc_link_resolutions: |tcx, def_id| {
|
||||
tcx.resolutions(())
|
||||
.doc_link_resolutions
|
||||
.get(&def_id.expect_local())
|
||||
.get(&def_id)
|
||||
.expect("no resolutions for a doc link")
|
||||
},
|
||||
doc_link_traits_in_scope: |tcx, def_id| {
|
||||
tcx.resolutions(())
|
||||
.doc_link_traits_in_scope
|
||||
.get(&def_id.expect_local())
|
||||
.get(&def_id)
|
||||
.expect("no traits in scope for a doc link")
|
||||
},
|
||||
traits_in_crate: |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
traits_in_crate: |tcx, ()| {
|
||||
let mut traits = Vec::new();
|
||||
for id in tcx.hir().items() {
|
||||
if matches!(tcx.def_kind(id.owner_id), DefKind::Trait | DefKind::TraitAlias) {
|
||||
|
@ -2254,9 +2252,7 @@ pub fn provide(providers: &mut Providers) {
|
|||
traits.sort_by_cached_key(|&def_id| tcx.def_path_hash(def_id));
|
||||
tcx.arena.alloc_slice(&traits)
|
||||
},
|
||||
trait_impls_in_crate: |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
trait_impls_in_crate: |tcx, ()| {
|
||||
let mut trait_impls = Vec::new();
|
||||
for id in tcx.hir().items() {
|
||||
if matches!(tcx.def_kind(id.owner_id), DefKind::Impl { .. })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue