style: Back out diagnostics for not being helpful enough at diagnosing.

The selectors that crash seem just corrupted data structures, none of the
selectors from crash dumps make sense, and the ones for which I could trace the
source found no issue.
This commit is contained in:
Emilio Cobos Álvarez 2018-10-27 13:10:57 +02:00
parent 0c057d9299
commit e7261d51e9
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -105,7 +105,7 @@ impl<Impl: SelectorImpl> SelectorBuilder<Impl> {
parsed_slotted: bool, parsed_slotted: bool,
) -> ThinArc<SpecificityAndFlags, Component<Impl>> { ) -> ThinArc<SpecificityAndFlags, Component<Impl>> {
// Compute the specificity and flags. // Compute the specificity and flags.
let mut spec = SpecificityAndFlags(specificity(&*self, self.simple_selectors.iter())); let mut spec = SpecificityAndFlags(specificity(self.simple_selectors.iter()));
if parsed_pseudo { if parsed_pseudo {
spec.0 |= HAS_PSEUDO_BIT; spec.0 |= HAS_PSEUDO_BIT;
} }
@ -281,33 +281,26 @@ impl From<Specificity> for u32 {
} }
} }
fn specificity<Impl>(builder: &SelectorBuilder<Impl>, iter: slice::Iter<Component<Impl>>) -> u32 fn specificity<Impl>(iter: slice::Iter<Component<Impl>>) -> u32
where where
Impl: SelectorImpl, Impl: SelectorImpl,
{ {
complex_selector_specificity(builder, iter).into() complex_selector_specificity(iter).into()
} }
fn complex_selector_specificity<Impl>( fn complex_selector_specificity<Impl>(iter: slice::Iter<Component<Impl>>) -> Specificity
builder: &SelectorBuilder<Impl>,
mut iter: slice::Iter<Component<Impl>>,
) -> Specificity
where where
Impl: SelectorImpl, Impl: SelectorImpl,
{ {
fn simple_selector_specificity<Impl>( fn simple_selector_specificity<Impl>(
builder: &SelectorBuilder<Impl>,
simple_selector: &Component<Impl>, simple_selector: &Component<Impl>,
specificity: &mut Specificity, specificity: &mut Specificity,
) where ) where
Impl: SelectorImpl, Impl: SelectorImpl,
{ {
match *simple_selector { match *simple_selector {
Component::Combinator(ref combinator) => { Component::Combinator(..) => {
unreachable!( unreachable!("Found combinator in simple selectors vector?");
"Found combinator {:?} in simple selectors vector? {:?}",
combinator, builder,
);
}, },
Component::PseudoElement(..) | Component::LocalName(..) => { Component::PseudoElement(..) | Component::LocalName(..) => {
specificity.element_selectors += 1 specificity.element_selectors += 1
@ -361,15 +354,15 @@ where
}, },
Component::Negation(ref negated) => { Component::Negation(ref negated) => {
for ss in negated.iter() { for ss in negated.iter() {
simple_selector_specificity(builder, &ss, specificity); simple_selector_specificity(&ss, specificity);
} }
}, },
} }
} }
let mut specificity = Default::default(); let mut specificity = Default::default();
for simple_selector in &mut iter { for simple_selector in iter {
simple_selector_specificity(builder, &simple_selector, &mut specificity); simple_selector_specificity(&simple_selector, &mut specificity);
} }
specificity specificity
} }