Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
60 lines
1.4 KiB
Rust
60 lines
1.4 KiB
Rust
//! Various checks
|
|
//!
|
|
//! # Note
|
|
//!
|
|
//! This API is completely unstable and subject to change.
|
|
|
|
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
|
#![feature(crate_visibility_modifier)]
|
|
#![feature(in_band_lifetimes)]
|
|
#![feature(format_args_capture)]
|
|
#![feature(iter_zip)]
|
|
#![feature(nll)]
|
|
#![feature(min_specialization)]
|
|
#![feature(try_blocks)]
|
|
#![recursion_limit = "256"]
|
|
|
|
#[macro_use]
|
|
extern crate rustc_middle;
|
|
#[macro_use]
|
|
extern crate tracing;
|
|
|
|
use rustc_middle::ty::query::Providers;
|
|
|
|
mod check_attr;
|
|
mod check_const;
|
|
pub mod dead;
|
|
mod diagnostic_items;
|
|
pub mod entry;
|
|
pub mod hir_id_validator;
|
|
pub mod hir_stats;
|
|
mod intrinsicck;
|
|
mod lang_items;
|
|
pub mod layout_test;
|
|
mod lib_features;
|
|
mod liveness;
|
|
pub mod loops;
|
|
mod naked_functions;
|
|
mod reachable;
|
|
mod region;
|
|
pub mod stability;
|
|
mod upvars;
|
|
mod weak_lang_items;
|
|
|
|
pub fn provide(providers: &mut Providers) {
|
|
check_attr::provide(providers);
|
|
check_const::provide(providers);
|
|
diagnostic_items::provide(providers);
|
|
entry::provide(providers);
|
|
lang_items::provide(providers);
|
|
lib_features::provide(providers);
|
|
loops::provide(providers);
|
|
naked_functions::provide(providers);
|
|
liveness::provide(providers);
|
|
intrinsicck::provide(providers);
|
|
reachable::provide(providers);
|
|
region::provide(providers);
|
|
stability::provide(providers);
|
|
upvars::provide(providers);
|
|
}
|