Auto merge of #18854 - servo:servo-unstable-feature, r=nox

Make optional the usage of some unstable features

With `--no-default-features --features default-except-unstable`, more crates can now be compiled on stable Rust. This will help integrate them in rustc’s regression testing and compiler performance benchmarking.

<!-- 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/18854)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-13 12:26:39 -05:00 committed by GitHub
commit 78aaa85aec
40 changed files with 549 additions and 236 deletions

View file

@ -2,7 +2,36 @@
* 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/. */
#![feature(raw)]
extern crate layout;
#[macro_use] extern crate size_of_test;
#[cfg(all(test, target_pointer_width = "64"))] mod size_of;
use std::mem;
use std::ptr;
use std::raw;
#[test]
fn test_trait_object_layout() {
assert_eq!(mem::size_of::<raw::TraitObject>(), mem::size_of::<layout::TraitObject>());
let null: *mut () = ptr::null_mut();
let a = raw::TraitObject {
data: null,
vtable: null,
};
let b = layout::TraitObject {
data: null,
vtable: null,
};
fn offset<T, U>(struct_: &T, field: &U) -> usize {
let addr_struct = struct_ as *const T as usize;
let addr_field = field as *const U as usize;
addr_field - addr_struct
}
assert_eq!(offset(&a, &a.data), offset(&b, &b.data));
assert_eq!(offset(&a, &a.vtable), offset(&b, &b.vtable));
}