mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Rust upgrade to 2016-04-12
This commit is contained in:
parent
7faa3ed9cb
commit
e10c580768
13 changed files with 163 additions and 152 deletions
|
@ -15,7 +15,7 @@ rev = "9dca15de3e8ea266d3e7e868c0f358ed4fa5f195"
|
|||
optional = true
|
||||
|
||||
[dependencies]
|
||||
tenacious = "0.1.2"
|
||||
tenacious = "0.2.0"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
extern crate clippy;
|
||||
#[macro_use]
|
||||
extern crate rustc;
|
||||
extern crate rustc_front;
|
||||
extern crate rustc_plugin;
|
||||
#[macro_use]
|
||||
extern crate syntax;
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
* 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 rustc::hir::{self, def};
|
||||
use rustc::lint::{LateContext, LintPass, LintArray, Level, LateLintPass, LintContext};
|
||||
use rustc::middle::def;
|
||||
use rustc_front::hir;
|
||||
use syntax::ast;
|
||||
use utils::match_lang_ty;
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* 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 rustc::hir;
|
||||
use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
|
||||
use rustc_front::hir;
|
||||
use syntax::ast;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* 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 rustc::hir;
|
||||
use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
|
||||
use rustc_front::hir;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
|
||||
declare_lint!(TRANSMUTE_TYPE_LINT, Allow,
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
* 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 rustc::front::map as ast_map;
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit as visit;
|
||||
use rustc::hir::map as ast_map;
|
||||
use rustc::hir::pat_util::pat_is_binding;
|
||||
use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
|
||||
use rustc::middle::pat_util::pat_is_binding;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir;
|
||||
use rustc_front::intravisit as visit;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
use syntax::{ast, codemap};
|
||||
use utils::{match_def_path, in_derive_expn};
|
||||
|
|
|
@ -15,10 +15,10 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable:
|
|||
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(
|
||||
|f| match_ty_unwrap(&*f.node.ty, &["dom", "bindings", "reflector", "Reflector"]).is_some()) {
|
||||
|f| match_ty_unwrap(&*f.ty, &["dom", "bindings", "reflector", "Reflector"]).is_some()) {
|
||||
// If it has a field that is a Reflector, use that
|
||||
Some(f) => {
|
||||
let field_name = f.node.ident();
|
||||
let field_name = f.ident;
|
||||
let impl_item = quote_item!(cx,
|
||||
impl ::dom::bindings::reflector::Reflectable for $struct_name {
|
||||
fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector {
|
||||
|
@ -33,7 +33,7 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable:
|
|||
},
|
||||
// Or just call it on the first field (supertype).
|
||||
None => {
|
||||
let field_name = def.fields()[0].node.ident();
|
||||
let field_name = def.fields()[0].ident;
|
||||
let impl_item = quote_item!(cx,
|
||||
impl ::dom::bindings::reflector::Reflectable for $struct_name {
|
||||
fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector {
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
* 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 rustc::front::map as ast_map;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::map as ast_map;
|
||||
use rustc::hir::{self, def};
|
||||
use rustc::lint::{LateContext, LintContext};
|
||||
use rustc::middle::def;
|
||||
use rustc::middle::def_id::DefId;
|
||||
use rustc_front::hir;
|
||||
use syntax::ast;
|
||||
use syntax::attr::mark_used;
|
||||
use syntax::codemap::{ExpnFormat, Span};
|
||||
|
@ -102,8 +101,22 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool {
|
|||
/// usage e.g. with
|
||||
/// `match_def_path(cx, id, &["core", "option", "Option"])`
|
||||
pub fn match_def_path(cx: &LateContext, def_id: DefId, path: &[&str]) -> bool {
|
||||
cx.tcx.with_path(def_id, |iter| iter.map(|elem| elem.name())
|
||||
.zip(path.iter()).all(|(nm, p)| &nm.as_str() == p))
|
||||
let krate = &cx.tcx.crate_name(def_id.krate);
|
||||
if krate != &path[0] {
|
||||
return false;
|
||||
}
|
||||
|
||||
let path = &path[1..];
|
||||
let other = cx.tcx.def_path(def_id).data;
|
||||
|
||||
if other.len() != path.len() {
|
||||
return false;
|
||||
}
|
||||
|
||||
other.into_iter()
|
||||
.map(|e| e.data)
|
||||
.zip(path)
|
||||
.all(|(nm, p)| nm.as_interned_str() == *p)
|
||||
}
|
||||
|
||||
pub fn in_derive_expn(cx: &LateContext, span: Span) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue