servo: Merge #14689 - Update to rustc 1.16.0-nightly (4ecc85beb 2016-12-28) (from servo:rustup); r=Manishearth
authorSimon Sapin <simon.sapin@exyr.org>
Mon, 02 Jan 2017 03:03:40 -0800
changeset 340461 17e25ccaa7dfe2f7c7d88878a1fb5ce5f1888914
parent 340460 a2d79d75b62916f22396f2129efe9306480342db
child 340462 56fb1073e3041215f561a41ec2a84170001267c1
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersManishearth
servo: Merge #14689 - Update to rustc 1.16.0-nightly (4ecc85beb 2016-12-28) (from servo:rustup); r=Manishearth <s>**This is not ready to land** since there is no corresponding Nightly build of Rust yet.</s> Update: we got a Nightly build on 2016-12-29: http://rusty-dash.com/nightlies I made these changes to check that https://github.com/rust-lang/rust/pull/38566 fixes https://github.com/rust-lang/rust/issues/38535 (which it does, yay!) so I might as well publish them, we’ll need them soon enough. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 9bdd0f401a89398fb2ecd4f6b54691a7c93b2e53
servo/components/plugins/lints/unrooted_must_root.rs
servo/components/plugins/utils.rs
servo/rust-nightly-date
--- a/servo/components/plugins/lints/unrooted_must_root.rs
+++ b/servo/components/plugins/lints/unrooted_must_root.rs
@@ -118,49 +118,49 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> fo
             }
         }
     }
     /// Function arguments that are #[must_root] types are not allowed
     fn check_fn(&mut self,
                 cx: &LateContext<'a, 'tcx>,
                 kind: visit::FnKind,
                 decl: &'tcx hir::FnDecl,
-                body: &'tcx hir::Expr,
+                body: &'tcx hir::Body,
                 span: codemap::Span,
                 id: ast::NodeId) {
         let in_new_function = match kind {
             visit::FnKind::ItemFn(n, _, _, _, _, _, _) |
             visit::FnKind::Method(n, _, _, _) => {
                 &*n.as_str() == "new" || n.as_str().starts_with("new_")
             }
             visit::FnKind::Closure(_) => return,
         };
 
         if !in_derive_expn(cx, span) {
             let def_id = cx.tcx.map.local_def_id(id);
             let ty = cx.tcx.item_type(def_id);
 
             for (arg, ty) in decl.inputs.iter().zip(ty.fn_args().0.iter()) {
                 if is_unrooted_ty(cx, ty, false) {
-                    cx.span_lint(UNROOTED_MUST_ROOT, arg.ty.span, "Type must be rooted")
+                    cx.span_lint(UNROOTED_MUST_ROOT, arg.span, "Type must be rooted")
                 }
             }
 
             if !in_new_function {
                 if is_unrooted_ty(cx, ty.fn_ret().0, false) {
                     cx.span_lint(UNROOTED_MUST_ROOT, decl.output.span(), "Type must be rooted")
                 }
             }
         }
 
         let mut visitor = FnDefVisitor {
             cx: cx,
             in_new_function: in_new_function,
         };
-        visit::walk_expr(&mut visitor, body);
+        visit::walk_expr(&mut visitor, &body.value);
     }
 }
 
 struct FnDefVisitor<'a, 'b: 'a, 'tcx: 'a+'b> {
     cx: &'a LateContext<'b, 'tcx>,
     in_new_function: bool,
 }
 
@@ -210,17 +210,17 @@ impl<'a, 'b, 'tcx> visit::Visitor<'tcx> 
                             &format!("Expression of type {:?} must be rooted", ty))
             }
         }
 
         visit::walk_pat(self, pat);
     }
 
     fn visit_fn(&mut self, kind: visit::FnKind<'tcx>, decl: &'tcx hir::FnDecl,
-                body: hir::ExprId, span: codemap::Span, id: ast::NodeId) {
+                body: hir::BodyId, span: codemap::Span, id: ast::NodeId) {
         if let visit::FnKind::Closure(_) = kind {
             visit::walk_fn(self, kind, decl, body, span, id);
         }
     }
 
     fn visit_foreign_item(&mut self, _: &'tcx hir::ForeignItem) {}
     fn visit_ty(&mut self, _: &'tcx hir::Ty) { }
     fn nested_visit_map<'this>(&'this mut self) -> hir::intravisit::NestedVisitorMap<'this, 'tcx> {
--- a/servo/components/plugins/utils.rs
+++ b/servo/components/plugins/utils.rs
@@ -18,20 +18,26 @@ pub fn match_ty_unwrap<'a>(ty: &'a ast::
     match ty.node {
         ast::TyKind::Path(_, ast::Path { segments: ref seg, .. }) => {
             // So hir::Path isn't the full path, just the tokens that were provided.
             // I could muck around with the maps and find the full path
             // however the more efficient way is to simply reverse the iterators and zip them
             // which will compare them in reverse until one of them runs out of segments
             if seg.iter().rev().zip(segments.iter().rev()).all(|(a, b)| &*a.identifier.name.as_str() == *b) {
                 match seg.last() {
-                    Some(&ast::PathSegment { parameters: ast::PathParameters::AngleBracketed(ref a), .. }) => {
-                        Some(&a.types)
+                    Some(&ast::PathSegment { parameters: Some(ref params), .. }) => {
+                        match **params {
+                            ast::PathParameters::AngleBracketed(ref a) => Some(&a.types),
+
+                            // `Foo(A,B) -> C`
+                            ast::PathParameters::Parenthesized(_) => None,
+                        }
                     }
-                    _ => None
+                    Some(&ast::PathSegment { parameters: None, .. }) => Some(&[]),
+                    None => None,
                 }
             } else {
                 None
             }
         },
         _ => None
     }
 }
--- a/servo/rust-nightly-date
+++ b/servo/rust-nightly-date
@@ -1,1 +1,1 @@
-2016-12-19
+2016-12-29