aboutsummaryrefslogtreecommitdiffstats
path: root/components/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'components/plugins')
-rw-r--r--components/plugins/Cargo.toml4
-rw-r--r--components/plugins/lib.rs2
-rw-r--r--components/plugins/lints/inheritance_integrity.rs6
-rw-r--r--components/plugins/lints/privatize.rs4
-rw-r--r--components/plugins/lints/unrooted_must_root.rs14
-rw-r--r--components/plugins/reflector.rs4
-rw-r--r--components/plugins/url_plugin.rs21
7 files changed, 30 insertions, 25 deletions
diff --git a/components/plugins/Cargo.toml b/components/plugins/Cargo.toml
index f697fe45cf7..03f002376eb 100644
--- a/components/plugins/Cargo.toml
+++ b/components/plugins/Cargo.toml
@@ -16,8 +16,8 @@ git = "https://github.com/Manishearth/rust-clippy"
branch = "servo"
optional = true
-[dependencies.url]
-version = "0.2.36"
+[dependencies]
+url = "0.5"
[features]
default = []
diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs
index d52ad866879..6662825452b 100644
--- a/components/plugins/lib.rs
+++ b/components/plugins/lib.rs
@@ -13,7 +13,7 @@
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[derive(JSTraceable)]`, and `#[must_root]`.
//! Use this for structs that correspond to a DOM type
-#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private)]
+#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, slice_patterns)]
#[macro_use]
extern crate syntax;
diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs
index 4f5770948aa..8ced4fb4c69 100644
--- a/components/plugins/lints/inheritance_integrity.rs
+++ b/components/plugins/lints/inheritance_integrity.rs
@@ -24,13 +24,13 @@ impl LintPass for InheritancePass {
}
impl LateLintPass for InheritancePass {
- fn check_struct_def(&mut self, cx: &LateContext, def: &hir::StructDef, _n: ast::Name,
+ fn check_struct_def(&mut self, cx: &LateContext, def: &hir::VariantData, _n: ast::Name,
_gen: &hir::Generics, id: ast::NodeId) {
// Lints are run post expansion, so it's fine to use
// #[_dom_struct_marker] here without also checking for #[dom_struct]
if cx.tcx.has_attr(cx.tcx.map.local_def_id(id), "_dom_struct_marker") {
// Find the reflector, if any
- let reflector_span = def.fields.iter().enumerate()
+ let reflector_span = def.fields().iter().enumerate()
.find(|&(ctr, f)| {
if match_lang_ty(cx, &*f.node.ty, "reflector") {
if ctr > 0 {
@@ -44,7 +44,7 @@ impl LateLintPass for InheritancePass {
})
.map(|(_, f)| f.span);
// Find all #[dom_struct] fields
- let dom_spans: Vec<_> = def.fields.iter().enumerate().filter_map(|(ctr, f)| {
+ let dom_spans: Vec<_> = def.fields().iter().enumerate().filter_map(|(ctr, f)| {
if let hir::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) {
diff --git a/components/plugins/lints/privatize.rs b/components/plugins/lints/privatize.rs
index cf3d933c010..704edcdaeda 100644
--- a/components/plugins/lints/privatize.rs
+++ b/components/plugins/lints/privatize.rs
@@ -25,12 +25,12 @@ impl LintPass for PrivatizePass {
impl LateLintPass for PrivatizePass {
fn check_struct_def(&mut self,
cx: &LateContext,
- def: &hir::StructDef,
+ def: &hir::VariantData,
_n: ast::Name,
_gen: &hir::Generics,
id: ast::NodeId) {
if cx.tcx.has_attr(cx.tcx.map.local_def_id(id), "privatize") {
- for field in &def.fields {
+ for field in def.fields() {
match field.node {
hir::StructField_ { kind: hir::NamedField(name, visibility), .. } if visibility == hir::Public => {
cx.span_lint(PRIVATIZE, field.span,
diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs
index 5b6e16c99e9..7f4eacdbd62 100644
--- a/components/plugins/lints/unrooted_must_root.rs
+++ b/components/plugins/lints/unrooted_must_root.rs
@@ -80,7 +80,7 @@ impl LateLintPass for UnrootedPass {
/// All structs containing #[must_root] types must be #[must_root] themselves
fn check_struct_def(&mut self,
cx: &LateContext,
- def: &hir::StructDef,
+ def: &hir::VariantData,
_n: ast::Name,
_gen: &hir::Generics,
id: ast::NodeId) {
@@ -89,7 +89,7 @@ impl LateLintPass for UnrootedPass {
_ => cx.tcx.map.expect_item(cx.tcx.map.get_parent(id)),
};
if item.attrs.iter().all(|a| !a.check_name("must_root")) {
- for ref field in &def.fields {
+ for ref field in def.fields() {
if is_unrooted_ty(cx, cx.tcx.node_id_to_type(field.node.id), false) {
cx.span_lint(UNROOTED_MUST_ROOT, field.span,
"Type must be rooted, use #[must_root] on the struct definition to propagate")
@@ -101,13 +101,13 @@ impl LateLintPass for UnrootedPass {
/// All enums containing #[must_root] types must be #[must_root] themselves
fn check_variant(&mut self, cx: &LateContext, var: &hir::Variant, _gen: &hir::Generics) {
let ref map = cx.tcx.map;
- if map.expect_item(map.get_parent(var.node.id)).attrs.iter().all(|a| !a.check_name("must_root")) {
- match var.node.kind {
- hir::TupleVariantKind(ref vec) => {
+ if map.expect_item(map.get_parent(var.node.data.id())).attrs.iter().all(|a| !a.check_name("must_root")) {
+ match var.node.data {
+ hir::VariantData::Tuple(ref vec, _) => {
for ty in vec {
- cx.tcx.ast_ty_to_ty_cache.borrow().get(&ty.id).map(|t| {
+ cx.tcx.ast_ty_to_ty_cache.borrow().get(&ty.node.id).map(|t| {
if is_unrooted_ty(cx, t, false) {
- cx.span_lint(UNROOTED_MUST_ROOT, ty.ty.span,
+ cx.span_lint(UNROOTED_MUST_ROOT, ty.node.ty.span,
"Type must be rooted, use #[must_root] on \
the enum definition to propagate")
}
diff --git a/components/plugins/reflector.rs b/components/plugins/reflector.rs
index 84b960168d0..826fb5f7636 100644
--- a/components/plugins/reflector.rs
+++ b/components/plugins/reflector.rs
@@ -15,7 +15,7 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable:
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
- match def.fields.iter().find(
+ match def.fields().iter().find(
|f| match_ty_unwrap(&*f.node.ty, &["dom", "bindings", "reflector", "Reflector"]).is_some()) {
// If it has a field that is a Reflector, use that
Some(f) => {
@@ -34,7 +34,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].node.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 {
diff --git a/components/plugins/url_plugin.rs b/components/plugins/url_plugin.rs
index 8ae06624c4b..e757916c4f7 100644
--- a/components/plugins/url_plugin.rs
+++ b/components/plugins/url_plugin.rs
@@ -16,7 +16,7 @@ use url::{Url, Host, RelativeSchemeData, SchemeData};
pub fn expand_url(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
-> Box<MacResult + 'static> {
let mut parser = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.to_vec());
- let query_expr = cx.expander().fold_expr(parser.parse_expr());
+ let query_expr = cx.expander().fold_expr(parser.parse_expr_nopanic().unwrap());
// Ensure a str literal was passed to the macro
let query = match parse_str_lit(&query_expr) {
@@ -114,17 +114,22 @@ impl<'a> ExtCtxtHelpers for ExtCtxt<'a> {
}
}
- fn expr_host(&self, sp: Span, host: Host) -> syntax::ptr::P<Expr> {
+ fn expr_host(&self, _sp: Span, host: Host) -> syntax::ptr::P<Expr> {
match host {
Host::Domain(domain) => quote_expr!(self, ::url::Host::Domain(String::from($domain))),
Host::Ipv6(address) => {
- let pieces_expr = self.expr_slice_u16(sp, &address.pieces);
+ let [a, b, c, d, e, f, g, h] = address.segments();
quote_expr!(self,
- ::url::Host::Ipv6(
- ::url::Ipv6Address {
- pieces: $pieces_expr.to_owned()
- }
- ))
+ ::url::Host::Ipv6(::std::net::Ipv6Addr::new(
+ $a, $b, $c, $d, $e, $f, $g, $h
+ )))
+ },
+ Host::Ipv4(address) => {
+ let [a, b, c, d] = address.octets();
+ quote_expr!(self,
+ ::url::Host::Ipv4(::std::net::Ipv4Addr::new(
+ $a, $b, $c, $d
+ )))
},
}
}