mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Bump to Rust 2016-02-22
This commit is contained in:
parent
ef95eb3bbe
commit
dab9b4700c
12 changed files with 465 additions and 413 deletions
|
@ -2,8 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::ast::{MetaItem, Expr};
|
||||
use syntax::ast::{Expr, MetaItem, Mutability};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::ext::base::{Annotatable, ExtCtxt};
|
||||
use syntax::ext::build::AstBuilder;
|
||||
|
@ -50,7 +49,7 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item:
|
|||
generics: ty::LifetimeBounds::empty(),
|
||||
explicit_self: ty::borrowed_explicit_self(),
|
||||
args: vec!(ty::Ptr(box ty::Literal(ty::Path::new(vec!("js", "jsapi", "JSTracer"))),
|
||||
ty::Raw(ast::MutMutable))),
|
||||
ty::Raw(Mutability::Mutable))),
|
||||
ret_ty: ty::nil_ty(),
|
||||
attributes: vec![quote_attr!(cx, #[inline])],
|
||||
is_unsafe: false,
|
||||
|
|
|
@ -206,7 +206,7 @@ impl<'a, 'b: 'a, 'tcx: 'a+'b> visit::Visitor<'a> for FnDefVisitor<'a, 'b, 'tcx>
|
|||
fn visit_pat(&mut self, pat: &'a hir::Pat) {
|
||||
let cx = self.cx;
|
||||
|
||||
if let hir::PatIdent(hir::BindByValue(_), _, _) = pat.node {
|
||||
if let hir::PatKind::Ident(hir::BindingMode::BindByValue(_), _, _) = pat.node {
|
||||
if pat_is_binding(&cx.tcx.def_map.borrow(), pat) {
|
||||
let ty = cx.tcx.pat_ty(pat);
|
||||
if is_unrooted_ty(cx, ty, self.in_new_function) {
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::ast::MetaItem;
|
||||
use syntax::ast::{ItemKind, MetaItem};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::ext::base::{Annotatable, ExtCtxt};
|
||||
use utils::match_ty_unwrap;
|
||||
|
@ -12,7 +11,7 @@ use utils::match_ty_unwrap;
|
|||
pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable: &Annotatable,
|
||||
push: &mut FnMut(Annotatable)) {
|
||||
if let &Annotatable::Item(ref item) = annotatable {
|
||||
if let ast::ItemStruct(ref def, _) = item.node {
|
||||
if let ItemKind::Struct(ref def, _) = item.node {
|
||||
let struct_name = item.ident;
|
||||
// This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time
|
||||
match def.fields().iter().find(
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use std::error::Error;
|
||||
use syntax;
|
||||
use syntax::ast::{TokenTree, ExprLit, LitStr, Expr};
|
||||
use syntax::ast::{Expr, ExprKind, LitKind, TokenTree};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::ext::base::{ExtCtxt, MacResult, MacEager, DummyResult};
|
||||
use syntax::ext::build::AstBuilder;
|
||||
|
@ -53,8 +53,8 @@ pub fn expand_url(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
|
|||
}
|
||||
|
||||
fn parse_str_lit(e: &Expr) -> Option<InternedString> {
|
||||
if let ExprLit(ref lit) = e.node {
|
||||
if let LitStr(ref s, _) = lit.node {
|
||||
if let ExprKind::Lit(ref lit) = e.node {
|
||||
if let LitKind::Str(ref s, _) = lit.node {
|
||||
return Some(s.clone());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use syntax::ptr::P;
|
|||
/// Try not to use this for types defined in crates you own, use match_lang_ty instead (for lint passes)
|
||||
pub fn match_ty_unwrap<'a>(ty: &'a ast::Ty, segments: &[&str]) -> Option<&'a [P<ast::Ty>]> {
|
||||
match ty.node {
|
||||
ast::TyPath(_, ast::Path { segments: ref seg, .. }) => {
|
||||
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
|
||||
|
@ -60,9 +60,9 @@ pub fn match_lang_ty(cx: &LateContext, ty: &hir::Ty, value: &str) -> bool {
|
|||
pub fn match_lang_did(cx: &LateContext, did: DefId, value: &str) -> bool {
|
||||
cx.tcx.get_attrs(did).iter().any(|attr| {
|
||||
match attr.node.value.node {
|
||||
ast::MetaNameValue(ref name, ref val) if &**name == "servo_lang" => {
|
||||
ast::MetaItemKind::NameValue(ref name, ref val) if &**name == "servo_lang" => {
|
||||
match val.node {
|
||||
ast::LitStr(ref v, _) if &**v == value => {
|
||||
ast::LitKind::Str(ref v, _) if &**v == value => {
|
||||
mark_used(attr);
|
||||
true
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue