Inline and remove pre_configure
This commit is contained in:
parent
3dbb4da042
commit
457dbbfc55
1 changed files with 4 additions and 15 deletions
|
@ -85,7 +85,6 @@ pub struct Queries<'tcx> {
|
||||||
hir_arena: WorkerLocal<rustc_hir::Arena<'tcx>>,
|
hir_arena: WorkerLocal<rustc_hir::Arena<'tcx>>,
|
||||||
|
|
||||||
parse: Query<ast::Crate>,
|
parse: Query<ast::Crate>,
|
||||||
pre_configure: Query<(ast::Crate, ast::AttrVec)>,
|
|
||||||
// This just points to what's in `gcx_cell`.
|
// This just points to what's in `gcx_cell`.
|
||||||
gcx: Query<&'tcx GlobalCtxt<'tcx>>,
|
gcx: Query<&'tcx GlobalCtxt<'tcx>>,
|
||||||
}
|
}
|
||||||
|
@ -98,7 +97,6 @@ impl<'tcx> Queries<'tcx> {
|
||||||
arena: WorkerLocal::new(|_| Arena::default()),
|
arena: WorkerLocal::new(|_| Arena::default()),
|
||||||
hir_arena: WorkerLocal::new(|_| rustc_hir::Arena::default()),
|
hir_arena: WorkerLocal::new(|_| rustc_hir::Arena::default()),
|
||||||
parse: Default::default(),
|
parse: Default::default(),
|
||||||
pre_configure: Default::default(),
|
|
||||||
gcx: Default::default(),
|
gcx: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,12 +111,12 @@ impl<'tcx> Queries<'tcx> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated = "pre_configure may be made private in the future. If you need it please open an issue with your use case."]
|
pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'_, &'tcx GlobalCtxt<'tcx>>> {
|
||||||
pub fn pre_configure(&self) -> Result<QueryResult<'_, (ast::Crate, ast::AttrVec)>> {
|
self.gcx.compute(|| {
|
||||||
self.pre_configure.compute(|| {
|
let sess = &self.compiler.sess;
|
||||||
|
|
||||||
let mut krate = self.parse()?.steal();
|
let mut krate = self.parse()?.steal();
|
||||||
|
|
||||||
let sess = &self.compiler.sess;
|
|
||||||
rustc_builtin_macros::cmdline_attrs::inject(
|
rustc_builtin_macros::cmdline_attrs::inject(
|
||||||
&mut krate,
|
&mut krate,
|
||||||
&sess.parse_sess,
|
&sess.parse_sess,
|
||||||
|
@ -127,15 +125,6 @@ impl<'tcx> Queries<'tcx> {
|
||||||
|
|
||||||
let pre_configured_attrs =
|
let pre_configured_attrs =
|
||||||
rustc_expand::config::pre_configure_attrs(sess, &krate.attrs);
|
rustc_expand::config::pre_configure_attrs(sess, &krate.attrs);
|
||||||
Ok((krate, pre_configured_attrs))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'_, &'tcx GlobalCtxt<'tcx>>> {
|
|
||||||
self.gcx.compute(|| {
|
|
||||||
let sess = &self.compiler.sess;
|
|
||||||
#[allow(deprecated)]
|
|
||||||
let (krate, pre_configured_attrs) = self.pre_configure()?.steal();
|
|
||||||
|
|
||||||
// parse `#[crate_name]` even if `--crate-name` was passed, to make sure it matches.
|
// parse `#[crate_name]` even if `--crate-name` was passed, to make sure it matches.
|
||||||
let crate_name = find_crate_name(sess, &pre_configured_attrs);
|
let crate_name = find_crate_name(sess, &pre_configured_attrs);
|
||||||
|
|
Loading…
Add table
Reference in a new issue