Upgrade rustc to 1.83 (#34793)

* Upgrade rustc to 1.83

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix crown (change copied from linked clippy function)

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix named lifetime lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Bump shell.nix

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix non-local impl warnings

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Format with 1.83 formatting changes

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix manual non-local impl

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More fixes for crown

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix tidy

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_return lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix doc comment lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix missing wait lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow needless_lifetimes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* more doc comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More needless_returns

Signed-off-by: Nico Burns <nico@nicoburns.com>

* is_empty lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_lifetime lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fix div_ceil lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-minimal bool

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Non-local impl in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Missing wait in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fmt

Signed-off-by: Nico Burns <nico@nicoburns.com>

* remove useless lints table

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fixup comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-local definition in sandboxing code to simplify feature flagging

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Remove wait calls and allow zombie_processes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
This commit is contained in:
Nico Burns 2025-01-01 22:38:28 +13:00 committed by GitHub
parent d581acab3b
commit deb819f233
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 155 additions and 139 deletions

View file

@ -179,7 +179,7 @@ impl AudioBuffer {
*self.shared_channels.borrow_mut() = channels;
}
}
return self.shared_channels.borrow();
self.shared_channels.borrow()
}
}

View file

@ -2,6 +2,8 @@
* 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/. */
//! Generic finalizer implementations for DOM binding implementations.
use std::any::type_name;
use std::mem;
@ -12,8 +14,6 @@ use js::jsval::UndefinedValue;
use crate::dom::bindings::utils::finalize_global as do_finalize_global;
use crate::dom::bindings::weakref::{WeakBox, WeakReferenceable, DOM_WEAK_SLOT};
/// Generic finalizer implementations for DOM binding implementations.
pub unsafe fn finalize_common<T>(this: *const T) {
if !this.is_null() {
// The pointer can be null if the object is the unforgeable holder of that interface.

View file

@ -631,7 +631,7 @@ pub unsafe fn cross_origin_get_own_property_helper(
holder.handle_mut().into(),
);
return JS_GetOwnPropertyDescriptorById(*cx, holder.handle().into(), id, desc, is_none);
JS_GetOwnPropertyDescriptorById(*cx, holder.handle().into(), id, desc, is_none)
}
/// Implementation of [`CrossOriginPropertyFallback`].

View file

@ -483,9 +483,9 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement {
);
// Step 6
return Some(RadioNodeListOrElement::Element(DomRoot::from_ref(
Some(RadioNodeListOrElement::Element(DomRoot::from_ref(
element_node.downcast::<Element>().unwrap(),
)));
)))
}
// https://html.spec.whatwg.org/multipage/#dom-a-rel

View file

@ -293,7 +293,7 @@ fn parse_npt_seconds(s: &str) -> Result<f64, ()> {
fn parse_hms(s: &str) -> Result<f64, ()> {
let mut vec: VecDeque<&str> = s.split(':').collect();
vec.retain(|x| !x.eq(&""));
vec.retain(|x| !x.is_empty());
let result = match vec.len() {
1 => {

View file

@ -198,8 +198,8 @@ impl Performance {
self.resource_timing_buffer_size_limit.set(0);
}
/// Add a PerformanceObserver to the list of observers with a set of
/// observed entry types.
// Add a PerformanceObserver to the list of observers with a set of
// observed entry types.
pub fn add_multiple_type_observer(
&self,

View file

@ -219,11 +219,11 @@ enum ObservationState {
}
/// <https://drafts.csswg.org/resize-observer/#resizeobservation>
///
/// Note: `target` is kept out of here, to avoid having to root the `ResizeObservation`.
/// <https://drafts.csswg.org/resize-observer/#dom-resizeobservation-target>
#[derive(JSTraceable, MallocSizeOf)]
struct ResizeObservation {
/// <https://drafts.csswg.org/resize-observer/#dom-resizeobservation-target>
/// Note: `target` is kept out of here, to avoid having to root the `ResizeObservation`.
/// <https://drafts.csswg.org/resize-observer/#dom-resizeobservation-observedbox>
observed_box: RefCell<ResizeObserverBoxOptions>,
/// <https://drafts.csswg.org/resize-observer/#dom-resizeobservation-lastreportedsizes>

View file

@ -701,7 +701,10 @@ impl TreeSink for Sink {
}
type Handle = ParseNode;
type ElemName<'a> = ExpandedName<'a> where Self: 'a;
type ElemName<'a>
= ExpandedName<'a>
where
Self: 'a;
fn get_document(&self) -> Self::Handle {
self.document_node.clone()

View file

@ -1135,7 +1135,10 @@ impl TreeSink for Sink {
}
type Handle = Dom<Node>;
type ElemName<'a> = ExpandedName<'a> where Self: 'a;
type ElemName<'a>
= ExpandedName<'a>
where
Self: 'a;
#[allow(crown::unrooted_must_root)]
fn get_document(&self) -> Dom<Node> {

View file

@ -435,8 +435,8 @@ fn valid_compressed_data_len(
let block_width = compression.block_width as u32;
let block_height = compression.block_height as u32;
let required_blocks_hor = (width + block_width - 1) / block_width;
let required_blocks_ver = (height + block_height - 1) / block_height;
let required_blocks_hor = width.div_ceil(block_width);
let required_blocks_ver = height.div_ceil(block_height);
let required_blocks = required_blocks_hor * required_blocks_ver;
let required_bytes = required_blocks * compression.bytes_per_block as u32;

View file

@ -930,7 +930,7 @@ unsafe extern "C" fn getOwnPropertyDescriptor(
let mut slot = UndefinedValue();
GetProxyPrivate(proxy.get(), &mut slot);
rooted!(in(cx) let target = slot.to_object());
return JS_GetOwnPropertyDescriptorById(cx, target.handle().into(), id, desc, is_none);
JS_GetOwnPropertyDescriptorById(cx, target.handle().into(), id, desc, is_none)
}
#[allow(unsafe_code, non_snake_case)]

View file

@ -98,6 +98,71 @@ struct XHRContext {
url: ServoUrl,
}
impl FetchResponseListener for XHRContext {
fn process_request_body(&mut self, _: RequestId) {
// todo
}
fn process_request_eof(&mut self, _: RequestId) {
// todo
}
fn process_response(&mut self, _: RequestId, metadata: Result<FetchMetadata, NetworkError>) {
let xhr = self.xhr.root();
let rv = xhr.process_headers_available(self.gen_id, metadata, CanGc::note());
if rv.is_err() {
*self.sync_status.borrow_mut() = Some(rv);
}
}
fn process_response_chunk(&mut self, _: RequestId, chunk: Vec<u8>) {
self.xhr
.root()
.process_data_available(self.gen_id, chunk, CanGc::note());
}
fn process_response_eof(
&mut self,
_: RequestId,
response: Result<ResourceFetchTiming, NetworkError>,
) {
let rv = self.xhr.root().process_response_complete(
self.gen_id,
response.map(|_| ()),
CanGc::note(),
);
*self.sync_status.borrow_mut() = Some(rv);
}
fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming {
&mut self.resource_timing
}
fn resource_timing(&self) -> &ResourceFetchTiming {
&self.resource_timing
}
fn submit_resource_timing(&mut self) {
network_listener::submit_timing(self, CanGc::note())
}
}
impl ResourceTimingListener for XHRContext {
fn resource_timing_information(&self) -> (InitiatorType, ServoUrl) {
(InitiatorType::XMLHttpRequest, self.url.clone())
}
fn resource_timing_global(&self) -> DomRoot<GlobalScope> {
self.xhr.root().global()
}
}
impl PreInvoke for XHRContext {
fn should_invoke(&self) -> bool {
self.xhr.root().generation_id.get() == self.gen_id
}
}
#[derive(Clone)]
pub enum XHRProgress {
/// Notify that headers have been received
@ -234,75 +299,6 @@ impl XMLHttpRequest {
init: RequestBuilder,
cancellation_chan: ipc::IpcReceiver<()>,
) {
impl FetchResponseListener for XHRContext {
fn process_request_body(&mut self, _: RequestId) {
// todo
}
fn process_request_eof(&mut self, _: RequestId) {
// todo
}
fn process_response(
&mut self,
_: RequestId,
metadata: Result<FetchMetadata, NetworkError>,
) {
let xhr = self.xhr.root();
let rv = xhr.process_headers_available(self.gen_id, metadata, CanGc::note());
if rv.is_err() {
*self.sync_status.borrow_mut() = Some(rv);
}
}
fn process_response_chunk(&mut self, _: RequestId, chunk: Vec<u8>) {
self.xhr
.root()
.process_data_available(self.gen_id, chunk, CanGc::note());
}
fn process_response_eof(
&mut self,
_: RequestId,
response: Result<ResourceFetchTiming, NetworkError>,
) {
let rv = self.xhr.root().process_response_complete(
self.gen_id,
response.map(|_| ()),
CanGc::note(),
);
*self.sync_status.borrow_mut() = Some(rv);
}
fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming {
&mut self.resource_timing
}
fn resource_timing(&self) -> &ResourceFetchTiming {
&self.resource_timing
}
fn submit_resource_timing(&mut self) {
network_listener::submit_timing(self, CanGc::note())
}
}
impl ResourceTimingListener for XHRContext {
fn resource_timing_information(&self) -> (InitiatorType, ServoUrl) {
(InitiatorType::XMLHttpRequest, self.url.clone())
}
fn resource_timing_global(&self) -> DomRoot<GlobalScope> {
self.xhr.root().global()
}
}
impl PreInvoke for XHRContext {
fn should_invoke(&self) -> bool {
self.xhr.root().generation_id.get() == self.gen_id
}
}
global.fetch(init, context, task_source, Some(cancellation_chan));
}
}