Auto merge of #19098 - servo:minimal-plugin, r=jdm

Make the unrooted_must_root conditional on a default Cargo feature

Only http://perf.rust-lang.org/ will disable it, in order to be less subject to changes to rustc internal APIs.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19098)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-11-02 09:28:13 -05:00 committed by GitHub
commit 7f2ac4c559
4 changed files with 15 additions and 1 deletions

View file

@ -14,6 +14,8 @@ path = "lib.rs"
[features] [features]
debugmozjs = ['js/debugmozjs'] debugmozjs = ['js/debugmozjs']
unstable = ["servo_allocator/unstable"] unstable = ["servo_allocator/unstable"]
unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"]
default = ["unrooted_must_root_lint"]
[build-dependencies] [build-dependencies]
cmake = "0.1" cmake = "0.1"
@ -85,7 +87,7 @@ servo_geometry = {path = "../geometry" }
servo_rand = {path = "../rand"} servo_rand = {path = "../rand"}
servo_url = {path = "../url"} servo_url = {path = "../url"}
smallvec = "0.4" smallvec = "0.4"
style = {path = "../style"} style = {path = "../style", features = ["servo"]}
style_traits = {path = "../style_traits"} style_traits = {path = "../style_traits"}
swapper = "0.1" swapper = "0.1"
time = "0.1.12" time = "0.1.12"

View file

@ -16,6 +16,7 @@
#![doc = "The script crate contains all matters DOM."] #![doc = "The script crate contains all matters DOM."]
#![plugin(script_plugins)] #![plugin(script_plugins)]
#![cfg_attr(not(feature = "unrooted_must_root_lint"), allow(unknown_lints))]
extern crate angle; extern crate angle;
extern crate app_units; extern crate app_units;

View file

@ -8,3 +8,6 @@ publish = false
[lib] [lib]
path = "lib.rs" path = "lib.rs"
plugin = true plugin = true
[features]
unrooted_must_root_lint = []

View file

@ -14,27 +14,35 @@
//! Use this for structs that correspond to a DOM type //! Use this for structs that correspond to a DOM type
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![feature(macro_vis_matcher)] #![feature(macro_vis_matcher)]
#![feature(plugin)] #![feature(plugin)]
#![feature(plugin_registrar)] #![feature(plugin_registrar)]
#![feature(rustc_private)] #![feature(rustc_private)]
#[cfg(feature = "unrooted_must_root_lint")]
#[macro_use] #[macro_use]
extern crate rustc; extern crate rustc;
extern crate rustc_plugin; extern crate rustc_plugin;
extern crate syntax; extern crate syntax;
use rustc_plugin::Registry; use rustc_plugin::Registry;
use syntax::feature_gate::AttributeType::Whitelisted; use syntax::feature_gate::AttributeType::Whitelisted;
#[cfg(feature = "unrooted_must_root_lint")]
mod unrooted_must_root; mod unrooted_must_root;
/// Utilities for writing plugins /// Utilities for writing plugins
#[cfg(feature = "unrooted_must_root_lint")]
mod utils; mod utils;
#[plugin_registrar] #[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) { 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_late_lint_pass(Box::new(unrooted_must_root::UnrootedPass::new()));
reg.register_attribute("allow_unrooted_interior".to_string(), Whitelisted); reg.register_attribute("allow_unrooted_interior".to_string(), Whitelisted);
reg.register_attribute("must_root".to_string(), Whitelisted); reg.register_attribute("must_root".to_string(), Whitelisted);
} }