summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs')
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs38
1 files changed, 24 insertions, 14 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
index a0a085525..c5d4da079 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
@@ -21,7 +21,6 @@ use rustc_span::source_map::{Span, Spanned};
use rustc_span::symbol::{kw, Symbol};
use rustc_data_structures::sync::Lrc;
-use smallvec::SmallVec;
use std::any::Any;
use super::{Decodable, DecodeContext, DecodeIterator};
@@ -224,6 +223,15 @@ provide! { tcx, def_id, other, cdata,
generator_kind => { table }
trait_def => { table }
deduced_param_attrs => { table }
+ is_type_alias_impl_trait => {
+ debug_assert_eq!(tcx.def_kind(def_id), DefKind::OpaqueTy);
+ cdata
+ .root
+ .tables
+ .is_type_alias_impl_trait
+ .get(cdata, def_id.index)
+ .is_some()
+ }
collect_trait_impl_trait_tys => {
Ok(cdata
.root
@@ -255,6 +263,7 @@ provide! { tcx, def_id, other, cdata,
is_panic_runtime => { cdata.root.panic_runtime }
is_compiler_builtins => { cdata.root.compiler_builtins }
has_global_allocator => { cdata.root.has_global_allocator }
+ has_alloc_error_handler => { cdata.root.has_alloc_error_handler }
has_panic_handler => { cdata.root.has_panic_handler }
is_profiler_runtime => { cdata.root.profiler_runtime }
required_panic_strategy => { cdata.root.required_panic_strategy }
@@ -297,9 +306,7 @@ provide! { tcx, def_id, other, cdata,
r
}
module_children => {
- let mut result = SmallVec::<[_; 8]>::new();
- cdata.for_each_module_child(def_id.index, |child| result.push(child), tcx.sess);
- tcx.arena.alloc_slice(&result)
+ tcx.arena.alloc_from_iter(cdata.get_module_children(def_id.index, tcx.sess))
}
defined_lib_features => { cdata.get_lib_features(tcx) }
stability_implications => {
@@ -339,6 +346,7 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
// resolve! Does this work? Unsure! That's what the issue is about
*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
@@ -464,6 +472,10 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
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()
+ },
postorder_cnums: |tcx, ()| {
tcx.arena
.alloc_slice(&CStore::from_tcx(tcx).crate_dependencies_in_postorder(LOCAL_CRATE))
@@ -489,22 +501,20 @@ impl CStore {
self.get_crate_data(def.krate).get_struct_field_visibilities(def.index)
}
- pub fn ctor_def_id_and_kind_untracked(&self, def: DefId) -> Option<(DefId, CtorKind)> {
- self.get_crate_data(def.krate).get_ctor_def_id_and_kind(def.index)
+ pub fn ctor_untracked(&self, def: DefId) -> Option<(CtorKind, DefId)> {
+ self.get_crate_data(def.krate).get_ctor(def.index)
}
pub fn visibility_untracked(&self, def: DefId) -> Visibility<DefId> {
self.get_crate_data(def.krate).get_visibility(def.index)
}
- pub fn module_children_untracked(&self, def_id: DefId, sess: &Session) -> Vec<ModChild> {
- let mut result = vec![];
- self.get_crate_data(def_id.krate).for_each_module_child(
- def_id.index,
- |child| result.push(child),
- sess,
- );
- result
+ pub fn module_children_untracked<'a>(
+ &'a self,
+ def_id: DefId,
+ sess: &'a Session,
+ ) -> impl Iterator<Item = ModChild> + 'a {
+ self.get_crate_data(def_id.krate).get_module_children(def_id.index, sess)
}
pub fn load_macro_untracked(&self, id: DefId, sess: &Session) -> LoadedMacro {