mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev.
This commit is contained in:
parent
65d4b12bf2
commit
5f15eb5fbf
140 changed files with 1420 additions and 1222 deletions
|
@ -48,7 +48,7 @@ fn expand_cased<'cx, T>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree],
|
|||
match (res, it.count()) {
|
||||
(Some((s, span)), 0) => {
|
||||
let new_s = s.chars().map(transform).collect::<String>();
|
||||
base::MacExpr::new(cx.expr_str(span, token::intern_and_get_ident(new_s.as_slice())))
|
||||
base::MacEager::expr(cx.expr_str(span, token::intern_and_get_ident(new_s.as_slice())))
|
||||
}
|
||||
(_, rest) => {
|
||||
if rest > 0 {
|
||||
|
|
|
@ -34,7 +34,7 @@ pub fn expand_dom_struct(_: &mut ExtCtxt, _: Span, _: &MetaItem, item: P<Item>)
|
|||
/// Provides the hook to expand `#[jstraceable]` into an implementation of `JSTraceable`
|
||||
///
|
||||
/// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not implement the method.
|
||||
pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Item, mut push: Box<FnMut(P<Item>)>) {
|
||||
pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Item, push: &mut FnMut(P<Item>)) {
|
||||
let trait_def = TraitDef {
|
||||
span: span,
|
||||
attributes: Vec::new(),
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, core, unicode)]
|
||||
|
||||
#![allow(missing_copy_implementations)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate syntax;
|
||||
#[macro_use]
|
||||
|
|
|
@ -41,8 +41,9 @@ impl LintPass for InheritancePass {
|
|||
.map(|(_, f)| f.span);
|
||||
// Find all #[dom_struct] fields
|
||||
let dom_spans: Vec<_> = def.fields.iter().enumerate().filter_map(|(ctr, f)| {
|
||||
if let ast::TyPath(_, ty_id) = f.node.ty.node {
|
||||
if let Some(def::DefTy(def_id, _)) = cx.tcx.def_map.borrow().get(&ty_id).cloned() {
|
||||
if let ast::TyPath(..) = f.node.ty.node {
|
||||
if let Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) =
|
||||
cx.tcx.def_map.borrow().get(&f.node.ty.id) {
|
||||
if ty::has_attr(cx.tcx, def_id, "_dom_struct_marker") {
|
||||
// If the field is not the first, it's probably
|
||||
// being misused (a)
|
||||
|
|
|
@ -26,7 +26,7 @@ impl LintPass for TransmutePass {
|
|||
match ex.node {
|
||||
ast::ExprCall(ref expr, ref args) => {
|
||||
match expr.node {
|
||||
ast::ExprPath(ref path) => {
|
||||
ast::ExprPath(_, ref path) => {
|
||||
if path.segments.last()
|
||||
.map_or(false, |ref segment| segment.identifier.name.as_str() == "transmute")
|
||||
&& args.len() == 1 {
|
||||
|
|
|
@ -33,9 +33,9 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
|
|||
match ty.node {
|
||||
ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) |
|
||||
ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning),
|
||||
ast::TyPath(_, id) => {
|
||||
match cx.tcx.def_map.borrow()[id].clone() {
|
||||
def::DefTy(def_id, _) => {
|
||||
ast::TyPath(..) => {
|
||||
match cx.tcx.def_map.borrow()[ty.id] {
|
||||
def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => {
|
||||
if ty::has_attr(cx.tcx, def_id, "must_root") {
|
||||
cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ use syntax::ast;
|
|||
use utils::match_ty_unwrap;
|
||||
|
||||
|
||||
pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, item: &Item, mut push: Box<FnMut(P<Item>) -> ()>) {
|
||||
pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, item: &Item, push: &mut FnMut(P<Item>) -> ()) {
|
||||
if let ast::ItemStruct(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
|
||||
|
|
|
@ -16,7 +16,7 @@ use syntax::attr::mark_used;
|
|||
/// 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 Ty, segments: &[&str]) -> Option<&'a [P<Ty>]> {
|
||||
match ty.node {
|
||||
TyPath(Path {segments: ref seg, ..}, _) => {
|
||||
TyPath(_, Path {segments: ref seg, ..}) => {
|
||||
// So ast::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
|
||||
|
@ -38,13 +38,13 @@ pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]>
|
|||
|
||||
/// Checks if a type has a #[servo_lang = "str"] attribute
|
||||
pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool {
|
||||
let ty_id = match ty.node {
|
||||
TyPath(_, ty_id) => ty_id,
|
||||
match ty.node {
|
||||
TyPath(..) => {},
|
||||
_ => return false,
|
||||
};
|
||||
}
|
||||
|
||||
let def_id = match cx.tcx.def_map.borrow().get(&ty_id).cloned() {
|
||||
Some(def::DefTy(def_id, _)) => def_id,
|
||||
let def_id = match cx.tcx.def_map.borrow().get(&ty.id) {
|
||||
Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) => def_id,
|
||||
_ => return false,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue