about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-13 10:59:36 +0000
committerbors <bors@rust-lang.org>2023-08-13 10:59:36 +0000
commit5f3abbc52fc460c05f24648cce3969a41c0b02e9 (patch)
treee2c08145b8738dddd8a2fa26dceb86eb30112953 /src
parent1702d0fffc490e304cf93558c621f913ca062e62 (diff)
parent7353c96be899f02f52455f61bfaf49b80022a182 (diff)
downloadrust-5f3abbc52fc460c05f24648cce3969a41c0b02e9.tar.gz
rust-5f3abbc52fc460c05f24648cce3969a41c0b02e9.zip
Auto merge of #114723 - petrochenkov:noplugin2, r=davidtwco
rustc: Move `features` from `Session` to `GlobalCtxt`

Removes one more piece of mutable state.
Follow up to #114622.

The rule I used for passing feature in function signatures:
- if a crate already depends on `rustc_middle`, then `Session` is replaced with `TyCtxt`
- otherwise session and features are passed as a pair `sess: &Session, features: &Features`

The code in `rustc_lint` is ultimately used for implementing a trait from `rustc_expand`, so it also doesn't use tcx despite the dependency on `rustc_middle`.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/clean/inline.rs4
-rw-r--r--src/librustdoc/html/format.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index 384010034e6..389bac0f09d 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -200,7 +200,7 @@ pub(crate) fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemT
     let fqn = if let ItemType::Macro = kind {
         // Check to see if it is a macro 2.0 or built-in macro
         if matches!(
-            CStore::from_tcx(cx.tcx).load_macro_untracked(did, cx.sess()),
+            CStore::from_tcx(cx.tcx).load_macro_untracked(did, cx.tcx),
             LoadedMacro::MacroDef(def, _)
                 if matches!(&def.kind, ast::ItemKind::MacroDef(ast_def)
                     if !ast_def.macro_rules)
@@ -680,7 +680,7 @@ fn build_macro(
     import_def_id: Option<DefId>,
     macro_kind: MacroKind,
 ) -> clean::ItemKind {
-    match CStore::from_tcx(cx.tcx).load_macro_untracked(def_id, cx.sess()) {
+    match CStore::from_tcx(cx.tcx).load_macro_untracked(def_id, cx.tcx) {
         LoadedMacro::MacroDef(item_def, _) => match macro_kind {
             MacroKind::Bang => {
                 if let ast::ItemKind::MacroDef(ref def) = item_def.kind {
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index eb5d3c88570..58022046294 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -604,7 +604,7 @@ fn generate_macro_def_id_path(
     }
     // Check to see if it is a macro 2.0 or built-in macro.
     // More information in <https://rust-lang.github.io/rfcs/1584-macros.html>.
-    let is_macro_2 = match cstore.load_macro_untracked(def_id, tcx.sess) {
+    let is_macro_2 = match cstore.load_macro_untracked(def_id, tcx) {
         LoadedMacro::MacroDef(def, _) => {
             // If `ast_def.macro_rules` is `true`, then it's not a macro 2.0.
             matches!(&def.kind, ast::ItemKind::MacroDef(ast_def) if !ast_def.macro_rules)