Rustup to *rustc 1.14.0-nightly (3210fd5c2 2016-10-05)*

This commit is contained in:
mcarton
2016-10-06 17:46:50 +02:00
parent e851bc7404
commit 0475eae1fa
3 changed files with 10 additions and 6 deletions

View File

@@ -60,7 +60,7 @@ impl EnumGlobUse {
} else { } else {
let child = cx.sess().cstore.item_children(def.full_def().def_id()); let child = cx.sess().cstore.item_children(def.full_def().def_id());
if let Some(child) = child.first() { if let Some(child) = child.first() {
if let Some(Def::Variant(..)) = cx.tcx.sess.cstore.describe_def(child.def_id) { if let Def::Variant(..) = child.def {
span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants"); span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
} }
} }

View File

@@ -71,7 +71,9 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool {
let def = cx.tcx.def_map.borrow().get(&callee.id).map(|d| d.full_def()); let def = cx.tcx.def_map.borrow().get(&callee.id).map(|d| d.full_def());
match def { match def {
Some(Def::Struct(..)) | Some(Def::Struct(..)) |
Some(Def::Variant(..)) => args.iter().all(|arg| has_no_effect(cx, arg)), Some(Def::Variant(..)) |
Some(Def::StructCtor(..)) |
Some(Def::VariantCtor(..)) => args.iter().all(|arg| has_no_effect(cx, arg)),
_ => false, _ => false,
} }
} }
@@ -146,7 +148,9 @@ fn reduce_expression<'a>(cx: &LateContext, expr: &'a Expr) -> Option<Vec<&'a Exp
Expr_::ExprCall(ref callee, ref args) => { Expr_::ExprCall(ref callee, ref args) => {
match cx.tcx.def_map.borrow().get(&callee.id).map(PathResolution::full_def) { match cx.tcx.def_map.borrow().get(&callee.id).map(PathResolution::full_def) {
Some(Def::Struct(..)) | Some(Def::Struct(..)) |
Some(Def::Variant(..)) => Some(args.iter().map(Deref::deref).collect()), Some(Def::Variant(..)) |
Some(Def::StructCtor(..)) |
Some(Def::VariantCtor(..)) => Some(args.iter().map(Deref::deref).collect()),
_ => None, _ => None,
} }
} }

View File

@@ -234,10 +234,10 @@ pub fn path_to_def(cx: &LateContext, path: &[&str]) -> Option<def::Def> {
for item in &mem::replace(&mut items, vec![]) { for item in &mem::replace(&mut items, vec![]) {
if item.name.as_str() == *segment { if item.name.as_str() == *segment {
if path_it.peek().is_none() { if path_it.peek().is_none() {
return cx.tcx.sess.cstore.describe_def(item.def_id); return Some(item.def);
} }
items = cstore.item_children(item.def_id); items = cstore.item_children(item.def.def_id());
break; break;
} }
} }
@@ -723,7 +723,7 @@ pub fn is_copy<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: ty::Ty<'tcx>, env: Node
/// Return whether a pattern is refutable. /// Return whether a pattern is refutable.
pub fn is_refutable(cx: &LateContext, pat: &Pat) -> bool { pub fn is_refutable(cx: &LateContext, pat: &Pat) -> bool {
fn is_enum_variant(cx: &LateContext, did: NodeId) -> bool { fn is_enum_variant(cx: &LateContext, did: NodeId) -> bool {
matches!(cx.tcx.def_map.borrow().get(&did).map(|d| d.full_def()), Some(def::Def::Variant(..))) matches!(cx.tcx.def_map.borrow().get(&did).map(|d| d.full_def()), Some(def::Def::Variant(..)) | Some(def::Def::VariantCtor(..)))
} }
fn are_refutable<'a, I: Iterator<Item=&'a Pat>>(cx: &LateContext, mut i: I) -> bool { fn are_refutable<'a, I: Iterator<Item=&'a Pat>>(cx: &LateContext, mut i: I) -> bool {