Skip to content

Commit 260cfab

Browse files
committed
Don't allow access to the Session.
1 parent d224e21 commit 260cfab

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

Cargo.lock

-1
Original file line numberDiff line numberDiff line change
@@ -4047,7 +4047,6 @@ dependencies = [
40474047
"rustc_errors",
40484048
"rustc_index",
40494049
"rustc_macros",
4050-
"rustc_session",
40514050
"rustc_span",
40524051
"serialize",
40534052
"smallvec 1.0.0",

src/librustc/ty/query/plumbing.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ use rustc_data_structures::fx::FxHashMap;
1313
use rustc_data_structures::sync::Lock;
1414
use rustc_data_structures::thin_vec::ThinVec;
1515
use rustc_errors::{struct_span_err, Diagnostic, DiagnosticBuilder, Handler, Level};
16-
use rustc_session::Session;
1716
use rustc_span::def_id::DefId;
1817
use rustc_span::Span;
1918

2019
impl QueryContext for TyCtxt<'tcx> {
2120
type Query = Query<'tcx>;
2221

23-
fn session(&self) -> &Session {
24-
&self.sess
22+
fn incremental_verify_ich(&self) -> bool {
23+
self.sess.opts.debugging_opts.incremental_verify_ich
24+
}
25+
fn verbose(&self) -> bool {
26+
self.sess.verbose()
2527
}
2628

2729
fn def_path_str(&self, def_id: DefId) -> String {

src/librustc_query_system/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ rustc_errors = { path = "../librustc_errors" }
1717
rustc_index = { path = "../librustc_index" }
1818
rustc_macros = { path = "../librustc_macros" }
1919
rustc_serialize = { path = "../libserialize", package = "serialize" }
20-
rustc_session = { path = "../librustc_session" }
2120
rustc_span = { path = "../librustc_span" }
2221
parking_lot = "0.9"
2322
smallvec = { version = "1.0", features = ["union", "may_dangle"] }

src/librustc_query_system/query/config.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use rustc_data_structures::stable_hasher::HashStable;
1515
use rustc_data_structures::sync::Lock;
1616
use rustc_data_structures::thin_vec::ThinVec;
1717
use rustc_errors::Diagnostic;
18-
use rustc_session::Session;
1918
use std::borrow::Cow;
2019
use std::fmt::Debug;
2120
use std::hash::Hash;
@@ -33,8 +32,8 @@ pub trait QueryConfig<CTX> {
3332
pub trait QueryContext: DepContext {
3433
type Query: Clone + HashStable<Self::StableHashingContext>;
3534

36-
/// Access the session.
37-
fn session(&self) -> &Session;
35+
fn incremental_verify_ich(&self) -> bool;
36+
fn verbose(&self) -> bool;
3837

3938
/// Get string representation from DefPath.
4039
fn def_path_str(&self, def_id: DefId) -> String;
@@ -101,7 +100,7 @@ where
101100
M: QueryAccessors<CTX, Key = DefId>,
102101
{
103102
default fn describe(tcx: CTX, def_id: DefId) -> Cow<'static, str> {
104-
if !tcx.session().verbose() {
103+
if !tcx.verbose() {
105104
format!("processing `{}`", tcx.def_path_str(def_id)).into()
106105
} else {
107106
let name = ::std::any::type_name::<M>();

src/librustc_query_system/query/plumbing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ where
514514

515515
// If `-Zincremental-verify-ich` is specified, re-hash results from
516516
// the cache and make sure that they have the expected fingerprint.
517-
if unlikely!(tcx.session().opts.debugging_opts.incremental_verify_ich) {
517+
if unlikely!(tcx.incremental_verify_ich()) {
518518
incremental_verify_ich::<Q, _>(tcx, &result, dep_node, dep_node_index);
519519
}
520520

0 commit comments

Comments
 (0)