mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
Auto merge of #19970 - janczer:change_debug_assertions, r=emilio
Change debug assertions to specific ones <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #19962 (github issue number if applicable). <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/19970) <!-- Reviewable:end -->
This commit is contained in:
commit
5d209a70ab
23 changed files with 53 additions and 53 deletions
|
@ -472,7 +472,7 @@ impl<E: TElement> SequentialTask<E> {
|
|||
/// Executes this task.
|
||||
pub fn execute(self) {
|
||||
use self::SequentialTask::*;
|
||||
debug_assert!(thread_state::get() == ThreadState::LAYOUT);
|
||||
debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT);
|
||||
match self {
|
||||
Unused(_) => unreachable!(),
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -560,7 +560,7 @@ impl<E: TElement> SelectorFlagsMap<E> {
|
|||
|
||||
/// Applies the flags. Must be called on the main thread.
|
||||
fn apply_flags(&mut self) {
|
||||
debug_assert!(thread_state::get() == ThreadState::LAYOUT);
|
||||
debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT);
|
||||
self.cache.evict_all();
|
||||
for (el, flags) in self.map.drain() {
|
||||
unsafe { el.set_selector_flags(flags); }
|
||||
|
@ -598,7 +598,7 @@ where
|
|||
E: TElement,
|
||||
{
|
||||
fn drop(&mut self) {
|
||||
debug_assert!(thread_state::get() == ThreadState::LAYOUT);
|
||||
debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT);
|
||||
for task in self.0.drain(..) {
|
||||
task.execute()
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ impl<E: TElement> ThreadLocalStyleContext<E> {
|
|||
|
||||
impl<E: TElement> Drop for ThreadLocalStyleContext<E> {
|
||||
fn drop(&mut self) {
|
||||
debug_assert!(thread_state::get() == ThreadState::LAYOUT);
|
||||
debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT);
|
||||
|
||||
// Apply any slow selector flags that need to be set on parents.
|
||||
self.selector_flags.apply_flags();
|
||||
|
|
|
@ -369,7 +369,7 @@ impl MediaExpressionValue {
|
|||
|
||||
match for_expr.feature.mValueType {
|
||||
nsMediaFeature_ValueType::eLength => {
|
||||
debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Pixel);
|
||||
debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Pixel);
|
||||
let pixels = css_value.float_unchecked();
|
||||
Some(MediaExpressionValue::Length(Length::from_px(pixels)))
|
||||
}
|
||||
|
@ -379,17 +379,17 @@ impl MediaExpressionValue {
|
|||
Some(MediaExpressionValue::Integer(i as u32))
|
||||
}
|
||||
nsMediaFeature_ValueType::eFloat => {
|
||||
debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Number);
|
||||
debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Number);
|
||||
Some(MediaExpressionValue::Float(css_value.float_unchecked()))
|
||||
}
|
||||
nsMediaFeature_ValueType::eBoolInteger => {
|
||||
debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Integer);
|
||||
debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Integer);
|
||||
let i = css_value.integer_unchecked();
|
||||
debug_assert!(i == 0 || i == 1);
|
||||
Some(MediaExpressionValue::BoolInteger(i == 1))
|
||||
}
|
||||
nsMediaFeature_ValueType::eResolution => {
|
||||
debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Pixel);
|
||||
debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Pixel);
|
||||
Some(MediaExpressionValue::Resolution(Resolution::Dppx(css_value.float_unchecked())))
|
||||
}
|
||||
nsMediaFeature_ValueType::eEnumerated => {
|
||||
|
@ -397,7 +397,7 @@ impl MediaExpressionValue {
|
|||
Some(MediaExpressionValue::Enumerated(value))
|
||||
}
|
||||
nsMediaFeature_ValueType::eIdent => {
|
||||
debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Ident);
|
||||
debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_Ident);
|
||||
let string = unsafe {
|
||||
let buffer = *css_value.mValue.mString.as_ref();
|
||||
debug_assert!(!buffer.is_null());
|
||||
|
@ -774,11 +774,11 @@ impl Expression {
|
|||
one.to_dpi().partial_cmp(&actual_dpi).unwrap()
|
||||
}
|
||||
(&Ident(ref one), &Ident(ref other)) => {
|
||||
debug_assert!(self.feature.mRangeType != nsMediaFeature_RangeType::eMinMaxAllowed);
|
||||
debug_assert_ne!(self.feature.mRangeType, nsMediaFeature_RangeType::eMinMaxAllowed);
|
||||
return one == other;
|
||||
}
|
||||
(&Enumerated(one), &Enumerated(other)) => {
|
||||
debug_assert!(self.feature.mRangeType != nsMediaFeature_RangeType::eMinMaxAllowed);
|
||||
debug_assert_ne!(self.feature.mRangeType, nsMediaFeature_RangeType::eMinMaxAllowed);
|
||||
return one == other;
|
||||
}
|
||||
_ => unreachable!(),
|
||||
|
|
|
@ -378,7 +378,7 @@ pub unsafe trait CoordDataMut : CoordData {
|
|||
/// Gets the `Calc` value mutably, asserts in debug builds if the unit is
|
||||
/// not `Calc`.
|
||||
unsafe fn as_calc_mut(&mut self) -> &mut nsStyleCoord_Calc {
|
||||
debug_assert!(self.unit() == nsStyleUnit::eStyleUnit_Calc);
|
||||
debug_assert_eq!(self.unit(), nsStyleUnit::eStyleUnit_Calc);
|
||||
&mut *(*self.union().mPointer.as_mut() as *mut nsStyleCoord_Calc)
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ pub unsafe trait CoordData {
|
|||
/// Pretend inner value is a calc; obtain it.
|
||||
/// Ensure that the unit is Calc before calling this.
|
||||
unsafe fn get_calc_value(&self) -> nsStyleCoord_CalcValue {
|
||||
debug_assert!(self.unit() == nsStyleUnit::eStyleUnit_Calc);
|
||||
debug_assert_eq!(self.unit(), nsStyleUnit::eStyleUnit_Calc);
|
||||
(*self.as_calc())._base
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ pub unsafe trait CoordData {
|
|||
#[inline]
|
||||
/// Pretend the inner value is a calc expression, and obtain it.
|
||||
unsafe fn as_calc(&self) -> &nsStyleCoord_Calc {
|
||||
debug_assert!(self.unit() == nsStyleUnit::eStyleUnit_Calc);
|
||||
debug_assert_eq!(self.unit(), nsStyleUnit::eStyleUnit_Calc);
|
||||
&*(*self.union().mPointer.as_ref() as *const nsStyleCoord_Calc)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1213,7 +1213,7 @@ fn clone_single_transform_function(
|
|||
|
||||
let convert_shared_list_to_operations = |value: &structs::nsCSSValue|
|
||||
-> Vec<TransformOperation> {
|
||||
debug_assert!(value.mUnit == structs::nsCSSUnit::eCSSUnit_SharedList);
|
||||
debug_assert_eq!(value.mUnit, structs::nsCSSUnit::eCSSUnit_SharedList);
|
||||
let value_list = unsafe {
|
||||
value.mValue.mSharedList.as_ref()
|
||||
.as_mut().expect("List pointer should be non-null").mHead.as_ref()
|
||||
|
@ -1804,7 +1804,7 @@ fn static_assert() {
|
|||
use gecko_bindings::structs::nsStyleUnit;
|
||||
// z-index is never a calc(). If it were, we'd be leaking here, so
|
||||
// assert that it isn't.
|
||||
debug_assert!(self.gecko.mZIndex.unit() != nsStyleUnit::eStyleUnit_Calc);
|
||||
debug_assert_ne!(self.gecko.mZIndex.unit(), nsStyleUnit::eStyleUnit_Calc);
|
||||
unsafe {
|
||||
self.gecko.mZIndex.copy_from_unchecked(&other.gecko.mZIndex);
|
||||
}
|
||||
|
@ -1837,7 +1837,7 @@ fn static_assert() {
|
|||
}
|
||||
|
||||
pub fn set_computed_justify_items(&mut self, v: values::specified::JustifyItems) {
|
||||
debug_assert!(v.0 != ::values::specified::align::AlignFlags::AUTO);
|
||||
debug_assert_ne!(v.0, ::values::specified::align::AlignFlags::AUTO);
|
||||
self.gecko.mJustifyItems = v.into();
|
||||
}
|
||||
|
||||
|
@ -2885,7 +2885,7 @@ fn static_assert() {
|
|||
I::IntoIter: ExactSizeIterator + Clone
|
||||
{
|
||||
let v = v.into_iter();
|
||||
debug_assert!(v.len() != 0);
|
||||
debug_assert_ne!(v.len(), 0);
|
||||
let input_len = v.len();
|
||||
self.gecko.m${type.capitalize()}s.ensure_len(input_len);
|
||||
|
||||
|
@ -2910,7 +2910,7 @@ fn static_assert() {
|
|||
I::IntoIter: ExactSizeIterator + Clone
|
||||
{
|
||||
let v = v.into_iter();
|
||||
debug_assert!(v.len() != 0);
|
||||
debug_assert_ne!(v.len(), 0);
|
||||
let input_len = v.len();
|
||||
self.gecko.m${type.capitalize()}s.ensure_len(input_len);
|
||||
|
||||
|
@ -2966,7 +2966,7 @@ fn static_assert() {
|
|||
|
||||
let v = v.into_iter();
|
||||
|
||||
debug_assert!(v.len() != 0);
|
||||
debug_assert_ne!(v.len(), 0);
|
||||
let input_len = v.len();
|
||||
self.gecko.mAnimations.ensure_len(input_len);
|
||||
|
||||
|
@ -3364,7 +3364,7 @@ fn static_assert() {
|
|||
I::IntoIter: ExactSizeIterator
|
||||
{
|
||||
let v = v.into_iter();
|
||||
debug_assert!(v.len() != 0);
|
||||
debug_assert_ne!(v.len(), 0);
|
||||
self.gecko.mAnimations.ensure_len(v.len());
|
||||
|
||||
self.gecko.mAnimationNameCount = v.len() as u32;
|
||||
|
@ -3957,7 +3957,7 @@ fn static_assert() {
|
|||
if ty == DimensionType::eAuto as u8 {
|
||||
LengthOrPercentageOrAuto::Auto
|
||||
} else {
|
||||
debug_assert!(ty == DimensionType::eLengthPercentage as u8);
|
||||
debug_assert_eq!(ty, DimensionType::eLengthPercentage as u8);
|
||||
value.into()
|
||||
}
|
||||
}
|
||||
|
@ -3965,11 +3965,11 @@ fn static_assert() {
|
|||
longhands::background_size::computed_value::T(
|
||||
self.gecko.${image_layers_field}.mLayers.iter().map(|ref layer| {
|
||||
if DimensionType::eCover as u8 == layer.mSize.mWidthType {
|
||||
debug_assert!(layer.mSize.mHeightType == DimensionType::eCover as u8);
|
||||
debug_assert_eq!(layer.mSize.mHeightType, DimensionType::eCover as u8);
|
||||
return BackgroundSize::Cover
|
||||
}
|
||||
if DimensionType::eContain as u8 == layer.mSize.mWidthType {
|
||||
debug_assert!(layer.mSize.mHeightType == DimensionType::eContain as u8);
|
||||
debug_assert_eq!(layer.mSize.mHeightType, DimensionType::eContain as u8);
|
||||
return BackgroundSize::Contain
|
||||
}
|
||||
BackgroundSize::Explicit {
|
||||
|
@ -4368,28 +4368,28 @@ fn static_assert() {
|
|||
ClipRectOrAuto::auto()
|
||||
} else {
|
||||
let left = if self.gecko.mClipFlags & NS_STYLE_CLIP_LEFT_AUTO as u8 != 0 {
|
||||
debug_assert!(self.gecko.mClip.x == 0);
|
||||
debug_assert_eq!(self.gecko.mClip.x, 0);
|
||||
None
|
||||
} else {
|
||||
Some(Au(self.gecko.mClip.x).into())
|
||||
};
|
||||
|
||||
let top = if self.gecko.mClipFlags & NS_STYLE_CLIP_TOP_AUTO as u8 != 0 {
|
||||
debug_assert!(self.gecko.mClip.y == 0);
|
||||
debug_assert_eq!(self.gecko.mClip.y, 0);
|
||||
None
|
||||
} else {
|
||||
Some(Au(self.gecko.mClip.y).into())
|
||||
};
|
||||
|
||||
let bottom = if self.gecko.mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO as u8 != 0 {
|
||||
debug_assert!(self.gecko.mClip.height == 1 << 30); // NS_MAXSIZE
|
||||
debug_assert_eq!(self.gecko.mClip.height, 1 << 30); // NS_MAXSIZE
|
||||
None
|
||||
} else {
|
||||
Some(Au(self.gecko.mClip.y + self.gecko.mClip.height).into())
|
||||
};
|
||||
|
||||
let right = if self.gecko.mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO as u8 != 0 {
|
||||
debug_assert!(self.gecko.mClip.width == 1 << 30); // NS_MAXSIZE
|
||||
debug_assert_eq!(self.gecko.mClip.width, 1 << 30); // NS_MAXSIZE
|
||||
None
|
||||
} else {
|
||||
Some(Au(self.gecko.mClip.x + self.gecko.mClip.width).into())
|
||||
|
|
|
@ -303,7 +303,7 @@
|
|||
DeclaredValue::Value(value)
|
||||
},
|
||||
PropertyDeclaration::CSSWideKeyword(ref declaration) => {
|
||||
debug_assert!(declaration.id == LonghandId::${property.camel_case});
|
||||
debug_assert_eq!(declaration.id, LonghandId::${property.camel_case});
|
||||
DeclaredValue::CSSWideKeyword(declaration.keyword)
|
||||
},
|
||||
PropertyDeclaration::WithVariables(..) => {
|
||||
|
|
|
@ -55,7 +55,7 @@ impl Drop for RuleTree {
|
|||
unsafe { self.gc(); }
|
||||
|
||||
// After the GC, the free list should be empty.
|
||||
debug_assert!(self.root.get().next_free.load(Ordering::Relaxed) == FREE_LIST_SENTINEL);
|
||||
debug_assert_eq!(self.root.get().next_free.load(Ordering::Relaxed), FREE_LIST_SENTINEL);
|
||||
|
||||
// Remove the sentinel. This indicates that GCs will no longer occur.
|
||||
// Any further drops of StrongRuleNodes must occur on the main thread,
|
||||
|
@ -846,7 +846,7 @@ malloc_size_of_is_0!(StrongRuleNode);
|
|||
|
||||
impl StrongRuleNode {
|
||||
fn new(n: Box<RuleNode>) -> Self {
|
||||
debug_assert!(n.parent.is_none() == !n.source.is_some());
|
||||
debug_assert_eq!(n.parent.is_none(), !n.source.is_some());
|
||||
|
||||
let ptr = Box::into_raw(n);
|
||||
log_new(ptr);
|
||||
|
@ -1074,7 +1074,7 @@ impl StrongRuleNode {
|
|||
|
||||
me.free_count().store(0, Ordering::Relaxed);
|
||||
|
||||
debug_assert!(me.next_free.load(Ordering::Relaxed) == FREE_LIST_SENTINEL);
|
||||
debug_assert_eq!(me.next_free.load(Ordering::Relaxed), FREE_LIST_SENTINEL);
|
||||
}
|
||||
|
||||
unsafe fn maybe_gc(&self) {
|
||||
|
|
|
@ -998,7 +998,7 @@ impl Stylist {
|
|||
|
||||
// Gecko calls this from sequential mode, so we can directly apply
|
||||
// the flags.
|
||||
debug_assert!(thread_state::get() == ThreadState::LAYOUT);
|
||||
debug_assert_eq!(thread_state::get(), ThreadState::LAYOUT);
|
||||
let self_flags = flags.for_self();
|
||||
if !self_flags.is_empty() {
|
||||
unsafe { element.set_selector_flags(self_flags); }
|
||||
|
|
|
@ -71,7 +71,7 @@ impl ToCss for TextOverflow {
|
|||
W: Write,
|
||||
{
|
||||
if self.sides_are_logical {
|
||||
debug_assert!(self.first == TextOverflowSide::Clip);
|
||||
debug_assert_eq!(self.first, TextOverflowSide::Clip);
|
||||
self.second.to_css(dest)?;
|
||||
} else {
|
||||
self.first.to_css(dest)?;
|
||||
|
|
|
@ -315,7 +315,7 @@ impl Color {
|
|||
if let Some(unit) = unit {
|
||||
written += (&mut serialization[written..]).write(unit.as_bytes()).unwrap();
|
||||
}
|
||||
debug_assert!(written == 6);
|
||||
debug_assert_eq!(written, 6);
|
||||
parse_hash_color(&serialization).map_err(|()| {
|
||||
location.new_custom_error(StyleParseErrorKind::UnspecifiedError)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue