1
Fork 0

Remove a use of feed_local_crate and make it fail if used within queries

This commit is contained in:
Oli Scherer 2024-02-19 16:58:18 +00:00
parent 3845be6b37
commit c696d4c323
5 changed files with 21 additions and 8 deletions

View file

@ -2230,7 +2230,6 @@ rustc_queries! {
/// Should not be called for the local crate before the resolver outputs are created, as it
/// is only fed there.
query stripped_cfg_items(cnum: CrateNum) -> &'tcx [StrippedCfgItem] {
feedable
desc { "getting cfg-ed out item names" }
separate_provide_extern
}

View file

@ -550,10 +550,16 @@ impl<T: fmt::Debug + Copy> fmt::Debug for Feed<'_, T> {
/// with T-compiler and making an analysis about why your addition
/// does not cause incremental compilation issues.
impl<'tcx> TyCtxt<'tcx> {
/// Can only be fed before queries are run, and is thus exempt from any
/// incremental issues. Do not use except for the initial query feeding.
pub fn feed_unit_query(self) -> TyCtxtFeed<'tcx, ()> {
TyCtxtFeed { tcx: self, key: () }
}
/// Can only be fed before queries are run, and is thus exempt from any
/// incremental issues. Do not use except for the initial query feeding.
pub fn feed_local_crate(self) -> TyCtxtFeed<'tcx, CrateNum> {
self.dep_graph.assert_ignored();
TyCtxtFeed { tcx: self, key: LOCAL_CRATE }
}

View file

@ -31,6 +31,7 @@ pub use assoc::*;
pub use generic_args::*;
pub use generics::*;
use rustc_ast as ast;
use rustc_ast::expand::StrippedCfgItem;
use rustc_ast::node_id::NodeMap;
pub use rustc_ast_ir::{Movability, Mutability};
use rustc_attr as attr;
@ -189,6 +190,7 @@ pub struct ResolverGlobalCtxt {
pub doc_link_resolutions: FxHashMap<LocalDefId, DocLinkResMap>,
pub doc_link_traits_in_scope: FxHashMap<LocalDefId, Vec<DefId>>,
pub all_macro_rules: FxHashMap<Symbol, Res<ast::NodeId>>,
pub stripped_cfg_items: Steal<Vec<StrippedCfgItem>>,
}
/// Resolutions that should only be used for lowering.