Rustup to nightly from 2017-01-31

This commit is contained in:
Mrmaxmeier 2017-02-03 11:52:13 +01:00
parent 2be75ef973
commit d68f0797bf
6 changed files with 28 additions and 30 deletions

View File

@ -181,7 +181,7 @@ fn is_relevant_trait(tcx: ty::TyCtxt, item: &TraitItem) -> bool {
}
}
fn is_relevant_block(tcx: ty::TyCtxt, tables: &ty::Tables, block: &Block) -> bool {
fn is_relevant_block(tcx: ty::TyCtxt, tables: &ty::TypeckTables, block: &Block) -> bool {
for stmt in &block.stmts {
match stmt.node {
StmtDecl(_, _) => return true,
@ -194,7 +194,7 @@ fn is_relevant_block(tcx: ty::TyCtxt, tables: &ty::Tables, block: &Block) -> boo
block.expr.as_ref().map_or(false, |e| is_relevant_expr(tcx, tables, e))
}
fn is_relevant_expr(tcx: ty::TyCtxt, tables: &ty::Tables, expr: &Expr) -> bool {
fn is_relevant_expr(tcx: ty::TyCtxt, tables: &ty::TypeckTables, expr: &Expr) -> bool {
match expr.node {
ExprBlock(ref block) => is_relevant_block(tcx, tables, block),
ExprRet(Some(ref e)) => is_relevant_expr(tcx, tables, e),

View File

@ -40,16 +40,13 @@ pub struct Pass {
}
fn is_non_trait_box(ty: ty::Ty) -> bool {
match ty.sty {
ty::TyBox(inner) => !inner.is_trait(),
_ => false,
}
ty.is_box() && !ty.boxed_ty().is_trait()
}
struct EscapeDelegate<'a, 'tcx: 'a> {
set: NodeSet,
tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
tables: &'a ty::Tables<'tcx>,
tables: &'a ty::TypeckTables<'tcx>,
target: TargetDataLayout,
too_large_for_stack: u64,
}
@ -204,16 +201,16 @@ impl<'a, 'tcx: 'a> EscapeDelegate<'a, 'tcx> {
fn is_large_box(&self, ty: ty::Ty<'tcx>) -> bool {
// Large types need to be boxed to avoid stack
// overflows.
match ty.sty {
ty::TyBox(inner) => {
self.tcx.infer_ctxt((), Reveal::All).enter(|infcx| if let Ok(layout) = inner.layout(&infcx) {
let size = layout.size(&self.target);
size.bytes() > self.too_large_for_stack
} else {
false
})
},
_ => false,
if ty.is_box() {
let inner = ty.boxed_ty();
self.tcx.infer_ctxt((), Reveal::All).enter(|infcx| if let Ok(layout) = inner.layout(&infcx) {
let size = layout.size(&self.target);
size.bytes() > self.too_large_for_stack
} else {
false
})
} else {
false
}
}
}

View File

@ -230,6 +230,9 @@ fn record(&mut self, lifetime: &Option<Lifetime>) {
if let Some(ref lt) = *lifetime {
if &*lt.name.as_str() == "'static" {
self.lts.push(RefLt::Static);
} else if lt.is_elided() {
// TODO: investigate
self.lts.push(RefLt::Unnamed);
} else {
self.lts.push(RefLt::Named(lt.name));
}
@ -275,7 +278,7 @@ fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) {
fn visit_ty(&mut self, ty: &'tcx Ty) {
match ty.node {
TyRptr(None, _) => {
TyRptr(ref lt, _) if lt.is_elided() => {
self.record(&None);
},
TyPath(ref path) => {

View File

@ -951,8 +951,7 @@ fn may_slice(cx: &LateContext, ty: ty::Ty) -> bool {
ty::TySlice(_) => true,
ty::TyAdt(..) => match_type(cx, ty, &paths::VEC),
ty::TyArray(_, size) => size < 32,
ty::TyRef(_, ty::TypeAndMut { ty: inner, .. }) |
ty::TyBox(inner) => may_slice(cx, inner),
ty::TyRef(_, ty::TypeAndMut { ty: inner, .. }) => may_slice(cx, inner),
_ => false,
}
}
@ -966,8 +965,7 @@ fn may_slice(cx: &LateContext, ty: ty::Ty) -> bool {
} else {
match ty.sty {
ty::TySlice(_) => sugg::Sugg::hir_opt(cx, expr),
ty::TyRef(_, ty::TypeAndMut { ty: inner, .. }) |
ty::TyBox(inner) => {
ty::TyRef(_, ty::TypeAndMut { ty: inner, .. }) => {
if may_slice(cx, inner) {
sugg::Sugg::hir_opt(cx, expr)
} else {

View File

@ -702,13 +702,10 @@ fn visit_ty(&mut self, ty: &'tcx Ty) {
// function types bring a lot of overhead
TyBareFn(..) => (50 * self.nest, 1),
TyTraitObject(ref bounds) => {
let has_lifetimes = bounds.iter()
.any(|bound| match *bound {
TraitTyParamBound(ref poly_trait, ..) => !poly_trait.bound_lifetimes.is_empty(),
RegionTyParamBound(..) => true,
});
if has_lifetimes {
TyTraitObject(ref param_bounds, _) => {
let has_lifetime_parameters = param_bounds.iter()
.any(|bound| !bound.bound_lifetimes.is_empty());
if has_lifetime_parameters {
// complex trait bounds like A<'a, 'b>
(50 * self.nest, 1)
} else {

View File

@ -142,7 +142,10 @@ fn check_crate_post(&mut self, cx: &LateContext<'a, 'tcx>, _: &'tcx Crate) {
fn is_lint_ref_type(ty: &Ty) -> bool {
if let TyRptr(_, MutTy { ty: ref inner, mutbl: MutImmutable }) = ty.node {
if let TyRptr(ref lt, MutTy { ty: ref inner, mutbl: MutImmutable }) = ty.node {
if lt.is_elided() {
return false;
}
if let TyPath(ref path) = inner.node {
return match_path(path, &paths::LINT);
}