Compile Servo with the latest version of rust stable (#30831)

This completes the transition to compiling Servo with rust stable. Some
nightly-only features are still used when compiling the `script` and
`crown` crates, as well as for some style unit tests. These will likely
break with newer compiler versions, but `crown` can be disabled for them
conditionally. This is just the first step.

This has some caveats:

1. We need to disable setting up the special linker on Linux. The -Z
   option isn't supported with stable rust so using this is out --
   meanwhile we can't be sure that lld is installed on most systems.
2. `cargo fmt` still uses some unstable options, so we need to rely on
   the unstable toolchain just for running `fmt`. The idea is to fix this
   gradually.
This commit is contained in:
Martin Robinson 2023-12-06 18:36:07 +01:00 committed by GitHub
parent 9c443cf2c1
commit 7e82c5c957
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 76 additions and 78 deletions

View file

@ -586,10 +586,15 @@ impl StackingContext {
return;
};
let StackingContextContent::Fragment { fragment, scroll_node_id, containing_block, .. }
= first_stacking_context_fragment else {
debug_panic!("Expected a fragment, not a stacking container");
};
let StackingContextContent::Fragment {
fragment,
scroll_node_id,
containing_block,
..
} = first_stacking_context_fragment
else {
debug_panic!("Expected a fragment, not a stacking container");
};
let fragment = fragment.borrow();
let box_fragment = match &*fragment {
Fragment::Box(box_fragment) | Fragment::Float(box_fragment) => box_fragment,

View file

@ -3,7 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![deny(unsafe_code)]
#![feature(once_cell)]
mod cell;
pub mod context;

View file

@ -1241,7 +1241,7 @@ impl LayoutThread {
);
// Flush shadow roots stylesheets if dirty.
document.flush_shadow_roots_stylesheets(&mut self.stylist, guards.author.clone());
document.flush_shadow_roots_stylesheets(&mut self.stylist, guards.author);
let restyles = std::mem::take(&mut data.pending_restyles);
debug!("Draining restyles: {}", restyles.len());

View file

@ -913,7 +913,7 @@ impl LayoutThread {
}
// Flush shadow roots stylesheets if dirty.
document.flush_shadow_roots_stylesheets(&mut self.stylist, guards.author.clone());
document.flush_shadow_roots_stylesheets(&mut self.stylist, guards.author);
let restyles = std::mem::take(&mut data.pending_restyles);
debug!("Draining restyles: {}", restyles.len());

View file

@ -218,7 +218,7 @@ impl GPUDevice {
fn handle_error(&self, scope: ErrorScopeId, error: GPUError) {
let mut context = self.scope_context.borrow_mut();
if let Some(mut err_scope) = context.error_scopes.get_mut(&scope) {
if let Some(err_scope) = context.error_scopes.get_mut(&scope) {
if err_scope.error.is_none() {
err_scope.error = Some(error);
}
@ -229,7 +229,7 @@ impl GPUDevice {
fn try_remove_scope(&self, scope: ErrorScopeId) {
let mut context = self.scope_context.borrow_mut();
let remove = if let Some(mut err_scope) = context.error_scopes.get_mut(&scope) {
let remove = if let Some(err_scope) = context.error_scopes.get_mut(&scope) {
err_scope.op_count -= 1;
if let Some(ref promise) = err_scope.promise {
if !promise.is_fulfilled() {
@ -272,7 +272,7 @@ impl GPUDevice {
.find(|meta| !meta.popped.get())
.map(|meta| meta.id);
scope_id.and_then(|s_id| {
context.error_scopes.get_mut(&s_id).map(|mut scope| {
context.error_scopes.get_mut(&s_id).map(|scope| {
scope.op_count += 1;
s_id
})
@ -1107,7 +1107,7 @@ impl GPUDeviceMethods for GPUDevice {
promise.reject_error(Error::Operation);
return promise;
};
let remove = if let Some(mut err_scope) = context.error_scopes.get_mut(&scope_id) {
let remove = if let Some(err_scope) = context.error_scopes.get_mut(&scope_id) {
if let Some(ref e) = err_scope.error {
promise.resolve_native(e);
} else if err_scope.op_count == 0 {

View file

@ -5,7 +5,6 @@
// check-tidy: no specs after this line
use std::borrow::ToOwned;
use std::ptr;
use std::ptr::NonNull;
use std::rc::Rc;
@ -1043,11 +1042,7 @@ impl TestBindingMethods for TestBinding {
#[allow(unsafe_code)]
fn CrashHard(&self) {
static READ_ONLY_VALUE: i32 = 0;
unsafe {
let p: *mut u32 = &READ_ONLY_VALUE as *const _ as *mut _;
ptr::write_volatile(p, 0xbaadc0de);
}
unsafe { std::ptr::null_mut::<i32>().write(42) }
}
fn AdvanceClock(&self, ms: i32) {

View file

@ -2,8 +2,6 @@
* 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/. */
#![feature(once_cell)]
#![feature(plugin)]
#![feature(register_tool)]
#![deny(unsafe_code)]
#![doc = "The script crate contains all matters DOM."]

View file

@ -97,7 +97,7 @@ impl ScrollTreeNode {
&mut self,
scroll_location: ScrollLocation,
) -> Option<(ExternalScrollId, LayoutVector2D)> {
let mut info = match self.scroll_info {
let info = match self.scroll_info {
Some(ref mut data) => data,
None => return None,
};

View file

@ -155,7 +155,7 @@ fn test_scroll_tree_chain_through_overflow_hidden() {
.get_node_mut(&overflow_hidden_id)
.scroll_info
.as_mut()
.map(|mut info| {
.map(|info| {
info.scroll_sensitivity = ScrollSensitivity::Script;
});