mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-01 09:33:26 +00:00
Don't allow access to the Session.
This commit is contained in:
parent
d224e214e0
commit
260cfaba12
@ -4047,7 +4047,6 @@ dependencies = [
|
||||
"rustc_errors",
|
||||
"rustc_index",
|
||||
"rustc_macros",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"serialize",
|
||||
"smallvec 1.0.0",
|
||||
|
@ -13,15 +13,17 @@ use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_errors::{struct_span_err, Diagnostic, DiagnosticBuilder, Handler, Level};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::Span;
|
||||
|
||||
impl QueryContext for TyCtxt<'tcx> {
|
||||
type Query = Query<'tcx>;
|
||||
|
||||
fn session(&self) -> &Session {
|
||||
&self.sess
|
||||
fn incremental_verify_ich(&self) -> bool {
|
||||
self.sess.opts.debugging_opts.incremental_verify_ich
|
||||
}
|
||||
fn verbose(&self) -> bool {
|
||||
self.sess.verbose()
|
||||
}
|
||||
|
||||
fn def_path_str(&self, def_id: DefId) -> String {
|
||||
|
@ -17,7 +17,6 @@ rustc_errors = { path = "../librustc_errors" }
|
||||
rustc_index = { path = "../librustc_index" }
|
||||
rustc_macros = { path = "../librustc_macros" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
rustc_session = { path = "../librustc_session" }
|
||||
rustc_span = { path = "../librustc_span" }
|
||||
parking_lot = "0.9"
|
||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||
|
@ -15,7 +15,6 @@ use rustc_data_structures::stable_hasher::HashStable;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_errors::Diagnostic;
|
||||
use rustc_session::Session;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
@ -33,8 +32,8 @@ pub trait QueryConfig<CTX> {
|
||||
pub trait QueryContext: DepContext {
|
||||
type Query: Clone + HashStable<Self::StableHashingContext>;
|
||||
|
||||
/// Access the session.
|
||||
fn session(&self) -> &Session;
|
||||
fn incremental_verify_ich(&self) -> bool;
|
||||
fn verbose(&self) -> bool;
|
||||
|
||||
/// Get string representation from DefPath.
|
||||
fn def_path_str(&self, def_id: DefId) -> String;
|
||||
@ -101,7 +100,7 @@ where
|
||||
M: QueryAccessors<CTX, Key = DefId>,
|
||||
{
|
||||
default fn describe(tcx: CTX, def_id: DefId) -> Cow<'static, str> {
|
||||
if !tcx.session().verbose() {
|
||||
if !tcx.verbose() {
|
||||
format!("processing `{}`", tcx.def_path_str(def_id)).into()
|
||||
} else {
|
||||
let name = ::std::any::type_name::<M>();
|
||||
|
@ -514,7 +514,7 @@ where
|
||||
|
||||
// If `-Zincremental-verify-ich` is specified, re-hash results from
|
||||
// the cache and make sure that they have the expected fingerprint.
|
||||
if unlikely!(tcx.session().opts.debugging_opts.incremental_verify_ich) {
|
||||
if unlikely!(tcx.incremental_verify_ich()) {
|
||||
incremental_verify_ich::<Q, _>(tcx, &result, dep_node, dep_node_index);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user