diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2015-09-21 13:12:01 +0530 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2015-09-23 14:44:59 +0200 |
commit | 3c969b346a02928abeea2796a0ec92a072f70b6e (patch) | |
tree | fbf7b015edf85032dd2327dde6867da2c568b594 /components/plugins/lints/privatize.rs | |
parent | 8f1469eb08a437bcc6cfb510334be2b6430b4a8f (diff) | |
download | servo-3c969b346a02928abeea2796a0ec92a072f70b6e.tar.gz servo-3c969b346a02928abeea2796a0ec92a072f70b6e.zip |
Upgrade rust to f93ab64d4a1a7ee91759a1594ab2a426b6cc657e/rustc-1.5.0-dev.
Diffstat (limited to 'components/plugins/lints/privatize.rs')
-rw-r--r-- | components/plugins/lints/privatize.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/components/plugins/lints/privatize.rs b/components/plugins/lints/privatize.rs index a4a684b68ab..07e5b903553 100644 --- a/components/plugins/lints/privatize.rs +++ b/components/plugins/lints/privatize.rs @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use rustc::lint::{Context, LintPass, LintArray}; +use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; use rustc::middle::def_id::DefId; +use rustc_front::hir; use syntax::ast; -use syntax::ast::Public; use syntax::attr::AttrMetaMethods; declare_lint!(PRIVATIZE, Deny, @@ -21,17 +21,19 @@ impl LintPass for PrivatizePass { fn get_lints(&self) -> LintArray { lint_array!(PRIVATIZE) } +} +impl LateLintPass for PrivatizePass { fn check_struct_def(&mut self, - cx: &Context, - def: &ast::StructDef, + cx: &LateContext, + def: &hir::StructDef, _i: ast::Ident, - _gen: &ast::Generics, + _gen: &hir::Generics, id: ast::NodeId) { if cx.tcx.has_attr(DefId::local(id), "privatize") { for field in &def.fields { match field.node { - ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => { + hir::StructField_ { kind: hir::NamedField(ident, visibility), .. } if visibility == hir::Public => { cx.span_lint(PRIVATIZE, field.span, &format!("Field {} is public where only private fields are allowed", ident.name)); |