From 4e8199b572f2035b7749cba276ece3a26630d23e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:21 +0200 Subject: Adding upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- .../src/rmeta/decoder/cstore_impl.rs | 38 ++++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'compiler/rustc_metadata/src/rmeta/decoder') 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 { self.get_crate_data(def.krate).get_visibility(def.index) } - pub fn module_children_untracked(&self, def_id: DefId, sess: &Session) -> Vec { - 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 + '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 { -- cgit v1.2.3