Upgrade to rustc 1.3.0-dev (f3b97a74a 2015-07-03)

This commit is contained in:
Simon Sapin 2015-07-03 15:14:08 +02:00 committed by Ms2ger
parent 02d84a1347
commit 75e3e787f6
15 changed files with 96 additions and 116 deletions

View file

@ -4,7 +4,7 @@
use syntax::{ast, ast_util};
use rustc::lint::{Context, LintPass, LintArray, Level};
use rustc::middle::{ty, def};
use rustc::middle::def;
use utils::match_lang_ty;
@ -26,7 +26,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 ty::has_attr(cx.tcx, ast_util::local_def(id), "_dom_struct_marker") {
if cx.tcx.has_attr(ast_util::local_def(id), "_dom_struct_marker") {
// Find the reflector, if any
let reflector_span = def.fields.iter().enumerate()
.find(|&(ctr, f)| {
@ -46,7 +46,7 @@ impl LintPass for InheritancePass {
if let ast::TyPath(..) = f.node.ty.node {
if let Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) =
cx.tcx.def_map.borrow().get(&f.node.ty.id) {
if ty::has_attr(cx.tcx, def_id, "_dom_struct_marker") {
if cx.tcx.has_attr(def_id, "_dom_struct_marker") {
// If the field is not the first, it's probably
// being misused (a)
if ctr > 0 {

View file

@ -6,7 +6,6 @@ use syntax::{ast, ast_util};
use syntax::ast::Public;
use syntax::attr::AttrMetaMethods;
use rustc::lint::{Context, LintPass, LintArray};
use rustc::middle::ty;
declare_lint!(PRIVATIZE, Deny,
"Allows to enforce private fields for struct definitions");
@ -28,7 +27,7 @@ impl LintPass for PrivatizePass {
_i: ast::Ident,
_gen: &ast::Generics,
id: ast::NodeId) {
if ty::has_attr(cx.tcx, ast_util::local_def(id), "privatize") {
if cx.tcx.has_attr(ast_util::local_def(id), "privatize") {
for field in def.fields.iter() {
match field.node {
ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => {

View file

@ -4,7 +4,6 @@
use syntax::ast;
use rustc::lint::{Context, LintPass, LintArray};
use rustc::middle::ty::expr_ty;
use rustc::middle::ty;
declare_lint!(STR_TO_STRING, Deny,
@ -38,7 +37,7 @@ impl LintPass for StrToStringPass {
_ => ty
}
}
match walk_ty(expr_ty(cx.tcx, expr)).sty {
match walk_ty(cx.tcx.expr_ty(expr)).sty {
ty::TyStr => true,
_ => false
}

View file

@ -5,7 +5,6 @@
use syntax::ast;
use syntax::attr::AttrMetaMethods;
use rustc::lint::{Context, LintPass, LintArray};
use rustc::middle::ty::expr_ty;
declare_lint!(TRANSMUTE_TYPE_LINT, Allow,
"Warn and report types being transmuted");
@ -32,8 +31,8 @@ impl LintPass for TransmutePass {
let tcx = cx.tcx;
cx.span_lint(TRANSMUTE_TYPE_LINT, ex.span,
&format!("Transmute to {:?} from {:?} detected",
expr_ty(tcx, ex),
expr_ty(tcx, &**args.get(0).unwrap())
tcx.expr_ty(ex),
tcx.expr_ty(&**args.get(0).unwrap())
));
}
}

View file

@ -6,7 +6,6 @@ use syntax::{ast, codemap, visit};
use syntax::attr::AttrMetaMethods;
use rustc::ast_map;
use rustc::lint::{Context, LintPass, LintArray};
use rustc::middle::ty::expr_ty;
use rustc::middle::{ty, def};
use utils::unsafe_context;
@ -38,7 +37,7 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
ast::TyPath(..) => {
match cx.tcx.def_map.borrow()[&ty.id] {
def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => {
if ty::has_attr(cx.tcx, def_id, "must_root") {
if cx.tcx.has_attr(def_id, "must_root") {
cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning);
}
}
@ -156,11 +155,11 @@ impl LintPass for UnrootedPass {
_ => return
};
let t = expr_ty(cx.tcx, &*expr);
let t = cx.tcx.expr_ty(&*expr);
match t.sty {
ty::TyStruct(did, _) |
ty::TyEnum(did, _) => {
if ty::has_attr(cx.tcx, did, "must_root") {
if cx.tcx.has_attr(did, "must_root") {
cx.span_lint(UNROOTED_MUST_ROOT, expr.span,
&format!("Expression of type {:?} must be rooted", t));
}