Skip to content

Commit

Permalink
Rollup merge of rust-lang#68045 - Centril:liberate-lints, r=Mark-Simu…
Browse files Browse the repository at this point in the history
…lacrum

Move more of `rustc::lint` into `rustc_lint`

Based on rust-lang#67806.

Here we try to consolidate more of the linting infra into `rustc::lint`. Some high-level notes:

- We now store an `Lrc<dyn Any + Send + Sync>` as opposed to `Lrc<LintStore>` in the `GlobalCtxt`. This enables us to avoid referring to the type, breaking a cyclic dependency, and so we can move things from `rustc::lint` to `rustc_lint`.

- `in_derive_expansion` is, and needs to, be moved as a method on `Span`.

- We reduce the number of ways on `tcx` to emit a lint so that the developer UX is more streamlined.

- `LintLevelsBuilder` is moved to `rustc_lint::levels`, leaving behind `LintLevelMap/Set` in a purified form due to current constraints (hopefully fixable in the future after rust-lang#68133).

- `struct_lint_level` is moved to `rustc::lint` due to current dependency constraints.

- `rustc::context` is moved to `rustc_lint::context`.

- The visitors in `rustc::lint` are moved to `rustc_lint::passes`.
  • Loading branch information
Centril authored Jan 11, 2020
2 parents 2211f22 + 51078ce commit 7f81ad9
Show file tree
Hide file tree
Showing 48 changed files with 974 additions and 1,017 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3654,6 +3654,7 @@ dependencies = [
"log",
"rustc",
"rustc_data_structures",
"rustc_error_codes",
"rustc_errors",
"rustc_feature",
"rustc_hir",
Expand Down Expand Up @@ -3779,6 +3780,7 @@ dependencies = [
"rustc_error_codes",
"rustc_errors",
"rustc_hir",
"rustc_lint",
"rustc_metadata",
"rustc_span",
"syntax",
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//! item.

use crate::hir::map::Map;
use crate::lint::builtin::UNUSED_ATTRIBUTES;
use crate::ty::query::Providers;
use crate::ty::TyCtxt;

Expand All @@ -16,6 +15,7 @@ use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::DUMMY_HIR_ID;
use rustc_hir::{self, HirId, Item, ItemKind, TraitItem, TraitItemKind};
use rustc_session::lint::builtin::UNUSED_ATTRIBUTES;
use rustc_span::symbol::sym;
use rustc_span::Span;
use syntax::ast::Attribute;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ extern crate rustc_data_structures;
#[macro_use]
extern crate log;
#[macro_use]
extern crate syntax;
#[macro_use]
extern crate smallvec;

#[cfg(test)]
Expand Down
Loading

0 comments on commit 7f81ad9

Please sign in to comment.