Remove usage of std::intrinsics::discriminant_value.

This commit is contained in:
Simon Sapin 2016-12-19 20:19:09 +01:00
parent 17a183808e
commit 01442ba1ae
3 changed files with 4 additions and 6 deletions

View file

@ -69,7 +69,7 @@ macro_rules! declare_viewport_descriptor_inner {
const VIEWPORT_DESCRIPTOR_VARIANTS: usize = $number_of_variants; const VIEWPORT_DESCRIPTOR_VARIANTS: usize = $number_of_variants;
impl ViewportDescriptor { impl ViewportDescriptor {
fn discriminant_value(&self) -> usize { pub fn discriminant_value(&self) -> usize {
match *self { match *self {
$( $(
ViewportDescriptor::$assigned_variant(..) => $assigned_discriminant, ViewportDescriptor::$assigned_variant(..) => $assigned_discriminant,

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![cfg(test)] #![cfg(test)]
#![feature(core_intrinsics, plugin, test)] #![feature(plugin, test)]
extern crate app_units; extern crate app_units;
extern crate cssparser; extern crate cssparser;

View file

@ -51,13 +51,11 @@ fn test_meta_viewport<F>(meta: &str, callback: F)
where F: Fn(&Vec<ViewportDescriptorDeclaration>, &str) where F: Fn(&Vec<ViewportDescriptorDeclaration>, &str)
{ {
if let Some(mut rule) = ViewportRule::from_meta(meta) { if let Some(mut rule) = ViewportRule::from_meta(meta) {
use std::intrinsics::discriminant_value;
// from_meta uses a hash-map to collect the declarations, so we need to // from_meta uses a hash-map to collect the declarations, so we need to
// sort them in a stable order for the tests // sort them in a stable order for the tests
rule.declarations.sort_by(|a, b| { rule.declarations.sort_by(|a, b| {
let a = unsafe { discriminant_value(&a.descriptor) }; let a = a.descriptor.discriminant_value();
let b = unsafe { discriminant_value(&b.descriptor) }; let b = b.descriptor.discriminant_value();
a.cmp(&b) a.cmp(&b)
}); });