Files
tubestation/servo/components/deny_public_fields/lib.rs
Bastien Orivel ff6f12df0d servo: Merge #20022 - Update syn, quote and synstructure (from Eijebong:syn); r=nox
Right now they're duplicated because we need a new serde release (ping @dtolnay), a new cssparser release (ping @SimonSapin) and a new release of html5ever with https://github.com/servo/html5ever/pull/336

Source-Repo: https://github.com/servo/servo
Source-Revision: 6cb78057bb115262f31548ef651b24a48957f11d
2018-02-13 11:15:54 -05:00

26 lines
772 B
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
extern crate proc_macro;
extern crate syn;
#[macro_use]
extern crate synstructure;
use std::str::FromStr;
decl_derive!([DenyPublicFields] => deny_public_fields_derive);
fn deny_public_fields_derive(s: synstructure::Structure) -> proc_macro::TokenStream {
s.each(|binding| {
if binding.ast().vis != syn::Visibility::Inherited {
panic!("Field `{}` should not be public",
binding.ast().ident.as_ref().unwrap_or(&binding.binding));
}
"".to_owned()
});
proc_macro::TokenStream::from_str("").unwrap()
}