Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch some crates to the 2018 edition #22086

Merged
merged 8 commits into from Nov 6, 2018

Use 2018-style paths in code generated by proc-macro derives

  • Loading branch information
SimonSapin committed Nov 6, 2018
commit 86f148fb97601413c0d983f21b760d973ade7a75
@@ -47,7 +47,7 @@ pub fn dom_struct(args: TokenStream, input: TokenStream) -> TokenStream {
quote! (
#s2

impl ::dom::bindings::inheritance::HasParent for #name {
impl crate::dom::bindings::inheritance::HasParent for #name {
type Parent = #ty;
/// This is used in a type assertion to ensure that
/// the source and webidls agree as to what the parent type is
@@ -41,22 +41,22 @@ fn expand_dom_object(input: syn::DeriveInput) -> quote::Tokens {
impl #impl_generics ::js::conversions::ToJSValConvertible for #name #ty_generics #where_clause {
#[allow(unsafe_code)]
unsafe fn to_jsval(&self,
cx: *mut ::js::jsapi::JSContext,
rval: ::js::rust::MutableHandleValue) {
let object = ::dom::bindings::reflector::DomObject::reflector(self).get_jsobject();
cx: *mut js::jsapi::JSContext,
rval: js::rust::MutableHandleValue) {
let object = crate::dom::bindings::reflector::DomObject::reflector(self).get_jsobject();
object.to_jsval(cx, rval)
}
}

impl #impl_generics ::dom::bindings::reflector::DomObject for #name #ty_generics #where_clause {
impl #impl_generics crate::dom::bindings::reflector::DomObject for #name #ty_generics #where_clause {
#[inline]
fn reflector(&self) -> &::dom::bindings::reflector::Reflector {
fn reflector(&self) -> &crate::dom::bindings::reflector::Reflector {
self.#first_field_name.reflector()
}
}

impl #impl_generics ::dom::bindings::reflector::MutDomObject for #name #ty_generics #where_clause {
fn init_reflector(&mut self, obj: *mut ::js::jsapi::JSObject) {
impl #impl_generics crate::dom::bindings::reflector::MutDomObject for #name #ty_generics #where_clause {
fn init_reflector(&mut self, obj: *mut js::jsapi::JSObject) {
self.#first_field_name.init_reflector(obj);
}
}
@@ -78,7 +78,7 @@ fn expand_dom_object(input: syn::DeriveInput) -> quote::Tokens {
let mut generics = input.generics.clone();
generics
.params
.push(parse_quote!(__T: ::dom::bindings::reflector::DomObject));
.push(parse_quote!(__T: crate::dom::bindings::reflector::DomObject));

let (impl_generics, _, where_clause) = generics.split_for_impl();

@@ -21,16 +21,16 @@ fn js_traceable_derive(s: synstructure::Structure) -> quote::Tokens {
let ident = param.ident;
where_clause
.predicates
.push(parse_quote!(#ident: ::dom::bindings::trace::JSTraceable))
.push(parse_quote!(#ident: crate::dom::bindings::trace::JSTraceable))
}

let tokens = quote! {
#[allow(unsafe_code)]
unsafe impl #impl_generics ::dom::bindings::trace::JSTraceable for #name #ty_generics #where_clause {
unsafe impl #impl_generics crate::dom::bindings::trace::JSTraceable for #name #ty_generics #where_clause {
#[inline]
#[allow(unused_variables, unused_imports)]
unsafe fn trace(&self, tracer: *mut ::js::jsapi::JSTracer) {
use ::dom::bindings::trace::JSTraceable;
unsafe fn trace(&self, tracer: *mut js::jsapi::JSTracer) {
use crate::dom::bindings::trace::JSTraceable;
match *self {
#match_body
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.