mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Upgrade to rustc 1.4.0-dev (cb9323ec0 2015-09-01)
This commit is contained in:
parent
ba2cb77c26
commit
40b4348824
28 changed files with 349 additions and 338 deletions
|
@ -24,6 +24,7 @@ use syntax::ptr::P;
|
|||
pub fn expand_heap_size(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem,
|
||||
item: &Annotatable, push: &mut FnMut(Annotatable)) {
|
||||
let trait_def = TraitDef {
|
||||
is_unsafe: false,
|
||||
span: span,
|
||||
attributes: Vec::new(),
|
||||
path: ty::Path::new(vec!("util", "mem", "HeapSizeOf")),
|
||||
|
|
|
@ -38,6 +38,7 @@ pub fn expand_dom_struct(cx: &mut ExtCtxt, sp: Span, _: &MetaItem, anno: Annotat
|
|||
pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Annotatable,
|
||||
push: &mut FnMut(Annotatable)) {
|
||||
let trait_def = TraitDef {
|
||||
is_unsafe: false,
|
||||
span: span,
|
||||
attributes: Vec::new(),
|
||||
path: ty::Path::new(vec!("dom","bindings","trace","JSTraceable")),
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
use rustc::lint::{Context, LintPass, LintArray, Level};
|
||||
use rustc::middle::def;
|
||||
use syntax::{ast, ast_util};
|
||||
use rustc::middle::def_id::DefId;
|
||||
use syntax::ast;
|
||||
|
||||
use utils::match_lang_ty;
|
||||
|
||||
|
@ -26,7 +27,7 @@ impl LintPass for InheritancePass {
|
|||
_gen: &ast::Generics, id: ast::NodeId) {
|
||||
// Lints are run post expansion, so it's fine to use
|
||||
// #[_dom_struct_marker] here without also checking for #[dom_struct]
|
||||
if cx.tcx.has_attr(ast_util::local_def(id), "_dom_struct_marker") {
|
||||
if cx.tcx.has_attr(DefId::local(id), "_dom_struct_marker") {
|
||||
// Find the reflector, if any
|
||||
let reflector_span = def.fields.iter().enumerate()
|
||||
.find(|&(ctr, f)| {
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use rustc::lint::{Context, LintPass, LintArray};
|
||||
use rustc::middle::def_id::DefId;
|
||||
use syntax::ast;
|
||||
use syntax::ast::Public;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
use syntax::{ast, ast_util};
|
||||
|
||||
declare_lint!(PRIVATIZE, Deny,
|
||||
"Allows to enforce private fields for struct definitions");
|
||||
|
@ -27,7 +28,7 @@ impl LintPass for PrivatizePass {
|
|||
_i: ast::Ident,
|
||||
_gen: &ast::Generics,
|
||||
id: ast::NodeId) {
|
||||
if cx.tcx.has_attr(ast_util::local_def(id), "privatize") {
|
||||
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 => {
|
||||
|
|
|
@ -120,14 +120,14 @@ impl LintPass for UnrootedPass {
|
|||
fn check_fn(&mut self, cx: &Context, kind: visit::FnKind, decl: &ast::FnDecl,
|
||||
block: &ast::Block, _span: codemap::Span, id: ast::NodeId) {
|
||||
match kind {
|
||||
visit::FkItemFn(i, _, _, _, _, _) |
|
||||
visit::FkMethod(i, _, _) if i.name.as_str() == "new"
|
||||
|| i.name.as_str() == "new_inherited"
|
||||
|| i.name.as_str() == "new_initialized" => {
|
||||
visit::FnKind::ItemFn(i, _, _, _, _, _) |
|
||||
visit::FnKind::Method(i, _, _) if i.name.as_str() == "new"
|
||||
|| i.name.as_str() == "new_inherited"
|
||||
|| i.name.as_str() == "new_initialized" => {
|
||||
self.in_new_function = true;
|
||||
return;
|
||||
},
|
||||
visit::FkItemFn(_, _, style, _, _, _) => match style {
|
||||
visit::FnKind::ItemFn(_, _, style, _, _, _) => match style {
|
||||
ast::Unsafety::Unsafe => return,
|
||||
_ => ()
|
||||
},
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use rustc::ast_map;
|
||||
use rustc::lint::Context;
|
||||
use rustc::middle::def;
|
||||
use rustc::middle::def_id::DefId;
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::ast::{TyPath, Path, AngleBracketedParameters, PathSegment, Ty};
|
||||
|
@ -52,7 +53,7 @@ pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool {
|
|||
match_lang_did(cx, def_id, value)
|
||||
}
|
||||
|
||||
pub fn match_lang_did(cx: &Context, did: ast::DefId, value: &str) -> bool {
|
||||
pub fn match_lang_did(cx: &Context, did: DefId, value: &str) -> bool {
|
||||
cx.tcx.get_attrs(did).iter().any(|attr| {
|
||||
match attr.node.value.node {
|
||||
ast::MetaNameValue(ref name, ref val) if &**name == "servo_lang" => {
|
||||
|
@ -96,7 +97,7 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool {
|
|||
/// check if a DefId's path matches the given absolute type path
|
||||
/// usage e.g. with
|
||||
/// `match_def_path(cx, id, &["core", "option", "Option"])`
|
||||
pub fn match_def_path(cx: &Context, def_id: ast::DefId, path: &[&str]) -> bool {
|
||||
pub fn match_def_path(cx: &Context, def_id: DefId, path: &[&str]) -> bool {
|
||||
cx.tcx.with_path(def_id, |iter| iter.map(|elem| elem.name())
|
||||
.zip(path.iter()).all(|(nm, p)| &nm.as_str() == p))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue