Auto merge of #23676 - servo:check, r=Manishearth

Share more `./mach build` logic with mach check, doc, test-unit

Fixes #23659

<!-- 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/23676)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-07-02 23:55:44 -04:00 committed by GitHub
commit 50033878a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 268 additions and 302 deletions

View file

@ -11,10 +11,10 @@ name = "canvas"
path = "lib.rs"
[features]
azure_backend = ["azure"]
default = ["azure_backend"]
canvas2d-azure = ["azure"]
canvas2d-raqote = ["raqote"]
default = ["canvas2d-azure"]
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
raqote_backend = ["raqote"]
no_wgl = ["offscreen_gl_context/no_wgl"]
[dependencies]

View file

@ -0,0 +1,20 @@
/* 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 https://mozilla.org/MPL/2.0/. */
fn main() {
let azure = std::env::var_os("CARGO_FEATURE_CANVAS2D_AZURE").is_some();
let raqote = std::env::var_os("CARGO_FEATURE_CANVAS2D_RAQOTE").is_some();
if !(azure || raqote) {
error("Must enable one of the `canvas2d-azure` or `canvas2d-raqote` features.")
}
if azure && raqote {
error("Must not enable both of the `canvas2d-azure` and `canvas2d-raqote` features.")
}
}
fn error(message: &str) {
print!("\n\n Error: {}\n\n", message);
std::process::exit(1)
}

View file

@ -281,92 +281,92 @@ pub trait GenericDrawTarget {
#[derive(Clone)]
pub enum ExtendMode {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::ExtendMode),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
pub enum GradientStop {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::AzGradientStop),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
pub enum GradientStops {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::GradientStops),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
#[derive(Clone)]
pub enum Color {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::Color),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
#[derive(Clone)]
pub enum CompositionOp {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::CompositionOp),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
pub enum SurfaceFormat {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::SurfaceFormat),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
#[derive(Clone)]
pub enum SourceSurface {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::SourceSurface),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
pub enum Path {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::Path),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
#[derive(Clone)]
pub enum Pattern {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::Pattern),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
pub enum DrawSurfaceOptions {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::DrawSurfaceOptions),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
#[derive(Clone)]
pub enum DrawOptions {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::DrawOptions),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(()),
}
#[derive(Clone)]
pub enum StrokeOptions<'a> {
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::StrokeOptions<'a>),
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
Raqote(PhantomData<&'a ()>),
}
@ -391,12 +391,12 @@ pub struct CanvasData<'a> {
pub canvas_id: CanvasId,
}
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
fn create_backend() -> Box<dyn Backend> {
Box::new(crate::azure_backend::AzureBackend)
}
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
fn create_backend() -> Box<dyn Backend> {
Box::new(crate::raqote_backend::RaqoteBackend)
}

View file

@ -7,10 +7,10 @@
#[macro_use]
extern crate log;
#[cfg(feature = "azure_backend")]
#[cfg(feature = "canvas2d-azure")]
mod azure_backend;
#[cfg(feature = "raqote_backend")]
#[cfg(feature = "canvas2d-raqote")]
mod raqote_backend;
pub mod canvas_data;

View file

@ -11,8 +11,8 @@ name = "constellation"
path = "lib.rs"
[features]
azure_backend = ["canvas/azure_backend"]
raqote_backend = ["canvas/raqote_backend"]
canvas2d-azure = ["canvas/canvas2d-azure"]
canvas2d-raqote = ["canvas/canvas2d-raqote"]
no_wgl = ["canvas/no_wgl"]
[dependencies]

View file

@ -3,7 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![deny(unsafe_code)]
#![cfg_attr(feature = "unstable", feature(conservative_impl_trait))]
#[macro_use]
extern crate crossbeam_channel;

View file

@ -13,9 +13,6 @@ path = "lib.rs"
test = false
doctest = false
[features]
unstable = ["packed_simd"]
[dependencies]
app_units = "0.7"
bitflags = "1.0"
@ -31,7 +28,7 @@ log = "0.4"
malloc_size_of = { path = "../malloc_size_of" }
net_traits = {path = "../net_traits"}
ordered-float = "1.0"
packed_simd = {version = "0.3", optional = true}
packed_simd = "0.3"
range = {path = "../range"}
serde = "1.0"
servo_arc = {path = "../servo_arc"}

View file

@ -4,10 +4,7 @@
use app_units::Au;
use euclid::Point2D;
#[cfg(all(
feature = "unstable",
any(target_feature = "sse2", target_feature = "neon")
))]
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
use packed_simd::u32x4;
use range::{self, EachIndex, Range, RangeIndex};
use std::cmp::{Ordering, PartialOrd};
@ -75,7 +72,6 @@ pub type GlyphId = u32;
// TODO: make this more type-safe.
const FLAG_CHAR_IS_SPACE: u32 = 0x40000000;
#[cfg(feature = "unstable")]
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
const FLAG_CHAR_IS_SPACE_SHIFT: u32 = 30;
const FLAG_IS_SIMPLE_GLYPH: u32 = 0x80000000;
@ -625,7 +621,6 @@ impl<'a> GlyphStore {
}
#[inline]
#[cfg(feature = "unstable")]
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
fn advance_for_byte_range_simple_glyphs(
&self,
@ -644,7 +639,7 @@ impl<'a> GlyphStore {
for i in 0..num_simd_iterations {
let offset = begin + i * 4;
let v = u32x4::load_unaligned(&buf[offset..]);
let v = u32x4::from_slice_unaligned(&buf[offset..]);
let advance = (v & advance_mask) >> GLYPH_ADVANCE_SHIFT;
let spaces = (v & space_flag_mask) >> FLAG_CHAR_IS_SPACE_SHIFT;
simd_advance = simd_advance + advance;
@ -672,10 +667,7 @@ impl<'a> GlyphStore {
/// When SIMD isn't available, fallback to the slow path.
#[inline]
#[cfg(not(all(
feature = "unstable",
any(target_feature = "sse2", target_feature = "neon")
)))]
#[cfg(not(any(target_feature = "sse2", target_feature = "neon")))]
fn advance_for_byte_range_simple_glyphs(
&self,
range: &Range<ByteIndex>,
@ -686,7 +678,6 @@ impl<'a> GlyphStore {
/// Used for SIMD.
#[inline]
#[cfg(feature = "unstable")]
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
#[allow(unsafe_code)]
fn transmute_entry_buffer_to_u32_buffer(&self) -> &[u32] {

View file

@ -10,9 +10,6 @@ publish = false
name = "layout_thread"
path = "lib.rs"
[features]
unstable = ["parking_lot/nightly"]
[dependencies]
app_units = "0.7"
atomic_refcell = "0.1"
@ -36,7 +33,7 @@ malloc_size_of = { path = "../malloc_size_of" }
metrics = {path = "../metrics"}
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
parking_lot = "0.8"
parking_lot = {version = "0.8", features = ["nightly"]}
profile_traits = {path = "../profile_traits"}
range = {path = "../range"}
rayon = "1"

View file

@ -10,9 +10,6 @@ publish = false
name = "profile"
path = "lib.rs"
[features]
unstable = ["servo_allocator"]
[dependencies]
profile_traits = {path = "../profile_traits"}
influent = "0.5"
@ -33,4 +30,4 @@ regex = "1.1"
[target.'cfg(not(target_os = "windows"))'.dependencies]
libc = "0.2"
servo_allocator = {path = "../allocator", optional = true}
servo_allocator = {path = "../allocator"}

View file

@ -389,14 +389,14 @@ mod system_reporter {
use super::{JEMALLOC_HEAP_ALLOCATED_STR, SYSTEM_HEAP_ALLOCATED_STR};
#[cfg(target_os = "linux")]
use libc::c_int;
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
#[cfg(not(target_os = "windows"))]
use libc::{c_void, size_t};
use profile_traits::mem::{Report, ReportKind, ReporterRequest};
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
#[cfg(not(target_os = "windows"))]
use std::ffi::CString;
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
#[cfg(not(target_os = "windows"))]
use std::mem::size_of;
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
#[cfg(not(target_os = "windows"))]
use std::ptr::null_mut;
#[cfg(target_os = "macos")]
use task_info::task_basic_info::{resident_size, virtual_size};
@ -495,10 +495,10 @@ mod system_reporter {
None
}
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
#[cfg(not(target_os = "windows"))]
use servo_allocator::jemalloc_sys::mallctl;
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
#[cfg(not(target_os = "windows"))]
fn jemalloc_stat(value_name: &str) -> Option<usize> {
// Before we request the measurement of interest, we first send an "epoch"
// request. Without that jemalloc gives cached statistics(!) which can be
@ -545,7 +545,7 @@ mod system_reporter {
Some(value as usize)
}
#[cfg(any(target_os = "windows", not(feature = "unstable")))]
#[cfg(target_os = "windows")]
fn jemalloc_stat(_value_name: &str) -> Option<usize> {
None
}

View file

@ -15,7 +15,6 @@ path = "lib.rs"
[features]
debugmozjs = ['js/debugmozjs']
profilemozjs = ['js/profilemozjs']
unstable = []
unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"]
webidl_lint = ["script_plugins/webidl_lint"]
default = ["unrooted_must_root_lint", "webidl_lint"]

View file

@ -69,10 +69,7 @@ pub trait IDLInterface {
}
/// A trait to mark an IDL interface as deriving from another one.
#[cfg_attr(
feature = "unstable",
rustc_on_unimplemented(message = "The IDL interface `{Self}` is not derived from `{T}`.")
)]
#[rustc_on_unimplemented(message = "The IDL interface `{Self}` is not derived from `{T}`.")]
pub trait DerivedFrom<T: Castable>: Castable {}
impl<T: Float + ToJSValConvertible> ToJSValConvertible for Finite<T> {

View file

@ -330,13 +330,13 @@ impl<T: DomObject> Deref for Dom<T> {
unsafe impl<T: DomObject> JSTraceable for Dom<T> {
unsafe fn trace(&self, trc: *mut JSTracer) {
#[cfg(all(feature = "unstable", debug_assertions))]
let trace_str = format!("for {} on heap", ::std::intrinsics::type_name::<T>());
#[cfg(all(feature = "unstable", debug_assertions))]
let trace_info = &trace_str[..];
#[cfg(not(all(feature = "unstable", debug_assertions)))]
let trace_info = "for DOM object on heap";
let trace_string;
let trace_info = if cfg!(debug_assertions) {
trace_string = format!("for {} on heap", ::std::intrinsics::type_name::<T>());
&trace_string[..]
} else {
"for DOM object on heap"
};
trace_reflector(trc, trace_info, (*self.ptr.as_ptr()).reflector());
}
}

View file

@ -938,10 +938,7 @@ impl WindowMethods for Window {
#[allow(unsafe_code)]
fn Trap(&self) {
#[cfg(feature = "unstable")]
unsafe {
::std::intrinsics::breakpoint()
}
unsafe { ::std::intrinsics::breakpoint() }
}
#[allow(unsafe_code)]

View file

@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![cfg_attr(feature = "unstable", feature(core_intrinsics))]
#![cfg_attr(feature = "unstable", feature(on_unimplemented))]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(drain_filter)]
#![feature(inner_deref)]
#![feature(on_unimplemented)]
#![feature(plugin)]
#![feature(type_alias_enum_variants)]
#![deny(unsafe_code)]

View file

@ -32,14 +32,7 @@ macro_rules! task {
pub trait TaskOnce: Send {
#[allow(unsafe_code)]
fn name(&self) -> &'static str {
#[cfg(feature = "unstable")]
unsafe {
::std::intrinsics::type_name::<Self>()
}
#[cfg(not(feature = "unstable"))]
{
"(task name unknown)"
}
unsafe { ::std::intrinsics::type_name::<Self>() }
}
fn run_once(self);

View file

@ -12,7 +12,8 @@ path = "lib.rs"
crate-type = ["rlib"]
[features]
azure_backend = ["canvas/azure_backend"]
canvas2d-azure = ["canvas/canvas2d-azure"]
canvas2d-raqote = ["canvas/canvas2d-raqote"]
debugmozjs = ["script/debugmozjs"]
energy-profiling = ["profile_traits/energy-profiling"]
profilemozjs = ["script/profilemozjs"]
@ -21,16 +22,10 @@ js_backtrace = ["script/js_backtrace"]
max_log_level = ["log/release_max_level_info"]
native-bluetooth = ["bluetooth/native-bluetooth"]
no_wgl = ["canvas/no_wgl"]
raqote_backend = ["canvas/raqote_backend"]
uwp = ["servo_config/uwp"]
webrender_debugger = ["webrender/debugger"]
no_static_freetype = ["webrender/no_static_freetype"]
oculusvr = ["webvr/oculusvr"]
unstable = [
"euclid/unstable",
"profile/unstable",
"script/unstable",
]
webdriver = ["webdriver_server"]
webgl_backtrace = [
"script/webgl_backtrace",