1
Fork 0

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`.
This commit is contained in:
bors 2023-08-13 10:59:36 +00:00
commit 5f3abbc52f
30 changed files with 130 additions and 93 deletions

View file

@ -115,7 +115,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
let attrs = self.tcx.hir().attrs(self.tcx.hir().local_def_id_to_hir_id(def_id));
debug!("annotate(id = {:?}, attrs = {:?})", def_id, attrs);
let depr = attr::find_deprecation(&self.tcx.sess, attrs);
let depr = attr::find_deprecation(self.tcx.sess, self.tcx.features(), attrs);
let mut is_deprecated = false;
if let Some((depr, span)) = &depr {
is_deprecated = true;