From 4547b622d8d29df964fa2914213088b148c498fc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:32 +0200 Subject: Merging upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_metadata/src/creader.rs | 105 +++++++++++--- compiler/rustc_metadata/src/errors.rs | 28 ++++ compiler/rustc_metadata/src/fs.rs | 20 +-- compiler/rustc_metadata/src/lib.rs | 2 +- compiler/rustc_metadata/src/locator.rs | 9 +- compiler/rustc_metadata/src/native_libs.rs | 13 +- compiler/rustc_metadata/src/rmeta/decoder.rs | 156 +++++++-------------- .../src/rmeta/decoder/cstore_impl.rs | 38 +++-- compiler/rustc_metadata/src/rmeta/encoder.rs | 123 +++++++--------- compiler/rustc_metadata/src/rmeta/mod.rs | 18 +-- compiler/rustc_metadata/src/rmeta/table.rs | 2 - 11 files changed, 275 insertions(+), 239 deletions(-) (limited to 'compiler/rustc_metadata/src') diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index cfcceecbe..efeaac8fe 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -1,8 +1,10 @@ //! Validates all used crates and extern libraries and loads their metadata use crate::errors::{ - ConflictingGlobalAlloc, CrateNotPanicRuntime, GlobalAllocRequired, NoMultipleGlobalAlloc, - NoPanicStrategy, NoTransitiveNeedsDep, NotProfilerRuntime, ProfilerBuiltinsNeedsCore, + AllocFuncRequired, ConflictingAllocErrorHandler, ConflictingGlobalAlloc, CrateNotPanicRuntime, + GlobalAllocRequired, MissingAllocErrorHandler, NoMultipleAllocErrorHandler, + NoMultipleGlobalAlloc, NoPanicStrategy, NoTransitiveNeedsDep, NotProfilerRuntime, + ProfilerBuiltinsNeedsCore, }; use crate::locator::{CrateError, CrateLocator, CratePaths}; use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob}; @@ -41,8 +43,13 @@ pub struct CStore { /// This crate needs an allocator and either provides it itself, or finds it in a dependency. /// If the above is true, then this field denotes the kind of the found allocator. allocator_kind: Option, + /// This crate needs an allocation error handler and either provides it itself, or finds it in a dependency. + /// If the above is true, then this field denotes the kind of the found allocator. + alloc_error_handler_kind: Option, /// This crate has a `#[global_allocator]` item. has_global_allocator: bool, + /// This crate has a `#[alloc_error_handler]` item. + has_alloc_error_handler: bool, /// This map is used to verify we get no hash conflicts between /// `StableCrateId` values. @@ -155,7 +162,7 @@ impl CStore { pub(crate) fn iter_crate_data(&self) -> impl Iterator { self.metas .iter_enumerated() - .filter_map(|(cnum, data)| data.as_ref().map(|data| (cnum, &**data))) + .filter_map(|(cnum, data)| data.as_deref().map(|data| (cnum, data))) } fn push_dependencies_in_postorder(&self, deps: &mut Vec, cnum: CrateNum) { @@ -197,10 +204,18 @@ impl CStore { self.allocator_kind } + pub(crate) fn alloc_error_handler_kind(&self) -> Option { + self.alloc_error_handler_kind + } + pub(crate) fn has_global_allocator(&self) -> bool { self.has_global_allocator } + pub(crate) fn has_alloc_error_handler(&self) -> bool { + self.has_alloc_error_handler + } + pub fn report_unused_deps(&self, tcx: TyCtxt<'_>) { let json_unused_externs = tcx.sess.opts.json_unused_externs; @@ -230,7 +245,7 @@ impl<'a> CrateLoader<'a> { pub fn new( sess: &'a Session, metadata_loader: Box, - local_crate_name: &str, + local_crate_name: Symbol, ) -> Self { let mut stable_crate_ids = FxHashMap::default(); stable_crate_ids.insert(sess.local_stable_crate_id(), LOCAL_CRATE); @@ -238,7 +253,7 @@ impl<'a> CrateLoader<'a> { CrateLoader { sess, metadata_loader, - local_crate_name: Symbol::intern(local_crate_name), + local_crate_name, cstore: CStore { // We add an empty entry for LOCAL_CRATE (which maps to zero) in // order to make array indices in `metas` match with the @@ -247,7 +262,9 @@ impl<'a> CrateLoader<'a> { metas: IndexVec::from_elem_n(None, 1), injected_panic_runtime: None, allocator_kind: None, + alloc_error_handler_kind: None, has_global_allocator: false, + has_alloc_error_handler: false, stable_crate_ids, unused_externs: Vec::new(), }, @@ -792,6 +809,13 @@ impl<'a> CrateLoader<'a> { } spans => !spans.is_empty(), }; + self.cstore.has_alloc_error_handler = match &*alloc_error_handler_spans(&self.sess, krate) { + [span1, span2, ..] => { + self.sess.emit_err(NoMultipleAllocErrorHandler { span2: *span2, span1: *span1 }); + true + } + spans => !spans.is_empty(), + }; // Check to see if we actually need an allocator. This desire comes // about through the `#![needs_allocator]` attribute and is typically @@ -832,22 +856,48 @@ impl<'a> CrateLoader<'a> { } } } + let mut alloc_error_handler = + self.cstore.has_alloc_error_handler.then(|| Symbol::intern("this crate")); + for (_, data) in self.cstore.iter_crate_data() { + if data.has_alloc_error_handler() { + match alloc_error_handler { + Some(other_crate) => { + self.sess.emit_err(ConflictingAllocErrorHandler { + crate_name: data.name(), + other_crate_name: other_crate, + }); + } + None => alloc_error_handler = Some(data.name()), + } + } + } if global_allocator.is_some() { self.cstore.allocator_kind = Some(AllocatorKind::Global); - return; + } else { + // Ok we haven't found a global allocator but we still need an + // allocator. At this point our allocator request is typically fulfilled + // by the standard library, denoted by the `#![default_lib_allocator]` + // attribute. + if !self.sess.contains_name(&krate.attrs, sym::default_lib_allocator) + && !self.cstore.iter_crate_data().any(|(_, data)| data.has_default_lib_allocator()) + { + self.sess.emit_err(GlobalAllocRequired); + } + self.cstore.allocator_kind = Some(AllocatorKind::Default); } - // Ok we haven't found a global allocator but we still need an - // allocator. At this point our allocator request is typically fulfilled - // by the standard library, denoted by the `#![default_lib_allocator]` - // attribute. - if !self.sess.contains_name(&krate.attrs, sym::default_lib_allocator) - && !self.cstore.iter_crate_data().any(|(_, data)| data.has_default_lib_allocator()) - { - self.sess.emit_err(GlobalAllocRequired); + if alloc_error_handler.is_some() { + self.cstore.alloc_error_handler_kind = Some(AllocatorKind::Global); + } else { + // The alloc crate provides a default allocation error handler if + // one isn't specified. + if !self.sess.features_untracked().default_alloc_error_handler { + self.sess.emit_err(AllocFuncRequired); + self.sess.emit_note(MissingAllocErrorHandler); + } + self.cstore.alloc_error_handler_kind = Some(AllocatorKind::Default); } - self.cstore.allocator_kind = Some(AllocatorKind::Default); } fn inject_dependency_if( @@ -950,7 +1000,7 @@ impl<'a> CrateLoader<'a> { ); let name = match orig_name { Some(orig_name) => { - validate_crate_name(self.sess, orig_name.as_str(), Some(item.span)); + validate_crate_name(self.sess, orig_name, Some(item.span)); orig_name } None => item.ident.name, @@ -1023,3 +1073,26 @@ fn global_allocator_spans(sess: &Session, krate: &ast::Crate) -> Vec { visit::walk_crate(&mut f, krate); f.spans } + +fn alloc_error_handler_spans(sess: &Session, krate: &ast::Crate) -> Vec { + struct Finder<'a> { + sess: &'a Session, + name: Symbol, + spans: Vec, + } + impl<'ast, 'a> visit::Visitor<'ast> for Finder<'a> { + fn visit_item(&mut self, item: &'ast ast::Item) { + if item.ident.name == self.name + && self.sess.contains_name(&item.attrs, sym::rustc_std_internal_symbol) + { + self.spans.push(item.span); + } + visit::walk_item(self, item) + } + } + + let name = Symbol::intern(&AllocatorKind::Global.fn_name(sym::oom)); + let mut f = Finder { sess, name, spans: Vec::new() }; + visit::walk_crate(&mut f, krate); + f.spans +} diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs index 7c387b9a9..6f7e6e09c 100644 --- a/compiler/rustc_metadata/src/errors.rs +++ b/compiler/rustc_metadata/src/errors.rs @@ -343,6 +343,16 @@ pub struct NoMultipleGlobalAlloc { pub span1: Span, } +#[derive(Diagnostic)] +#[diag(metadata_no_multiple_alloc_error_handler)] +pub struct NoMultipleAllocErrorHandler { + #[primary_span] + #[label] + pub span2: Span, + #[label(metadata_prev_alloc_error_handler)] + pub span1: Span, +} + #[derive(Diagnostic)] #[diag(metadata_conflicting_global_alloc)] pub struct ConflictingGlobalAlloc { @@ -350,10 +360,25 @@ pub struct ConflictingGlobalAlloc { pub other_crate_name: Symbol, } +#[derive(Diagnostic)] +#[diag(metadata_conflicting_alloc_error_handler)] +pub struct ConflictingAllocErrorHandler { + pub crate_name: Symbol, + pub other_crate_name: Symbol, +} + #[derive(Diagnostic)] #[diag(metadata_global_alloc_required)] pub struct GlobalAllocRequired; +#[derive(Diagnostic)] +#[diag(metadata_alloc_func_required)] +pub struct AllocFuncRequired; + +#[derive(Diagnostic)] +#[diag(metadata_missing_alloc_error_handler)] +pub struct MissingAllocErrorHandler; + #[derive(Diagnostic)] #[diag(metadata_no_transitive_needs_dep)] pub struct NoTransitiveNeedsDep<'a> { @@ -578,6 +603,7 @@ pub struct InvalidMetadataFiles { } impl IntoDiagnostic<'_> for InvalidMetadataFiles { + #[track_caller] fn into_diagnostic( self, handler: &'_ rustc_errors::Handler, @@ -606,6 +632,7 @@ pub struct CannotFindCrate { } impl IntoDiagnostic<'_> for CannotFindCrate { + #[track_caller] fn into_diagnostic( self, handler: &'_ rustc_errors::Handler, @@ -665,6 +692,7 @@ pub struct CrateLocationUnknownType<'a> { #[primary_span] pub span: Span, pub path: &'a Path, + pub crate_name: Symbol, } #[derive(Diagnostic)] diff --git a/compiler/rustc_metadata/src/fs.rs b/compiler/rustc_metadata/src/fs.rs index f360a5864..7601f6bd3 100644 --- a/compiler/rustc_metadata/src/fs.rs +++ b/compiler/rustc_metadata/src/fs.rs @@ -6,7 +6,7 @@ use crate::{encode_metadata, EncodedMetadata}; use rustc_data_structures::temp_dir::MaybeTempDir; use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::ty::TyCtxt; -use rustc_session::config::{CrateType, OutputFilenames, OutputType}; +use rustc_session::config::{CrateType, OutputType}; use rustc_session::output::filename_for_metadata; use rustc_session::Session; use tempfile::Builder as TempFileBuilder; @@ -22,9 +22,14 @@ pub const METADATA_FILENAME: &str = "lib.rmeta"; /// building an `.rlib` (stomping over one another), or writing an `.rmeta` into a /// directory being searched for `extern crate` (observing an incomplete file). /// The returned path is the temporary file containing the complete metadata. -pub fn emit_metadata(sess: &Session, metadata: &[u8], tmpdir: &MaybeTempDir) -> PathBuf { - let out_filename = tmpdir.as_ref().join(METADATA_FILENAME); - let result = fs::write(&out_filename, metadata); +pub fn emit_wrapper_file( + sess: &Session, + data: &[u8], + tmpdir: &MaybeTempDir, + name: &str, +) -> PathBuf { + let out_filename = tmpdir.as_ref().join(name); + let result = fs::write(&out_filename, data); if let Err(err) = result { sess.emit_fatal(FailedWriteError { filename: out_filename, err }); @@ -33,10 +38,7 @@ pub fn emit_metadata(sess: &Session, metadata: &[u8], tmpdir: &MaybeTempDir) -> out_filename } -pub fn encode_and_write_metadata( - tcx: TyCtxt<'_>, - outputs: &OutputFilenames, -) -> (EncodedMetadata, bool) { +pub fn encode_and_write_metadata(tcx: TyCtxt<'_>) -> (EncodedMetadata, bool) { #[derive(PartialEq, Eq, PartialOrd, Ord)] enum MetadataKind { None, @@ -59,7 +61,7 @@ pub fn encode_and_write_metadata( .unwrap_or(MetadataKind::None); let crate_name = tcx.crate_name(LOCAL_CRATE); - let out_filename = filename_for_metadata(tcx.sess, crate_name.as_str(), outputs); + let out_filename = filename_for_metadata(tcx.sess, crate_name, tcx.output_filenames(())); // To avoid races with another rustc process scanning the output directory, // we need to write the file somewhere else and atomically move it to its // final destination, with an `fs::rename` call. In order for the rename to diff --git a/compiler/rustc_metadata/src/lib.rs b/compiler/rustc_metadata/src/lib.rs index 98cf6fef5..1987f88e6 100644 --- a/compiler/rustc_metadata/src/lib.rs +++ b/compiler/rustc_metadata/src/lib.rs @@ -41,6 +41,6 @@ pub mod errors; pub mod fs; pub mod locator; -pub use fs::{emit_metadata, METADATA_FILENAME}; +pub use fs::{emit_wrapper_file, METADATA_FILENAME}; pub use native_libs::find_native_static_library; pub use rmeta::{encode_metadata, EncodedMetadata, METADATA_HEADER}; diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index 35f9ef92a..15546092e 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -707,6 +707,12 @@ impl<'a> CrateLocator<'a> { loc.original().clone(), )); } + if !loc.original().is_file() { + return Err(CrateError::ExternLocationNotFile( + self.crate_name, + loc.original().clone(), + )); + } let Some(file) = loc.original().file_name().and_then(|s| s.to_str()) else { return Err(CrateError::ExternLocationNotFile( self.crate_name, @@ -1020,11 +1026,10 @@ impl CrateError { None => String::new(), Some(r) => format!(" which `{}` depends on", r.name), }; - // FIXME: There are no tests for CrateLocationUnknownType or LibFilenameForm if !locator.crate_rejections.via_filename.is_empty() { let mismatches = locator.crate_rejections.via_filename.iter(); for CrateMismatch { path, .. } in mismatches { - sess.emit_err(CrateLocationUnknownType { span, path: &path }); + sess.emit_err(CrateLocationUnknownType { span, path: &path, crate_name }); sess.emit_err(LibFilenameForm { span, dll_prefix: &locator.dll_prefix, diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 20a2e7829..1fd35adf1 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -29,11 +29,11 @@ use std::path::PathBuf; pub fn find_native_static_library( name: &str, - verbatim: Option, + verbatim: bool, search_paths: &[PathBuf], sess: &Session, ) -> PathBuf { - let formats = if verbatim.unwrap_or(false) { + let formats = if verbatim { vec![("".into(), "".into())] } else { let os = (sess.target.staticlib_prefix.clone(), sess.target.staticlib_suffix.clone()); @@ -52,7 +52,7 @@ pub fn find_native_static_library( } } - sess.emit_fatal(MissingNativeLibrary::new(name, verbatim.unwrap_or(false))); + sess.emit_fatal(MissingNativeLibrary::new(name, verbatim)); } fn find_bundled_library( @@ -66,7 +66,7 @@ fn find_bundled_library( let NativeLibKind::Static { bundle: Some(true) | None, .. } = kind { find_native_static_library( name.unwrap().as_str(), - verbatim, + verbatim.unwrap_or(false), &sess.target_filesearch(PathKind::Native).search_path_dirs(), sess, ).file_name().and_then(|s| s.to_str()).map(Symbol::intern) @@ -311,10 +311,7 @@ impl<'tcx> Collector<'tcx> { sess.emit_err(BundleNeedsStatic { span }); } - ("verbatim", _) => { - report_unstable_modifier!(native_link_modifiers_verbatim); - assign_modifier(&mut verbatim) - } + ("verbatim", _) => assign_modifier(&mut verbatim), ("whole-archive", Some(NativeLibKind::Static { whole_archive, .. })) => { assign_modifier(whole_archive) diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index 691e3d0f8..af7b0793a 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -11,11 +11,10 @@ use rustc_data_structures::sync::{Lock, LockGuard, Lrc, OnceCell}; use rustc_data_structures::unhash::UnhashMap; use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind}; use rustc_expand::proc_macro::{AttrProcMacro, BangProcMacro, DeriveProcMacro}; -use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; +use rustc_hir::def::{CtorKind, DefKind, Res}; use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_hir::definitions::{DefKey, DefPath, DefPathData, DefPathHash}; use rustc_hir::diagnostic_items::DiagnosticItems; -use rustc_hir::lang_items; use rustc_index::vec::{Idx, IndexVec}; use rustc_middle::metadata::ModChild; use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportInfo}; @@ -30,17 +29,16 @@ use rustc_session::cstore::{ CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib, }; use rustc_session::Session; -use rustc_span::hygiene::{ExpnIndex, MacroKind}; +use rustc_span::hygiene::ExpnIndex; use rustc_span::source_map::{respan, Spanned}; -use rustc_span::symbol::{kw, sym, Ident, Symbol}; +use rustc_span::symbol::{kw, Ident, Symbol}; use rustc_span::{self, BytePos, ExpnId, Pos, Span, SyntaxContext, DUMMY_SP}; use proc_macro::bridge::client::ProcMacro; -use std::io; use std::iter::TrustedLen; -use std::mem; use std::num::NonZeroUsize; use std::path::Path; +use std::{io, iter, mem}; pub(super) use cstore_impl::provide; pub use cstore_impl::provide_extern; @@ -69,10 +67,10 @@ impl std::ops::Deref for MetadataBlob { } } -// A map from external crate numbers (as decoded from some crate file) to -// local crate numbers (as generated during this session). Each external -// crate may refer to types in other external crates, and each has their -// own crate numbers. +/// A map from external crate numbers (as decoded from some crate file) to +/// local crate numbers (as generated during this session). Each external +/// crate may refer to types in other external crates, and each has their +/// own crate numbers. pub(crate) type CrateNumMap = IndexVec; pub(crate) struct CrateMetadata { @@ -645,12 +643,6 @@ impl<'a, 'tcx> Decodable> for Symbol { } } -impl<'a, 'tcx> Decodable> for &'tcx [ty::abstract_const::Node<'tcx>] { - fn decode(d: &mut DecodeContext<'a, 'tcx>) -> Self { - ty::codec::RefDecodable::decode(d) - } -} - impl<'a, 'tcx> Decodable> for &'tcx [(ty::Predicate<'tcx>, Span)] { fn decode(d: &mut DecodeContext<'a, 'tcx>) -> Self { ty::codec::RefDecodable::decode(d) @@ -867,12 +859,12 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { let variant_did = if adt_kind == ty::AdtKind::Enum { Some(self.local_def_id(index)) } else { None }; - let ctor_did = data.ctor.map(|index| self.local_def_id(index)); + let ctor = data.ctor.map(|(kind, index)| (kind, self.local_def_id(index))); ty::VariantDef::new( self.item_name(index), variant_did, - ctor_did, + ctor, data.discr, self.root .tables @@ -886,7 +878,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { vis: self.get_visibility(index), }) .collect(), - data.ctor_kind, adt_kind, parent_did, false, @@ -967,7 +958,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { } /// Iterates over the language items in the given crate. - fn get_lang_items(self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, usize)] { + fn get_lang_items(self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, LangItem)] { tcx.arena.alloc_from_iter( self.root .lang_items @@ -992,87 +983,52 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { DiagnosticItems { id_to_name, name_to_id } } + fn get_mod_child(self, id: DefIndex, sess: &Session) -> ModChild { + let ident = self.item_ident(id, sess); + let kind = self.def_kind(id); + let def_id = self.local_def_id(id); + let res = Res::Def(kind, def_id); + let vis = self.get_visibility(id); + let span = self.get_span(id, sess); + let macro_rules = match kind { + DefKind::Macro(..) => self.root.tables.macro_rules.get(self, id).is_some(), + _ => false, + }; + + ModChild { ident, res, vis, span, macro_rules } + } + /// Iterates over all named children of the given module, /// including both proper items and reexports. /// Module here is understood in name resolution sense - it can be a `mod` item, /// or a crate root, or an enum, or a trait. - fn for_each_module_child( + fn get_module_children( self, id: DefIndex, - mut callback: impl FnMut(ModChild), - sess: &Session, - ) { - if let Some(data) = &self.root.proc_macro_data { - // If we are loading as a proc macro, we want to return - // the view of this crate as a proc macro crate. - if id == CRATE_DEF_INDEX { - for def_index in data.macros.decode(self) { - let raw_macro = self.raw_proc_macro(def_index); - let res = Res::Def( - DefKind::Macro(macro_kind(raw_macro)), - self.local_def_id(def_index), - ); - let ident = self.item_ident(def_index, sess); - callback(ModChild { - ident, - res, - vis: ty::Visibility::Public, - span: ident.span, - macro_rules: false, - }); - } - } - return; - } - - // Iterate over all children. - if let Some(children) = self.root.tables.children.get(self, id) { - for child_index in children.decode((self, sess)) { - let ident = self.item_ident(child_index, sess); - let kind = self.def_kind(child_index); - let def_id = self.local_def_id(child_index); - let res = Res::Def(kind, def_id); - let vis = self.get_visibility(child_index); - let span = self.get_span(child_index, sess); - let macro_rules = match kind { - DefKind::Macro(..) => { - self.root.tables.macro_rules.get(self, child_index).is_some() + sess: &'a Session, + ) -> impl Iterator + 'a { + iter::from_generator(move || { + if let Some(data) = &self.root.proc_macro_data { + // If we are loading as a proc macro, we want to return + // the view of this crate as a proc macro crate. + if id == CRATE_DEF_INDEX { + for child_index in data.macros.decode(self) { + yield self.get_mod_child(child_index, sess); } - _ => false, - }; - - callback(ModChild { ident, res, vis, span, macro_rules }); + } + } else { + // Iterate over all children. + for child_index in self.root.tables.children.get(self, id).unwrap().decode(self) { + yield self.get_mod_child(child_index, sess); + } - // For non-reexport variants add their fictive constructors to children. - // Braced variants, unlike structs, generate unusable names in value namespace, - // they are reserved for possible future use. It's ok to use the variant's id as - // a ctor id since an error will be reported on any use of such resolution anyway. - // Reexport lists automatically contain such constructors when necessary. - if kind == DefKind::Variant && self.get_ctor_def_id_and_kind(child_index).is_none() - { - let ctor_res = - Res::Def(DefKind::Ctor(CtorOf::Variant, CtorKind::Fictive), def_id); - let mut vis = vis; - if vis.is_public() { - // For non-exhaustive variants lower the constructor visibility to - // within the crate. We only need this for fictive constructors, - // for other constructors correct visibilities - // were already encoded in metadata. - let mut attrs = self.get_item_attrs(def_id.index, sess); - if attrs.any(|item| item.has_name(sym::non_exhaustive)) { - vis = ty::Visibility::Restricted(self.local_def_id(CRATE_DEF_INDEX)); - } + if let Some(reexports) = self.root.tables.module_reexports.get(self, id) { + for reexport in reexports.decode((self, sess)) { + yield reexport; } - callback(ModChild { ident, res: ctor_res, vis, span, macro_rules: false }); } } - } - - if let Some(exports) = self.root.tables.module_reexports.get(self, id) { - for exp in exports.decode((self, sess)) { - callback(exp); - } - } + }) } fn is_ctfe_mir_available(self, id: DefIndex) -> bool { @@ -1137,11 +1093,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { } } - fn get_ctor_def_id_and_kind(self, node_id: DefIndex) -> Option<(DefId, CtorKind)> { + fn get_ctor(self, node_id: DefIndex) -> Option<(CtorKind, DefId)> { match self.def_kind(node_id) { DefKind::Struct | DefKind::Variant => { let vdata = self.root.tables.variant_data.get(self, node_id).unwrap().decode(self); - vdata.ctor.map(|index| (self.local_def_id(index), vdata.ctor_kind)) + vdata.ctor.map(|(kind, index)| (kind, self.local_def_id(index))) } _ => None, } @@ -1319,7 +1275,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { ) } - fn get_missing_lang_items(self, tcx: TyCtxt<'tcx>) -> &'tcx [lang_items::LangItem] { + fn get_missing_lang_items(self, tcx: TyCtxt<'tcx>) -> &'tcx [LangItem] { tcx.arena.alloc_from_iter(self.root.lang_items_missing.decode(self)) } @@ -1765,6 +1721,10 @@ impl CrateMetadata { self.root.has_global_allocator } + pub(crate) fn has_alloc_error_handler(&self) -> bool { + self.root.has_alloc_error_handler + } + pub(crate) fn has_default_lib_allocator(&self) -> bool { self.root.has_default_lib_allocator } @@ -1805,13 +1765,3 @@ impl CrateMetadata { None } } - -// Cannot be implemented on 'ProcMacro', as libproc_macro -// does not depend on librustc_ast -fn macro_kind(raw: &ProcMacro) -> MacroKind { - match raw { - ProcMacro::CustomDerive { .. } => MacroKind::Derive, - ProcMacro::Attr { .. } => MacroKind::Attr, - ProcMacro::Bang { .. } => MacroKind::Bang, - } -} 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 { diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 049514ec7..7304c891e 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -17,7 +17,7 @@ use rustc_hir::def_id::{ }; use rustc_hir::definitions::DefPathData; use rustc_hir::intravisit::{self, Visitor}; -use rustc_hir::lang_items; +use rustc_hir::lang_items::LangItem; use rustc_middle::hir::nested_filter; use rustc_middle::middle::dependency_format::Linkage; use rustc_middle::middle::exported_symbols::{ @@ -670,6 +670,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { panic_in_drop_strategy: tcx.sess.opts.unstable_opts.panic_in_drop, edition: tcx.sess.edition(), has_global_allocator: tcx.has_global_allocator(LOCAL_CRATE), + has_alloc_error_handler: tcx.has_alloc_error_handler(LOCAL_CRATE), has_panic_handler: tcx.has_panic_handler(LOCAL_CRATE), has_default_lib_allocator: tcx .sess @@ -787,8 +788,7 @@ fn should_encode_attr( } else if attr.doc_str().is_some() { // We keep all public doc comments because they might be "imported" into downstream crates // if they use `#[doc(inline)]` to copy an item's documentation into their own. - *is_def_id_public - .get_or_insert_with(|| tcx.effective_visibilities(()).effective_vis(def_id).is_some()) + *is_def_id_public.get_or_insert_with(|| tcx.effective_visibilities(()).is_exported(def_id)) } else if attr.has_name(sym::doc) { // If this is a `doc` attribute, and it's marked `inline` (as in `#[doc(inline)]`), we can // remove it. It won't be inlinable in downstream crates. @@ -928,6 +928,8 @@ fn should_encode_variances(def_kind: DefKind) -> bool { | DefKind::Union | DefKind::Enum | DefKind::Variant + | DefKind::OpaqueTy + | DefKind::ImplTraitPlaceholder | DefKind::Fn | DefKind::Ctor(..) | DefKind::AssocFn => true, @@ -941,8 +943,6 @@ fn should_encode_variances(def_kind: DefKind) -> bool { | DefKind::Const | DefKind::ForeignMod | DefKind::TyAlias - | DefKind::OpaqueTy - | DefKind::ImplTraitPlaceholder | DefKind::Impl | DefKind::Trait | DefKind::TraitAlias @@ -1221,9 +1221,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { debug!("EncodeContext::encode_enum_variant_info({:?})", def_id); let data = VariantData { - ctor_kind: variant.ctor_kind, discr: variant.discr, - ctor: variant.ctor_def_id.map(|did| did.index), + ctor: variant.ctor.map(|(kind, def_id)| (kind, def_id.index)), is_non_exhaustive: variant.is_field_list_non_exhaustive(), }; @@ -1233,32 +1232,28 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { assert!(f.did.is_local()); f.did.index })); - if variant.ctor_kind == CtorKind::Fn { + if let Some((CtorKind::Fn, ctor_def_id)) = variant.ctor { // FIXME(eddyb) encode signature only in `encode_enum_variant_ctor`. - if let Some(ctor_def_id) = variant.ctor_def_id { - record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(ctor_def_id)); - } + record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(ctor_def_id)); } } fn encode_enum_variant_ctor(&mut self, def: ty::AdtDef<'tcx>, index: VariantIdx) { - let tcx = self.tcx; let variant = &def.variant(index); - let def_id = variant.ctor_def_id.unwrap(); + let Some((ctor_kind, def_id)) = variant.ctor else { return }; debug!("EncodeContext::encode_enum_variant_ctor({:?})", def_id); // FIXME(eddyb) encode only the `CtorKind` for constructors. let data = VariantData { - ctor_kind: variant.ctor_kind, discr: variant.discr, - ctor: Some(def_id.index), + ctor: Some((ctor_kind, def_id.index)), is_non_exhaustive: variant.is_field_list_non_exhaustive(), }; record!(self.tables.variant_data[def_id] <- data); self.tables.constness.set(def_id.index, hir::Constness::Const); - if variant.ctor_kind == CtorKind::Fn { - record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id)); + if ctor_kind == CtorKind::Fn { + record!(self.tables.fn_sig[def_id] <- self.tcx.fn_sig(def_id)); } } @@ -1272,13 +1267,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { // the crate root for consistency with other crates (some of the resolver // code uses it). However, we skip encoding anything relating to child // items - we encode information about proc-macros later on. - let reexports = if !self.is_proc_macro { - tcx.module_reexports(local_def_id).unwrap_or(&[]) - } else { - &[] - }; - - record_array!(self.tables.module_reexports[def_id] <- reexports); if self.is_proc_macro { // Encode this here because we don't do it in encode_def_ids. record!(self.tables.expn_that_defined[def_id] <- tcx.expn_that_defined(local_def_id)); @@ -1310,26 +1298,30 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } } })); + + if let Some(reexports) = tcx.module_reexports(local_def_id) { + assert!(!reexports.is_empty()); + record_array!(self.tables.module_reexports[def_id] <- reexports); + } } } - fn encode_struct_ctor(&mut self, adt_def: ty::AdtDef<'tcx>, def_id: DefId) { - debug!("EncodeContext::encode_struct_ctor({:?})", def_id); - let tcx = self.tcx; + fn encode_struct_ctor(&mut self, adt_def: ty::AdtDef<'tcx>) { let variant = adt_def.non_enum_variant(); + let Some((ctor_kind, def_id)) = variant.ctor else { return }; + debug!("EncodeContext::encode_struct_ctor({:?})", def_id); let data = VariantData { - ctor_kind: variant.ctor_kind, discr: variant.discr, - ctor: Some(def_id.index), + ctor: Some((ctor_kind, def_id.index)), is_non_exhaustive: variant.is_field_list_non_exhaustive(), }; record!(self.tables.repr_options[def_id] <- adt_def.repr()); record!(self.tables.variant_data[def_id] <- data); self.tables.constness.set(def_id.index, hir::Constness::Const); - if variant.ctor_kind == CtorKind::Fn { - record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id)); + if ctor_kind == CtorKind::Fn { + record!(self.tables.fn_sig[def_id] <- self.tcx.fn_sig(def_id)); } } @@ -1543,30 +1535,25 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { hir::ItemKind::Mod(ref m) => { return self.encode_info_for_mod(item.owner_id.def_id, m); } - hir::ItemKind::OpaqueTy(..) => { + hir::ItemKind::OpaqueTy(ref opaque) => { self.encode_explicit_item_bounds(def_id); + if matches!(opaque.origin, hir::OpaqueTyOrigin::TyAlias) { + self.tables.is_type_alias_impl_trait.set(def_id.index, ()); + } } hir::ItemKind::Enum(..) => { let adt_def = self.tcx.adt_def(def_id); record!(self.tables.repr_options[def_id] <- adt_def.repr()); } - hir::ItemKind::Struct(ref struct_def, _) => { + hir::ItemKind::Struct(..) => { let adt_def = self.tcx.adt_def(def_id); record!(self.tables.repr_options[def_id] <- adt_def.repr()); self.tables.constness.set(def_id.index, hir::Constness::Const); - // Encode def_ids for each field and method - // for methods, write all the stuff get_trait_method - // needs to know - let ctor = struct_def - .ctor_hir_id() - .map(|ctor_hir_id| self.tcx.hir().local_def_id(ctor_hir_id).local_def_index); - let variant = adt_def.non_enum_variant(); record!(self.tables.variant_data[def_id] <- VariantData { - ctor_kind: variant.ctor_kind, discr: variant.discr, - ctor, + ctor: variant.ctor.map(|(kind, def_id)| (kind, def_id.index)), is_non_exhaustive: variant.is_field_list_non_exhaustive(), }); } @@ -1576,9 +1563,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { let variant = adt_def.non_enum_variant(); record!(self.tables.variant_data[def_id] <- VariantData { - ctor_kind: variant.ctor_kind, discr: variant.discr, - ctor: None, + ctor: variant.ctor.map(|(kind, def_id)| (kind, def_id.index)), is_non_exhaustive: variant.is_field_list_non_exhaustive(), }); } @@ -1631,7 +1617,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { for variant in tcx.adt_def(def_id).variants() { yield variant.def_id.index; // Encode constructors which take a separate slot in value namespace. - if let Some(ctor_def_id) = variant.ctor_def_id { + if let Some(ctor_def_id) = variant.ctor_def_id() { yield ctor_def_id.index; } } @@ -1674,21 +1660,14 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { match item.kind { hir::ItemKind::Enum(..) => { let def = self.tcx.adt_def(item.owner_id.to_def_id()); - for (i, variant) in def.variants().iter_enumerated() { + for (i, _) in def.variants().iter_enumerated() { self.encode_enum_variant_info(def, i); - - if let Some(_ctor_def_id) = variant.ctor_def_id { - self.encode_enum_variant_ctor(def, i); - } + self.encode_enum_variant_ctor(def, i); } } - hir::ItemKind::Struct(ref struct_def, _) => { + hir::ItemKind::Struct(..) => { let def = self.tcx.adt_def(item.owner_id.to_def_id()); - // If the struct has a constructor, encode it. - if let Some(ctor_hir_id) = struct_def.ctor_hir_id() { - let ctor_def_id = self.tcx.hir().local_def_id(ctor_hir_id); - self.encode_struct_ctor(def, ctor_def_id.to_def_id()); - } + self.encode_struct_ctor(def); } hir::ItemKind::Impl { .. } => { for &trait_item_def_id in @@ -1708,12 +1687,12 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } } - fn encode_info_for_closure(&mut self, hir_id: hir::HirId) { - let def_id = self.tcx.hir().local_def_id(hir_id); - debug!("EncodeContext::encode_info_for_closure({:?})", def_id); + #[instrument(level = "debug", skip(self))] + fn encode_info_for_closure(&mut self, def_id: LocalDefId) { // NOTE(eddyb) `tcx.type_of(def_id)` isn't used because it's fully generic, // including on the signature, which is inferred in `typeck. let typeck_result: &'tcx ty::TypeckResults<'tcx> = self.tcx.typeck(def_id); + let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id); let ty = typeck_result.node_type(hir_id); match ty.kind() { ty::Generator(..) => { @@ -1905,22 +1884,15 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { self.lazy_array(diagnostic_items.iter().map(|(&name, def_id)| (name, def_id.index))) } - fn encode_lang_items(&mut self) -> LazyArray<(DefIndex, usize)> { + fn encode_lang_items(&mut self) -> LazyArray<(DefIndex, LangItem)> { empty_proc_macro!(self); - let tcx = self.tcx; - let lang_items = tcx.lang_items(); - let lang_items = lang_items.items().iter(); - self.lazy_array(lang_items.enumerate().filter_map(|(i, &opt_def_id)| { - if let Some(def_id) = opt_def_id { - if def_id.is_local() { - return Some((def_id.index, i)); - } - } - None + let lang_items = self.tcx.lang_items().iter(); + self.lazy_array(lang_items.filter_map(|(lang_item, def_id)| { + def_id.as_local().map(|id| (id.local_def_index, lang_item)) })) } - fn encode_lang_items_missing(&mut self) -> LazyArray { + fn encode_lang_items_missing(&mut self) -> LazyArray { empty_proc_macro!(self); let tcx = self.tcx; self.lazy_array(&tcx.lang_items().missing) @@ -2108,11 +2080,10 @@ impl<'a, 'tcx> Visitor<'tcx> for EncodeContext<'a, 'tcx> { impl<'a, 'tcx> EncodeContext<'a, 'tcx> { fn encode_info_for_generics(&mut self, generics: &hir::Generics<'tcx>) { for param in generics.params { - let def_id = self.tcx.hir().local_def_id(param.hir_id); match param.kind { hir::GenericParamKind::Lifetime { .. } | hir::GenericParamKind::Type { .. } => {} hir::GenericParamKind::Const { ref default, .. } => { - let def_id = def_id.to_def_id(); + let def_id = param.def_id.to_def_id(); if default.is_some() { record!(self.tables.const_param_default[def_id] <- self.tcx.const_param_default(def_id)) } @@ -2122,8 +2093,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } fn encode_info_for_expr(&mut self, expr: &hir::Expr<'_>) { - if let hir::ExprKind::Closure { .. } = expr.kind { - self.encode_info_for_closure(expr.hir_id); + if let hir::ExprKind::Closure(closure) = expr.kind { + self.encode_info_for_closure(closure.def_id); } } } @@ -2196,7 +2167,7 @@ impl EncodedMetadata { #[inline] pub fn raw_data(&self) -> &[u8] { - self.mmap.as_ref().map(|mmap| mmap.as_ref()).unwrap_or_default() + self.mmap.as_deref().unwrap_or_default() } } diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs index 27dc8ff16..571804644 100644 --- a/compiler/rustc_metadata/src/rmeta/mod.rs +++ b/compiler/rustc_metadata/src/rmeta/mod.rs @@ -12,7 +12,7 @@ use rustc_hir as hir; use rustc_hir::def::{CtorKind, DefKind}; use rustc_hir::def_id::{CrateNum, DefId, DefIndex, DefPathHash, StableCrateId}; use rustc_hir::definitions::DefKey; -use rustc_hir::lang_items; +use rustc_hir::lang_items::LangItem; use rustc_index::bit_set::{BitSet, FiniteBitSet}; use rustc_index::vec::IndexVec; use rustc_middle::metadata::ModChild; @@ -223,6 +223,7 @@ pub(crate) struct CrateRoot { panic_in_drop_strategy: PanicStrategy, edition: Edition, has_global_allocator: bool, + has_alloc_error_handler: bool, has_panic_handler: bool, has_default_lib_allocator: bool, @@ -230,8 +231,8 @@ pub(crate) struct CrateRoot { dylib_dependency_formats: LazyArray>, lib_features: LazyArray<(Symbol, Option)>, stability_implications: LazyArray<(Symbol, Symbol)>, - lang_items: LazyArray<(DefIndex, usize)>, - lang_items_missing: LazyArray, + lang_items: LazyArray<(DefIndex, LangItem)>, + lang_items_missing: LazyArray, diagnostic_items: LazyArray<(Symbol, DefIndex)>, native_libraries: LazyArray, foreign_modules: LazyArray, @@ -352,7 +353,7 @@ define_tables! { explicit_predicates_of: Table>>, generics_of: Table>, // As an optimization, a missing entry indicates an empty `&[]`. - inferred_outlives_of: Table, Span)>>, + inferred_outlives_of: Table, Span)>>, super_predicates_of: Table>>, type_of: Table>>, variances_of: Table>, @@ -365,7 +366,7 @@ define_tables! { mir_for_ctfe: Table>>, promoted_mir: Table>>>, // FIXME(compiler-errors): Why isn't this a LazyArray? - thir_abstract_const: Table]>>, + thir_abstract_const: Table>>, impl_parent: Table, impl_polarity: Table, constness: Table, @@ -399,20 +400,21 @@ define_tables! { assoc_container: Table, // Slot is full when macro is macro_rules. macro_rules: Table, - macro_definition: Table>, + macro_definition: Table>, proc_macro: Table, module_reexports: Table>, deduced_param_attrs: Table>, + // Slot is full when opaque is TAIT. + is_type_alias_impl_trait: Table, trait_impl_trait_tys: Table>>>, } #[derive(TyEncodable, TyDecodable)] struct VariantData { - ctor_kind: CtorKind, discr: ty::VariantDiscr, /// If this is unit or tuple-variant/struct, then this is the index of the ctor id. - ctor: Option, + ctor: Option<(CtorKind, DefIndex)>, is_non_exhaustive: bool, } diff --git a/compiler/rustc_metadata/src/rmeta/table.rs b/compiler/rustc_metadata/src/rmeta/table.rs index e7c1abd12..29fe61107 100644 --- a/compiler/rustc_metadata/src/rmeta/table.rs +++ b/compiler/rustc_metadata/src/rmeta/table.rs @@ -101,10 +101,8 @@ fixed_size_enum! { ( Static(ast::Mutability::Mut) ) ( Ctor(CtorOf::Struct, CtorKind::Fn) ) ( Ctor(CtorOf::Struct, CtorKind::Const) ) - ( Ctor(CtorOf::Struct, CtorKind::Fictive) ) ( Ctor(CtorOf::Variant, CtorKind::Fn) ) ( Ctor(CtorOf::Variant, CtorKind::Const) ) - ( Ctor(CtorOf::Variant, CtorKind::Fictive) ) ( Macro(MacroKind::Bang) ) ( Macro(MacroKind::Attr) ) ( Macro(MacroKind::Derive) ) -- cgit v1.2.3