servo: Merge #19098 - Make the unrooted_must_root conditional on a default Cargo feature (from servo:minimal-plugin); r=jdm
authorSimon Sapin <simon.sapin@exyr.org>
Thu, 02 Nov 2017 09:28:13 -0500
changeset 443119 053648c20b753e656ec3f4bce556b41ccacffe59
parent 443118 f2326b69f91ecea44005b9be55ed6ad6f515f253
child 443120 fc681729ccc8010ac7fb34fd44dac438ed45bbf9
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #19098 - Make the unrooted_must_root conditional on a default Cargo feature (from servo:minimal-plugin); r=jdm Only http://perf.rust-lang.org/ will disable it, in order to be less subject to changes to rustc internal APIs. Source-Repo: https://github.com/servo/servo Source-Revision: 7f2ac4c559a2ff99ed7571af646ecee3f33168c3
servo/components/script/Cargo.toml
servo/components/script/lib.rs
servo/components/script_plugins/Cargo.toml
servo/components/script_plugins/lib.rs
--- a/servo/components/script/Cargo.toml
+++ b/servo/components/script/Cargo.toml
@@ -9,16 +9,18 @@ build = "build.rs"
 
 [lib]
 name = "script"
 path = "lib.rs"
 
 [features]
 debugmozjs = ['js/debugmozjs']
 unstable = ["servo_allocator/unstable"]
+unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"]
+default = ["unrooted_must_root_lint"]
 
 [build-dependencies]
 cmake = "0.1"
 phf_codegen = "0.7.18"
 phf_shared = "0.7.18"
 serde_json = "1.0"
 
 [target.'cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))'.dependencies]
@@ -80,17 +82,17 @@ serde = "1.0"
 servo_allocator = {path = "../allocator"}
 servo_arc = {path = "../servo_arc"}
 servo_atoms = {path = "../atoms"}
 servo_config = {path = "../config"}
 servo_geometry = {path = "../geometry" }
 servo_rand = {path = "../rand"}
 servo_url = {path = "../url"}
 smallvec = "0.4"
-style = {path = "../style"}
+style = {path = "../style", features = ["servo"]}
 style_traits = {path = "../style_traits"}
 swapper = "0.1"
 time = "0.1.12"
 unicode-segmentation = "1.1.0"
 url = "1.6"
 utf-8 = "0.7"
 uuid = {version = "0.5", features = ["v4"]}
 xml5ever = {version = "0.11"}
--- a/servo/components/script/lib.rs
+++ b/servo/components/script/lib.rs
@@ -11,16 +11,17 @@
 #![feature(proc_macro)]
 
 #![deny(unsafe_code)]
 #![allow(non_snake_case)]
 
 #![doc = "The script crate contains all matters DOM."]
 
 #![plugin(script_plugins)]
+#![cfg_attr(not(feature = "unrooted_must_root_lint"), allow(unknown_lints))]
 
 extern crate angle;
 extern crate app_units;
 extern crate audio_video_metadata;
 extern crate base64;
 #[macro_use]
 extern crate bitflags;
 extern crate bluetooth_traits;
--- a/servo/components/script_plugins/Cargo.toml
+++ b/servo/components/script_plugins/Cargo.toml
@@ -3,8 +3,11 @@ name = "script_plugins"
 version = "0.0.1"
 authors = ["The Servo Project Developers"]
 license = "MPL-2.0"
 publish = false
 
 [lib]
 path = "lib.rs"
 plugin = true
+
+[features]
+unrooted_must_root_lint = []
--- a/servo/components/script_plugins/lib.rs
+++ b/servo/components/script_plugins/lib.rs
@@ -9,32 +9,40 @@
 //!  - `#[derive(DenyPublicFields)]` : Forces all fields in a struct/enum to be private
 //!  - `#[derive(JSTraceable)]` : Auto-derives an implementation of `JSTraceable` for a struct in the script crate
 //!  - `#[must_root]` : Prevents data of the marked type from being used on the stack.
 //!                     See the lints module for more details
 //!  - `#[dom_struct]` : Implies #[derive(JSTraceable, DenyPublicFields)]`, and `#[must_root]`.
 //!                       Use this for structs that correspond to a DOM type
 
 
+
 #![deny(unsafe_code)]
 #![feature(macro_vis_matcher)]
 #![feature(plugin)]
 #![feature(plugin_registrar)]
 #![feature(rustc_private)]
 
+#[cfg(feature = "unrooted_must_root_lint")]
 #[macro_use]
 extern crate rustc;
+
 extern crate rustc_plugin;
 extern crate syntax;
 
 use rustc_plugin::Registry;
 use syntax::feature_gate::AttributeType::Whitelisted;
 
+#[cfg(feature = "unrooted_must_root_lint")]
 mod unrooted_must_root;
+
 /// Utilities for writing plugins
+#[cfg(feature = "unrooted_must_root_lint")]
 mod utils;
 
 #[plugin_registrar]
 pub fn plugin_registrar(reg: &mut Registry) {
+    #[cfg(feature = "unrooted_must_root_lint")]
     reg.register_late_lint_pass(Box::new(unrooted_must_root::UnrootedPass::new()));
+
     reg.register_attribute("allow_unrooted_interior".to_string(), Whitelisted);
     reg.register_attribute("must_root".to_string(), Whitelisted);
 }