Eliminate the SessionGlobals from librustc_ast.

By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.

All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.

`contains_feature_attr()` was dead, and is removed.

Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`
This commit is contained in:
Nicholas Nethercote
2020-07-30 11:27:50 +10:00
parent d6fa011f62
commit e539dd65f8
120 changed files with 816 additions and 805 deletions

View File

@@ -4,7 +4,6 @@ use crate::core::DocContext;
use crate::fold::{self, DocFolder};
use crate::passes::Pass;
use rustc_ast::attr;
use rustc_span::symbol::sym;
use rustc_span::FileName;
use serde::Serialize;
@@ -155,7 +154,10 @@ impl fold::DocFolder for CoverageCalculator {
return Some(i);
}
clean::ImplItem(ref impl_)
if attr::contains_name(&i.attrs.other_attrs, sym::automatically_derived)
if i.attrs
.other_attrs
.iter()
.any(|item| item.has_name(sym::automatically_derived))
|| impl_.synthetic
|| impl_.blanket_impl.is_some() =>
{