mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Update to rust 1.85 (#35628)
* Update to rust 1.85 This is needed for cargo-deny Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Upgrade crown Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Clippy fixes Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Re-upgrade cargo-deny to 0.18 Keeping it locked to 0.18 just in case they update their required rustc version again Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
d78f7b2d78
commit
be6765447d
36 changed files with 88 additions and 105 deletions
3
.github/workflows/lint.yml
vendored
3
.github/workflows/lint.yml
vendored
|
@ -37,8 +37,7 @@ jobs:
|
||||||
uses: baptiste0928/cargo-install@v3
|
uses: baptiste0928/cargo-install@v3
|
||||||
with:
|
with:
|
||||||
crate: cargo-deny
|
crate: cargo-deny
|
||||||
# Version 0.18 requires rustc 1.85, but we are still using rustc 1.83.
|
version: 0.18
|
||||||
version: 0.17
|
|
||||||
locked: true
|
locked: true
|
||||||
- name: Bootstrap dependencies
|
- name: Bootstrap dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -216,10 +216,7 @@ impl PathBuilderRef<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn current_point(&mut self) -> Option<Point2D<f32>> {
|
fn current_point(&mut self) -> Option<Point2D<f32>> {
|
||||||
let inverse = match self.transform.inverse() {
|
let inverse = self.transform.inverse()?;
|
||||||
Some(i) => i,
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
self.builder
|
self.builder
|
||||||
.get_current_point()
|
.get_current_point()
|
||||||
.map(|point| inverse.transform_point(Point2D::new(point.x, point.y)))
|
.map(|point| inverse.transform_point(Point2D::new(point.x, point.y)))
|
||||||
|
@ -1404,7 +1401,7 @@ impl<'a> CanvasData<'a> {
|
||||||
let canvas_rect = Rect::from_size(canvas_size);
|
let canvas_rect = Rect::from_size(canvas_size);
|
||||||
if canvas_rect
|
if canvas_rect
|
||||||
.intersection(&read_rect)
|
.intersection(&read_rect)
|
||||||
.map_or(true, |rect| rect.is_empty())
|
.is_none_or(|rect| rect.is_empty())
|
||||||
{
|
{
|
||||||
return vec![];
|
return vec![];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2881,10 +2881,10 @@ fn image_to_tex_image_data(
|
||||||
for i in 0..pixel_count {
|
for i in 0..pixel_count {
|
||||||
let p = {
|
let p = {
|
||||||
let rgba = &pixels[i * 4..i * 4 + 4];
|
let rgba = &pixels[i * 4..i * 4 + 4];
|
||||||
(rgba[0] as u16 & 0xf0) << 8 |
|
((rgba[0] as u16 & 0xf0) << 8) |
|
||||||
(rgba[1] as u16 & 0xf0) << 4 |
|
((rgba[1] as u16 & 0xf0) << 4) |
|
||||||
(rgba[2] as u16 & 0xf0) |
|
(rgba[2] as u16 & 0xf0) |
|
||||||
(rgba[3] as u16 & 0xf0) >> 4
|
((rgba[3] as u16 & 0xf0) >> 4)
|
||||||
};
|
};
|
||||||
NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p);
|
NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p);
|
||||||
}
|
}
|
||||||
|
@ -2895,10 +2895,10 @@ fn image_to_tex_image_data(
|
||||||
for i in 0..pixel_count {
|
for i in 0..pixel_count {
|
||||||
let p = {
|
let p = {
|
||||||
let rgba = &pixels[i * 4..i * 4 + 4];
|
let rgba = &pixels[i * 4..i * 4 + 4];
|
||||||
(rgba[0] as u16 & 0xf8) << 8 |
|
((rgba[0] as u16 & 0xf8) << 8) |
|
||||||
(rgba[1] as u16 & 0xf8) << 3 |
|
((rgba[1] as u16 & 0xf8) << 3) |
|
||||||
(rgba[2] as u16 & 0xf8) >> 2 |
|
((rgba[2] as u16 & 0xf8) >> 2) |
|
||||||
(rgba[3] as u16) >> 7
|
((rgba[3] as u16) >> 7)
|
||||||
};
|
};
|
||||||
NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p);
|
NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p);
|
||||||
}
|
}
|
||||||
|
@ -2909,9 +2909,9 @@ fn image_to_tex_image_data(
|
||||||
for i in 0..pixel_count {
|
for i in 0..pixel_count {
|
||||||
let p = {
|
let p = {
|
||||||
let rgb = &pixels[i * 4..i * 4 + 3];
|
let rgb = &pixels[i * 4..i * 4 + 3];
|
||||||
(rgb[0] as u16 & 0xf8) << 8 |
|
((rgb[0] as u16 & 0xf8) << 8) |
|
||||||
(rgb[1] as u16 & 0xfc) << 3 |
|
((rgb[1] as u16 & 0xfc) << 3) |
|
||||||
(rgb[2] as u16 & 0xf8) >> 3
|
((rgb[2] as u16 & 0xf8) >> 3)
|
||||||
};
|
};
|
||||||
NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p);
|
NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p);
|
||||||
}
|
}
|
||||||
|
@ -3057,15 +3057,15 @@ fn premultiply_inplace(format: TexFormat, data_type: TexDataType, pixels: &mut [
|
||||||
(TexFormat::RGBA, TexDataType::UnsignedShort4444) => {
|
(TexFormat::RGBA, TexDataType::UnsignedShort4444) => {
|
||||||
for rgba in pixels.chunks_mut(2) {
|
for rgba in pixels.chunks_mut(2) {
|
||||||
let pix = NativeEndian::read_u16(rgba);
|
let pix = NativeEndian::read_u16(rgba);
|
||||||
let extend_to_8_bits = |val| (val | val << 4) as u8;
|
let extend_to_8_bits = |val| (val | (val << 4)) as u8;
|
||||||
let r = extend_to_8_bits(pix >> 12 & 0x0f);
|
let r = extend_to_8_bits((pix >> 12) & 0x0f);
|
||||||
let g = extend_to_8_bits(pix >> 8 & 0x0f);
|
let g = extend_to_8_bits((pix >> 8) & 0x0f);
|
||||||
let b = extend_to_8_bits(pix >> 4 & 0x0f);
|
let b = extend_to_8_bits((pix >> 4) & 0x0f);
|
||||||
let a = extend_to_8_bits(pix & 0x0f);
|
let a = extend_to_8_bits(pix & 0x0f);
|
||||||
NativeEndian::write_u16(
|
NativeEndian::write_u16(
|
||||||
rgba,
|
rgba,
|
||||||
((pixels::multiply_u8_color(r, a) & 0xf0) as u16) << 8 |
|
(((pixels::multiply_u8_color(r, a) & 0xf0) as u16) << 8) |
|
||||||
((pixels::multiply_u8_color(g, a) & 0xf0) as u16) << 4 |
|
(((pixels::multiply_u8_color(g, a) & 0xf0) as u16) << 4) |
|
||||||
((pixels::multiply_u8_color(b, a) & 0xf0) as u16) |
|
((pixels::multiply_u8_color(b, a) & 0xf0) as u16) |
|
||||||
((a & 0x0f) as u16),
|
((a & 0x0f) as u16),
|
||||||
);
|
);
|
||||||
|
|
|
@ -230,9 +230,7 @@ impl FontTemplateRefMethods for FontTemplateRef {
|
||||||
.descriptor
|
.descriptor
|
||||||
.unicode_range
|
.unicode_range
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(true, |ranges| {
|
.is_none_or(|ranges| ranges.iter().any(|range| range.contains(&character)))
|
||||||
ranges.iter().any(|range| range.contains(&character))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ impl DisplayList {
|
||||||
/// but has to be unique to the entire scene.
|
/// but has to be unique to the entire scene.
|
||||||
fn get_next_spatial_tree_item_key(&mut self) -> SpatialTreeItemKey {
|
fn get_next_spatial_tree_item_key(&mut self) -> SpatialTreeItemKey {
|
||||||
self.spatial_tree_count += 1;
|
self.spatial_tree_count += 1;
|
||||||
let pipeline_tag = (self.wr.pipeline_id.0 as u64) << 32 | self.wr.pipeline_id.1 as u64;
|
let pipeline_tag = ((self.wr.pipeline_id.0 as u64) << 32) | self.wr.pipeline_id.1 as u64;
|
||||||
SpatialTreeItemKey::new(pipeline_tag, self.spatial_tree_count)
|
SpatialTreeItemKey::new(pipeline_tag, self.spatial_tree_count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2072,7 +2072,7 @@ impl FlexItem<'_> {
|
||||||
(flex_axis == FlexAxis::Row && self.stretches());
|
(flex_axis == FlexAxis::Row && self.stretches());
|
||||||
|
|
||||||
let has_child_which_depends_on_block_constraints = fragments.iter().any(|fragment| {
|
let has_child_which_depends_on_block_constraints = fragments.iter().any(|fragment| {
|
||||||
fragment.base().map_or(false,|base|
|
fragment.base().is_some_and(|base|
|
||||||
base.flags.contains(
|
base.flags.contains(
|
||||||
FragmentFlags::SIZE_DEPENDS_ON_BLOCK_CONSTRAINTS_AND_CAN_BE_CHILD_OF_FLEX_ITEM))
|
FragmentFlags::SIZE_DEPENDS_ON_BLOCK_CONSTRAINTS_AND_CAN_BE_CHILD_OF_FLEX_ITEM))
|
||||||
});
|
});
|
||||||
|
|
|
@ -302,7 +302,7 @@ impl PositioningContext {
|
||||||
.is_empty() &&
|
.is_empty() &&
|
||||||
self.for_nearest_positioned_ancestor
|
self.for_nearest_positioned_ancestor
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(true, |vector| vector.is_empty())
|
.is_none_or(|vector| vector.is_empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn append(&mut self, other: Self) {
|
pub(crate) fn append(&mut self, other: Self) {
|
||||||
|
|
|
@ -176,11 +176,7 @@ impl Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_first_cell(&self, coords: TableSlotCoordinates) -> Option<&TableSlotCell> {
|
fn resolve_first_cell(&self, coords: TableSlotCoordinates) -> Option<&TableSlotCell> {
|
||||||
let resolved_coords = match self.resolve_first_cell_coords(coords) {
|
let resolved_coords = self.resolve_first_cell_coords(coords)?;
|
||||||
Some(coords) => coords,
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let slot = self.get_slot(resolved_coords);
|
let slot = self.get_slot(resolved_coords);
|
||||||
match slot {
|
match slot {
|
||||||
Some(TableSlot::Cell(cell)) => Some(cell),
|
Some(TableSlot::Cell(cell)) => Some(cell),
|
||||||
|
|
|
@ -183,7 +183,7 @@ impl ServoCookie {
|
||||||
let has_case_insensitive_prefix = |value: &str, prefix: &str| {
|
let has_case_insensitive_prefix = |value: &str, prefix: &str| {
|
||||||
value
|
value
|
||||||
.get(..prefix.len())
|
.get(..prefix.len())
|
||||||
.map_or(false, |p| p.eq_ignore_ascii_case(prefix))
|
.is_some_and(|p| p.eq_ignore_ascii_case(prefix))
|
||||||
};
|
};
|
||||||
if has_case_insensitive_prefix(cookie.name(), "__Secure-") &&
|
if has_case_insensitive_prefix(cookie.name(), "__Secure-") &&
|
||||||
!cookie.secure().unwrap_or(false)
|
!cookie.secure().unwrap_or(false)
|
||||||
|
|
|
@ -261,9 +261,7 @@ fn get_oldest_accessed(
|
||||||
if (c.cookie.secure().unwrap_or(false) == is_secure_cookie) &&
|
if (c.cookie.secure().unwrap_or(false) == is_secure_cookie) &&
|
||||||
oldest_accessed
|
oldest_accessed
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(true, |(_, current_oldest_time)| {
|
.is_none_or(|(_, current_oldest_time)| c.last_access < *current_oldest_time)
|
||||||
c.last_access < *current_oldest_time
|
|
||||||
})
|
|
||||||
{
|
{
|
||||||
oldest_accessed = Some((i, c.last_access));
|
oldest_accessed = Some((i, c.last_access));
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,14 +275,12 @@ impl Stream for BodyStream {
|
||||||
//
|
//
|
||||||
// The error can be safely ignored if we known that all content was received or is explicitly
|
// The error can be safely ignored if we known that all content was received or is explicitly
|
||||||
// set in preferences.
|
// set in preferences.
|
||||||
let all_content_read = self
|
let all_content_read = self.content_length.is_some_and(|c| c.0 == self.total_read);
|
||||||
.content_length
|
|
||||||
.map_or(false, |c| c.0 == self.total_read);
|
|
||||||
if self.is_secure_scheme && all_content_read {
|
if self.is_secure_scheme && all_content_read {
|
||||||
let source = err.source();
|
let source = err.source();
|
||||||
let is_unexpected_eof = source
|
let is_unexpected_eof = source
|
||||||
.and_then(|e| e.downcast_ref::<io::Error>())
|
.and_then(|e| e.downcast_ref::<io::Error>())
|
||||||
.map_or(false, |e| e.kind() == io::ErrorKind::UnexpectedEof);
|
.is_some_and(|e| e.kind() == io::ErrorKind::UnexpectedEof);
|
||||||
if is_unexpected_eof {
|
if is_unexpected_eof {
|
||||||
return Poll::Ready(None);
|
return Poll::Ready(None);
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,9 +392,9 @@ impl Mp4Matcher {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let box_size = ((data[0] as u32) << 24 |
|
let box_size = (((data[0] as u32) << 24) |
|
||||||
(data[1] as u32) << 16 |
|
((data[1] as u32) << 16) |
|
||||||
(data[2] as u32) << 8 |
|
((data[2] as u32) << 8) |
|
||||||
(data[3] as u32)) as usize;
|
(data[3] as u32)) as usize;
|
||||||
if (data.len() < box_size) || (box_size % 4 != 0) {
|
if (data.len() < box_size) || (box_size % 4 != 0) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -185,11 +185,11 @@ impl StorageManager {
|
||||||
let message = data
|
let message = data
|
||||||
.get_mut(&origin)
|
.get_mut(&origin)
|
||||||
.map(|&mut (ref mut total, ref mut entry)| {
|
.map(|&mut (ref mut total, ref mut entry)| {
|
||||||
let mut new_total_size = this_storage_size + value.as_bytes().len();
|
let mut new_total_size = this_storage_size + value.len();
|
||||||
if let Some(old_value) = entry.get(&name) {
|
if let Some(old_value) = entry.get(&name) {
|
||||||
new_total_size -= old_value.as_bytes().len();
|
new_total_size -= old_value.len();
|
||||||
} else {
|
} else {
|
||||||
new_total_size += name.as_bytes().len();
|
new_total_size += name.len();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_total_size + other_storage_size) > QUOTA_SIZE_LIMIT {
|
if (new_total_size + other_storage_size) > QUOTA_SIZE_LIMIT {
|
||||||
|
@ -245,7 +245,7 @@ impl StorageManager {
|
||||||
.get_mut(&origin)
|
.get_mut(&origin)
|
||||||
.and_then(|&mut (ref mut total, ref mut entry)| {
|
.and_then(|&mut (ref mut total, ref mut entry)| {
|
||||||
entry.remove(&name).inspect(|old| {
|
entry.remove(&name).inspect(|old| {
|
||||||
*total -= name.as_bytes().len() + old.as_bytes().len();
|
*total -= name.len() + old.len();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
sender.send(old_value).unwrap();
|
sender.send(old_value).unwrap();
|
||||||
|
|
|
@ -144,9 +144,7 @@ pub(crate) fn handle_get_children(
|
||||||
Some(parent) => {
|
Some(parent) => {
|
||||||
let is_whitespace = |node: &NodeInfo| {
|
let is_whitespace = |node: &NodeInfo| {
|
||||||
node.node_type == NodeConstants::TEXT_NODE &&
|
node.node_type == NodeConstants::TEXT_NODE &&
|
||||||
node.node_value
|
node.node_value.as_ref().is_none_or(|v| v.trim().is_empty())
|
||||||
.as_ref()
|
|
||||||
.map_or(true, |v| v.trim().is_empty())
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let inline: Vec<_> = parent
|
let inline: Vec<_> = parent
|
||||||
|
|
|
@ -1114,7 +1114,7 @@ impl Document {
|
||||||
if implicit_transaction {
|
if implicit_transaction {
|
||||||
self.begin_focus_transaction();
|
self.begin_focus_transaction();
|
||||||
}
|
}
|
||||||
if elem.map_or(true, |e| e.is_focusable_area()) {
|
if elem.is_none_or(|e| e.is_focusable_area()) {
|
||||||
*self.focus_transaction.borrow_mut() =
|
*self.focus_transaction.borrow_mut() =
|
||||||
FocusTransaction::InTransaction(elem.map(Dom::from_ref));
|
FocusTransaction::InTransaction(elem.map(Dom::from_ref));
|
||||||
}
|
}
|
||||||
|
@ -1795,7 +1795,7 @@ impl Document {
|
||||||
let target_has_changed = prev_mouse_over_target
|
let target_has_changed = prev_mouse_over_target
|
||||||
.get()
|
.get()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(true, |old_target| old_target != &new_target);
|
.is_none_or(|old_target| old_target != &new_target);
|
||||||
|
|
||||||
// Here we know the target has changed, so we must update the state,
|
// Here we know the target has changed, so we must update the state,
|
||||||
// dispatch mouseout to the previous one, mouseover to the new one.
|
// dispatch mouseout to the previous one, mouseover to the new one.
|
||||||
|
|
|
@ -1639,7 +1639,7 @@ pub(crate) trait FormControl: DomObject {
|
||||||
let has_form_attr = elem.has_attribute(&local_name!("form"));
|
let has_form_attr = elem.has_attribute(&local_name!("form"));
|
||||||
let same_subtree = self
|
let same_subtree = self
|
||||||
.form_owner()
|
.form_owner()
|
||||||
.map_or(true, |form| elem.is_in_same_home_subtree(&*form));
|
.is_none_or(|form| elem.is_in_same_home_subtree(&*form));
|
||||||
|
|
||||||
self.unregister_if_necessary();
|
self.unregister_if_necessary();
|
||||||
|
|
||||||
|
|
|
@ -837,10 +837,7 @@ impl HTMLInputElement {
|
||||||
},
|
},
|
||||||
// https://html.spec.whatwg.org/multipage/#file-upload-state-(type%3Dfile)%3Asuffering-from-being-missing
|
// https://html.spec.whatwg.org/multipage/#file-upload-state-(type%3Dfile)%3Asuffering-from-being-missing
|
||||||
InputType::File => {
|
InputType::File => {
|
||||||
self.Required() &&
|
self.Required() && self.filelist.get().is_none_or(|files| files.Length() == 0)
|
||||||
self.filelist
|
|
||||||
.get()
|
|
||||||
.map_or(true, |files| files.Length() == 0)
|
|
||||||
},
|
},
|
||||||
// https://html.spec.whatwg.org/multipage/#the-required-attribute%3Asuffering-from-being-missing
|
// https://html.spec.whatwg.org/multipage/#the-required-attribute%3Asuffering-from-being-missing
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -1317,7 +1317,7 @@ impl Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_display_none(&self) -> bool {
|
pub(crate) fn is_display_none(&self) -> bool {
|
||||||
self.style_data.borrow().as_ref().map_or(true, |data| {
|
self.style_data.borrow().as_ref().is_none_or(|data| {
|
||||||
data.element_data
|
data.element_data
|
||||||
.borrow()
|
.borrow()
|
||||||
.styles
|
.styles
|
||||||
|
@ -2184,8 +2184,7 @@ impl Node {
|
||||||
) {
|
) {
|
||||||
node.owner_doc().add_script_and_layout_blocker();
|
node.owner_doc().add_script_and_layout_blocker();
|
||||||
debug_assert!(*node.owner_doc() == *parent.owner_doc());
|
debug_assert!(*node.owner_doc() == *parent.owner_doc());
|
||||||
debug_assert!(child.map_or(true, |child| Some(parent) ==
|
debug_assert!(child.is_none_or(|child| Some(parent) == child.GetParentNode().as_deref()));
|
||||||
child.GetParentNode().as_deref()));
|
|
||||||
|
|
||||||
// Step 1.
|
// Step 1.
|
||||||
let count = if node.is::<DocumentFragment>() {
|
let count = if node.is::<DocumentFragment>() {
|
||||||
|
|
|
@ -78,10 +78,10 @@ impl PerformanceEntryList {
|
||||||
.entries
|
.entries
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|e| {
|
.filter(|e| {
|
||||||
name.as_ref().map_or(true, |name_| *e.name() == *name_) &&
|
name.as_ref().is_none_or(|name_| *e.name() == *name_) &&
|
||||||
entry_type
|
entry_type
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(true, |type_| *e.entry_type() == *type_)
|
.is_none_or(|type_| *e.entry_type() == *type_)
|
||||||
})
|
})
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<DomRoot<PerformanceEntry>>>();
|
.collect::<Vec<DomRoot<PerformanceEntry>>>();
|
||||||
|
|
|
@ -432,7 +432,7 @@ impl WebGLProgram {
|
||||||
|
|
||||||
let (size, type_) = {
|
let (size, type_) = {
|
||||||
let (base_name, array_index) = match parse_uniform_name(&name) {
|
let (base_name, array_index) = match parse_uniform_name(&name) {
|
||||||
Some((name, index)) if index.map_or(true, |i| i >= 0) => (name, index),
|
Some((name, index)) if index.is_none_or(|i| i >= 0) => (name, index),
|
||||||
_ => return Ok(None),
|
_ => return Ok(None),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -670,7 +670,7 @@ impl WebGLRenderingContext {
|
||||||
// or UNSIGNED_SHORT_5_5_5_1, a Uint16Array must be supplied.
|
// or UNSIGNED_SHORT_5_5_5_1, a Uint16Array must be supplied.
|
||||||
// or FLOAT, a Float32Array must be supplied.
|
// or FLOAT, a Float32Array must be supplied.
|
||||||
// If the types do not match, an INVALID_OPERATION error is generated.
|
// If the types do not match, an INVALID_OPERATION error is generated.
|
||||||
let data_type_matches = data.as_ref().map_or(true, |buffer| {
|
let data_type_matches = data.as_ref().is_none_or(|buffer| {
|
||||||
Some(data_type.sized_data_type()) ==
|
Some(data_type.sized_data_type()) ==
|
||||||
array_buffer_type_to_sized_type(buffer.get_array_type()) &&
|
array_buffer_type_to_sized_type(buffer.get_array_type()) &&
|
||||||
data_type.required_webgl_version() <= self.webgl_version()
|
data_type.required_webgl_version() <= self.webgl_version()
|
||||||
|
|
|
@ -349,7 +349,7 @@ impl WebSocketMethods<crate::DomTypeHolder> for WebSocket {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-websocket-send
|
// https://html.spec.whatwg.org/multipage/#dom-websocket-send
|
||||||
fn Send(&self, data: USVString) -> ErrorResult {
|
fn Send(&self, data: USVString) -> ErrorResult {
|
||||||
let data_byte_len = data.0.as_bytes().len() as u64;
|
let data_byte_len = data.0.len() as u64;
|
||||||
let send_data = self.send_impl(data_byte_len)?;
|
let send_data = self.send_impl(data_byte_len)?;
|
||||||
|
|
||||||
if send_data {
|
if send_data {
|
||||||
|
@ -417,7 +417,7 @@ impl WebSocketMethods<crate::DomTypeHolder> for WebSocket {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(ref reason) = reason {
|
if let Some(ref reason) = reason {
|
||||||
if reason.0.as_bytes().len() > 123 {
|
if reason.0.len() > 123 {
|
||||||
//reason cannot be larger than 123 bytes
|
//reason cannot be larger than 123 bytes
|
||||||
return Err(Error::Syntax);
|
return Err(Error::Syntax);
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ impl WritableStreamDefaultWriter {
|
||||||
if !self
|
if !self
|
||||||
.stream
|
.stream
|
||||||
.get()
|
.get()
|
||||||
.map_or(false, |current_stream| current_stream == stream)
|
.is_some_and(|current_stream| current_stream == stream)
|
||||||
{
|
{
|
||||||
let promise = Promise::new(global, can_gc);
|
let promise = Promise::new(global, can_gc);
|
||||||
promise.reject_error(Error::Type(
|
promise.reject_error(Error::Type(
|
||||||
|
|
|
@ -188,7 +188,7 @@ impl FetchResponseListener for StylesheetContext {
|
||||||
// else we risk applying the wrong stylesheet when responses come out-of-order.
|
// else we risk applying the wrong stylesheet when responses come out-of-order.
|
||||||
let is_stylesheet_load_applicable = self
|
let is_stylesheet_load_applicable = self
|
||||||
.request_generation_id
|
.request_generation_id
|
||||||
.map_or(true, |gen| gen == link.get_request_generation_id());
|
.is_none_or(|gen| gen == link.get_request_generation_id());
|
||||||
if is_stylesheet_load_applicable {
|
if is_stylesheet_load_applicable {
|
||||||
let shared_lock = document.style_shared_lock().clone();
|
let shared_lock = document.style_shared_lock().clone();
|
||||||
let sheet = Arc::new(Stylesheet::from_bytes(
|
let sheet = Arc::new(Stylesheet::from_bytes(
|
||||||
|
@ -375,7 +375,7 @@ impl StyleStylesheetLoader for StylesheetLoader<'_> {
|
||||||
layer: ImportLayer,
|
layer: ImportLayer,
|
||||||
) -> Arc<Locked<ImportRule>> {
|
) -> Arc<Locked<ImportRule>> {
|
||||||
// Ensure the supports conditions for this @import are true, if not, refuse to load
|
// Ensure the supports conditions for this @import are true, if not, refuse to load
|
||||||
if !supports.as_ref().map_or(true, |s| s.enabled) {
|
if !supports.as_ref().is_none_or(|s| s.enabled) {
|
||||||
return Arc::new(lock.wrap(ImportRule {
|
return Arc::new(lock.wrap(ImportRule {
|
||||||
url,
|
url,
|
||||||
stylesheet: ImportSheet::new_refused(),
|
stylesheet: ImportSheet::new_refused(),
|
||||||
|
|
|
@ -1001,7 +1001,7 @@ impl<T: ClipboardProvider> TextInput<T> {
|
||||||
|
|
||||||
/// Whether the content is empty.
|
/// Whether the content is empty.
|
||||||
pub(crate) fn is_empty(&self) -> bool {
|
pub(crate) fn is_empty(&self) -> bool {
|
||||||
self.lines.len() <= 1 && self.lines.first().map_or(true, |line| line.is_empty())
|
self.lines.len() <= 1 && self.lines.first().is_none_or(|line| line.is_empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The length of the content in bytes.
|
/// The length of the content in bytes.
|
||||||
|
|
|
@ -352,7 +352,7 @@ impl CoreFunction {
|
||||||
let min = self.min_args();
|
let min = self.min_args();
|
||||||
let max = self.max_args();
|
let max = self.max_args();
|
||||||
|
|
||||||
num_args >= min && max.map_or(true, |max| num_args <= max)
|
num_args >= min && max.is_none_or(|max| num_args <= max)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ impl HttpStatus {
|
||||||
|
|
||||||
/// Helper that relays is_success() from the underlying code.
|
/// Helper that relays is_success() from the underlying code.
|
||||||
pub fn is_success(&self) -> bool {
|
pub fn is_success(&self) -> bool {
|
||||||
StatusCode::from_u16(self.code).map_or(false, |s| s.is_success())
|
StatusCode::from_u16(self.code).is_ok_and(|s| s.is_success())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// True when the object was created with `new_error`.
|
/// True when the object was created with `new_error`.
|
||||||
|
|
|
@ -787,9 +787,9 @@ fn validate_range_header(value: &str) -> bool {
|
||||||
if let Some(start) = start {
|
if let Some(start) = start {
|
||||||
if let Ok(start_num) = start.parse::<u64>() {
|
if let Ok(start_num) = start.parse::<u64>() {
|
||||||
return match end {
|
return match end {
|
||||||
Some(e) if !e.is_empty() => e
|
Some(e) if !e.is_empty() => {
|
||||||
.parse::<u64>()
|
e.parse::<u64>().is_ok_and(|end_num| start_num <= end_num)
|
||||||
.map_or(false, |end_num| start_num <= end_num),
|
},
|
||||||
_ => true,
|
_ => true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl Dialog {
|
||||||
Arc::new(move |path: &Path| {
|
Arc::new(move |path: &Path| {
|
||||||
path.extension()
|
path.extension()
|
||||||
.and_then(|e| e.to_str())
|
.and_then(|e| e.to_str())
|
||||||
.map_or(false, |ext| {
|
.is_some_and(|ext| {
|
||||||
let ext = ext.to_lowercase();
|
let ext = ext.to_lowercase();
|
||||||
patterns.iter().any(|pattern| ext == pattern.0)
|
patterns.iter().any(|pattern| ext == pattern.0)
|
||||||
})
|
})
|
||||||
|
|
|
@ -126,7 +126,7 @@ impl Minibrowser {
|
||||||
self.last_mouse_position =
|
self.last_mouse_position =
|
||||||
Some(winit_position_to_euclid_point(*position).to_f32() / scale);
|
Some(winit_position_to_euclid_point(*position).to_f32() / scale);
|
||||||
self.last_mouse_position
|
self.last_mouse_position
|
||||||
.map_or(false, |p| self.is_in_browser_rect(p))
|
.is_some_and(|p| self.is_in_browser_rect(p))
|
||||||
},
|
},
|
||||||
WindowEvent::MouseInput {
|
WindowEvent::MouseInput {
|
||||||
state: ElementState::Pressed,
|
state: ElementState::Pressed,
|
||||||
|
@ -148,7 +148,7 @@ impl Minibrowser {
|
||||||
},
|
},
|
||||||
WindowEvent::MouseWheel { .. } | WindowEvent::MouseInput { .. } => self
|
WindowEvent::MouseWheel { .. } | WindowEvent::MouseInput { .. } => self
|
||||||
.last_mouse_position
|
.last_mouse_position
|
||||||
.map_or(false, |p| self.is_in_browser_rect(p)),
|
.is_some_and(|p| self.is_in_browser_rect(p)),
|
||||||
_ => true,
|
_ => true,
|
||||||
};
|
};
|
||||||
result
|
result
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
# Be sure to update shell.nix and support/crown/rust-toolchain.toml when bumping this!
|
# Be sure to update shell.nix and support/crown/rust-toolchain.toml when bumping this!
|
||||||
channel = "1.83.0"
|
channel = "1.85.0"
|
||||||
|
|
||||||
components = [
|
components = [
|
||||||
# For support/crown
|
# For support/crown
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.83.0"
|
channel = "1.85.0"
|
||||||
|
|
||||||
components = [
|
components = [
|
||||||
"clippy",
|
"clippy",
|
||||||
|
|
|
@ -9,7 +9,7 @@ use rustc_hir::{ImplItemRef, ItemKind, Node, OwnerId, PrimTy, TraitItemRef};
|
||||||
use rustc_infer::infer::TyCtxtInferExt;
|
use rustc_infer::infer::TyCtxtInferExt;
|
||||||
use rustc_lint::LateContext;
|
use rustc_lint::LateContext;
|
||||||
use rustc_middle::ty::fast_reject::SimplifiedType;
|
use rustc_middle::ty::fast_reject::SimplifiedType;
|
||||||
use rustc_middle::ty::{self, GenericArg, ParamEnv, Ty, TyCtxt, TypeVisitableExt};
|
use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt, TypeVisitableExt, TypingEnv};
|
||||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||||
use rustc_span::symbol::{Ident, Symbol};
|
use rustc_span::symbol::{Ident, Symbol};
|
||||||
use rustc_span::{Span, DUMMY_SP};
|
use rustc_span::{Span, DUMMY_SP};
|
||||||
|
@ -312,7 +312,7 @@ pub fn implements_trait<'tcx>(
|
||||||
) -> bool {
|
) -> bool {
|
||||||
implements_trait_with_env(
|
implements_trait_with_env(
|
||||||
cx.tcx,
|
cx.tcx,
|
||||||
cx.param_env,
|
cx.typing_env(),
|
||||||
ty,
|
ty,
|
||||||
trait_id,
|
trait_id,
|
||||||
ty_params.iter().map(|&arg| Some(arg)),
|
ty_params.iter().map(|&arg| Some(arg)),
|
||||||
|
@ -322,7 +322,7 @@ pub fn implements_trait<'tcx>(
|
||||||
/// Same as `implements_trait` but allows using a `ParamEnv` different from the lint context.
|
/// Same as `implements_trait` but allows using a `ParamEnv` different from the lint context.
|
||||||
pub fn implements_trait_with_env<'tcx>(
|
pub fn implements_trait_with_env<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env: ParamEnv<'tcx>,
|
typing_env: TypingEnv<'tcx>,
|
||||||
ty: ty::Ty<'tcx>,
|
ty: ty::Ty<'tcx>,
|
||||||
trait_id: DefId,
|
trait_id: DefId,
|
||||||
ty_params: impl IntoIterator<Item = Option<GenericArg<'tcx>>>,
|
ty_params: impl IntoIterator<Item = Option<GenericArg<'tcx>>>,
|
||||||
|
@ -331,7 +331,8 @@ pub fn implements_trait_with_env<'tcx>(
|
||||||
if ty.has_escaping_bound_vars() {
|
if ty.has_escaping_bound_vars() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let infcx = tcx.infer_ctxt().build();
|
|
||||||
|
let (infcx, param_env) = tcx.infer_ctxt().build_with_typing_env(typing_env);
|
||||||
let ty_params = tcx.mk_args_from_iter(
|
let ty_params = tcx.mk_args_from_iter(
|
||||||
ty_params
|
ty_params
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
|
@ -23,7 +23,6 @@ extern crate rustc_trait_selection;
|
||||||
extern crate rustc_type_ir;
|
extern crate rustc_type_ir;
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::ExitCode;
|
|
||||||
|
|
||||||
use rustc_driver::Callbacks;
|
use rustc_driver::Callbacks;
|
||||||
use rustc_interface::interface::Config;
|
use rustc_interface::interface::Config;
|
||||||
|
@ -61,7 +60,7 @@ impl Callbacks for MyCallbacks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() {
|
||||||
let handler =
|
let handler =
|
||||||
rustc_session::EarlyDiagCtxt::new(rustc_session::config::ErrorOutputType::default());
|
rustc_session::EarlyDiagCtxt::new(rustc_session::config::ErrorOutputType::default());
|
||||||
rustc_driver::init_logger(&handler, rustc_log::LoggerConfig::from_env("CROWN_LOG"));
|
rustc_driver::init_logger(&handler, rustc_log::LoggerConfig::from_env("CROWN_LOG"));
|
||||||
|
@ -76,8 +75,5 @@ fn main() -> ExitCode {
|
||||||
// Pass cfg(crown) to rustc
|
// Pass cfg(crown) to rustc
|
||||||
args.extend(["--cfg".to_owned(), "crown".to_owned()]);
|
args.extend(["--cfg".to_owned(), "crown".to_owned()]);
|
||||||
|
|
||||||
match rustc_driver::RunCompiler::new(&args, &mut MyCallbacks).run() {
|
rustc_driver::RunCompiler::new(&args, &mut MyCallbacks).run()
|
||||||
Ok(_) => ExitCode::SUCCESS,
|
|
||||||
Err(_) => ExitCode::FAILURE,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use rustc_ast::ast::{AttrKind, Attribute};
|
|
||||||
use rustc_ast::token::TokenKind;
|
use rustc_ast::token::TokenKind;
|
||||||
use rustc_ast::tokenstream::TokenTree;
|
use rustc_ast::tokenstream::TokenTree;
|
||||||
use rustc_ast::AttrArgs;
|
|
||||||
use rustc_error_messages::MultiSpan;
|
use rustc_error_messages::MultiSpan;
|
||||||
use rustc_hir::{self as hir};
|
use rustc_hir::{self as hir};
|
||||||
use rustc_lint::{LateContext, LateLintPass, LintContext, LintPass, LintStore};
|
use rustc_lint::{LateContext, LateLintPass, Lint, LintContext, LintPass, LintStore};
|
||||||
use rustc_middle::ty;
|
use rustc_middle::ty;
|
||||||
use rustc_session::declare_tool_lint;
|
use rustc_session::declare_tool_lint;
|
||||||
use rustc_span::symbol::Symbol;
|
use rustc_span::symbol::Symbol;
|
||||||
|
@ -59,26 +57,30 @@ impl LintPass for NotracePass {
|
||||||
fn name(&self) -> &'static str {
|
fn name(&self) -> &'static str {
|
||||||
"ServoNotracePass"
|
"ServoNotracePass"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_lints(&self) -> Vec<&'static Lint> {
|
||||||
|
vec![TRACE_IN_NO_TRACE, EMPTY_TRACE_IN_NO_TRACE]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_must_not_have_traceable(sym: &Symbols, attrs: &[Attribute]) -> Option<usize> {
|
fn get_must_not_have_traceable(sym: &Symbols, attrs: &[hir::Attribute]) -> Option<usize> {
|
||||||
attrs
|
attrs
|
||||||
.iter()
|
.iter()
|
||||||
.find(|attr| {
|
.find(|attr| {
|
||||||
matches!(
|
matches!(
|
||||||
&attr.kind,
|
&attr.kind,
|
||||||
AttrKind::Normal(normal)
|
hir::AttrKind::Normal(normal)
|
||||||
if normal.item.path.segments.len() == 3 &&
|
if normal.path.segments.len() == 3 &&
|
||||||
normal.item.path.segments[0].ident.name == sym.crown &&
|
normal.path.segments[0].name == sym.crown &&
|
||||||
normal.item.path.segments[1].ident.name == sym.trace_in_no_trace_lint &&
|
normal.path.segments[1].name == sym.trace_in_no_trace_lint &&
|
||||||
normal.item.path.segments[2].ident.name == sym.must_not_have_traceable
|
normal.path.segments[2].name == sym.must_not_have_traceable
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.map(|x| match &x.get_normal_item().args {
|
.map(|x| match &x.get_normal_item().args {
|
||||||
AttrArgs::Empty => 0,
|
hir::AttrArgs::Empty => 0,
|
||||||
AttrArgs::Delimited(a) => match a
|
hir::AttrArgs::Delimited(a) => match a
|
||||||
.tokens
|
.tokens
|
||||||
.trees()
|
.iter()
|
||||||
.next()
|
.next()
|
||||||
.expect("Arguments not found for must_not_have_traceable")
|
.expect("Arguments not found for must_not_have_traceable")
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use rustc_hir::{self as hir, intravisit as visit, ExprKind};
|
use rustc_hir::{self as hir, intravisit as visit, ExprKind};
|
||||||
use rustc_lint::{LateContext, LateLintPass, LintContext, LintPass, LintStore};
|
use rustc_lint::{LateContext, LateLintPass, Lint, LintContext, LintPass, LintStore};
|
||||||
use rustc_middle::ty;
|
use rustc_middle::ty;
|
||||||
use rustc_session::declare_tool_lint;
|
use rustc_session::declare_tool_lint;
|
||||||
use rustc_span::def_id::{DefId, LocalDefId};
|
use rustc_span::def_id::{DefId, LocalDefId};
|
||||||
|
@ -217,6 +217,10 @@ impl LintPass for UnrootedPass {
|
||||||
fn name(&self) -> &'static str {
|
fn name(&self) -> &'static str {
|
||||||
"ServoUnrootedPass"
|
"ServoUnrootedPass"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_lints(&self) -> Vec<&'static Lint> {
|
||||||
|
vec![UNROOTED_MUST_ROOT]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> LateLintPass<'tcx> for UnrootedPass {
|
impl<'tcx> LateLintPass<'tcx> for UnrootedPass {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue