mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Upgrade rust to f93ab64d4a1a7ee91759a1594ab2a426b6cc657e/rustc-1.5.0-dev.
This commit is contained in:
parent
8f1469eb08
commit
3c969b346a
40 changed files with 253 additions and 253 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue