Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.

This commit is contained in:
Ms2ger 2015-01-02 12:45:28 +01:00 committed by Josh Matthews
parent cf616b90a2
commit 16c7060bc8
153 changed files with 2095 additions and 1298 deletions

View file

@ -5,7 +5,6 @@
use syntax::{ast, ast_util};
use rustc::lint::{Context, LintPass, LintArray, Level};
use rustc::middle::{ty, def};
use rustc::middle::typeck::astconv::AstConv;
use utils::match_lang_ty;
@ -42,7 +41,7 @@ impl LintPass for InheritancePass {
.map(|(_, f)| f.span);
// Find all #[dom_struct] fields
let dom_spans: Vec<_> = def.fields.iter().enumerate().filter_map(|(ctr, f)| {
if let ast::TyPath(_, _, ty_id) = f.node.ty.node {
if let ast::TyPath(_, ty_id) = f.node.ty.node {
if let Some(def::DefTy(def_id, _)) = cx.tcx.def_map.borrow().get(&ty_id).cloned() {
if ty::has_attr(cx.tcx, def_id, "_dom_struct_marker") {
// If the field is not the first, it's probably

View file

@ -7,7 +7,6 @@ use syntax::ast::Public;
use syntax::attr::AttrMetaMethods;
use rustc::lint::{Context, LintPass, LintArray};
use rustc::middle::ty;
use rustc::middle::typeck::astconv::AstConv;
declare_lint!(PRIVATIZE, Deny,
"Allows to enforce private fields for struct definitions")

View file

@ -6,7 +6,6 @@ use syntax::ast;
use rustc::lint::{Context, LintPass, LintArray};
use rustc::middle::ty::expr_ty;
use rustc::middle::ty;
use rustc::middle::typeck::astconv::AstConv;
declare_lint!(STR_TO_STRING, Deny,
"Warn when a String could use into_string() instead of to_string()")
@ -33,13 +32,13 @@ impl LintPass for StrToStringPass {
}
fn is_str(cx: &Context, expr: &ast::Expr) -> bool {
fn walk_ty<'t>(ty: ty::t) -> ty::t {
match ty::get(ty).sty {
fn walk_ty<'t>(ty: ty::Ty<'t>) -> ty::Ty<'t> {
match ty.sty {
ty::ty_ptr(ref tm) | ty::ty_rptr(_, ref tm) => walk_ty(tm.ty),
_ => ty
}
}
match ty::get(walk_ty(expr_ty(cx.tcx, expr))).sty {
match walk_ty(expr_ty(cx.tcx, expr)).sty {
ty::ty_str => true,
_ => false
}

View file

@ -6,7 +6,6 @@ use syntax::ast;
use syntax::attr::AttrMetaMethods;
use rustc::lint::{Context, LintPass, LintArray};
use rustc::middle::ty::expr_ty;
use rustc::middle::typeck::astconv::AstConv;
use rustc::util::ppaux::Repr;
declare_lint!(TRANSMUTE_TYPE_LINT, Allow,
@ -31,7 +30,7 @@ impl LintPass for TransmutePass {
if path.segments.last()
.map_or(false, |ref segment| segment.identifier.name.as_str() == "transmute")
&& args.len() == 1 {
let tcx = cx.tcx();
let tcx = cx.tcx;
cx.span_lint(TRANSMUTE_TYPE_LINT, ex.span,
format!("Transmute to {} from {} detected",
expr_ty(tcx, ex).repr(tcx),

View file

@ -7,7 +7,6 @@ use syntax::attr::AttrMetaMethods;
use rustc::lint::{Context, LintPass, LintArray};
use rustc::middle::ty::expr_ty;
use rustc::middle::{ty, def};
use rustc::middle::typeck::astconv::AstConv;
use rustc::util::ppaux::Repr;
use utils::unsafe_context;
@ -24,6 +23,7 @@ declare_lint!(UNROOTED_MUST_ROOT, Deny,
/// - Not being bound locally in a `let` statement, assignment, `for` loop, or `match` statement.
///
/// This helps catch most situations where pointers like `JS<T>` are used in a way that they can be invalidated by a GC pass.
#[allow(missing_copy_implementations)]
pub struct UnrootedPass;
// Checks if a type has the #[must_root] annotation.
@ -33,7 +33,7 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
match ty.node {
ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) |
ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning),
ast::TyPath(_, _, id) => {
ast::TyPath(_, id) => {
match cx.tcx.def_map.borrow()[id].clone() {
def::DefTy(def_id, _) => {
if ty::has_attr(cx.tcx, def_id, "must_root") {
@ -146,7 +146,7 @@ impl LintPass for UnrootedPass {
};
let t = expr_ty(cx.tcx, &*expr);
match ty::get(t).sty {
match t.sty {
ty::ty_struct(did, _) |
ty::ty_enum(did, _) => {
if ty::has_attr(cx.tcx, did, "must_root") {