From fbfe86fffe2935f4d2c4d7456fd613de126b1430 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 15 Apr 2020 15:01:46 +0200 Subject: [PATCH 1/4] =?UTF-8?q?Remove=20unused=20`#![feature(=E2=80=A6)]`?= =?UTF-8?q?=20attributes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/script/lib.rs | 1 - components/script_layout_interface/lib.rs | 1 - ports/glutin/main.rs | 2 -- 3 files changed, 4 deletions(-) diff --git a/components/script/lib.rs b/components/script/lib.rs index 07090f4716b..996480cff53 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -7,7 +7,6 @@ #![feature(const_transmute)] #![feature(core_intrinsics)] #![feature(drain_filter)] -#![feature(inner_deref)] #![feature(plugin)] #![feature(register_tool)] #![deny(unsafe_code)] diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs index 651c0815f9f..374c650986d 100644 --- a/components/script_layout_interface/lib.rs +++ b/components/script_layout_interface/lib.rs @@ -7,7 +7,6 @@ //! to depend on script. #![deny(unsafe_code)] -#![feature(box_into_raw_non_null)] #[macro_use] extern crate html5ever; diff --git a/ports/glutin/main.rs b/ports/glutin/main.rs index 50da58121bc..85c237c55db 100644 --- a/ports/glutin/main.rs +++ b/ports/glutin/main.rs @@ -15,8 +15,6 @@ //! //! [glutin]: https://github.com/tomaka/glutin -#![feature(core_intrinsics)] - #[cfg(not(target_os = "android"))] include!("main2.rs"); From 7861b0be7900df6c7dbf8d4dac8ba14a8d4e3a56 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 15 Apr 2020 15:10:11 +0200 Subject: [PATCH 2/4] Remove use of soon-to-be-deprecated unstable feature https://github.com/rust-lang/rust/issues/47336#issuecomment-586589016 --- components/script/dom/bindings/root.rs | 2 +- components/script/lib.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 4f4d376e951..59f9b964564 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -383,7 +383,7 @@ where #[allow(unrooted_must_root)] pub unsafe fn from_box(value: Box) -> Self { Self { - ptr: Box::into_raw_non_null(value), + ptr: Box::leak(value).into(), } } } diff --git a/components/script/lib.rs b/components/script/lib.rs index 996480cff53..8637411d89c 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -2,7 +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(box_into_raw_non_null)] #![feature(const_fn)] #![feature(const_transmute)] #![feature(core_intrinsics)] From 7f975c3d5d1a9b36a05736a7b6425b56a73ef760 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 15 Apr 2020 15:17:52 +0200 Subject: [PATCH 3/4] Remove use of some other unstable features --- components/layout_2020/flow/inline.rs | 8 ++++++-- components/layout_2020/flow/mod.rs | 3 ++- components/layout_2020/lib.rs | 2 -- components/layout_2020/positioned.rs | 6 +++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs index 040b4c3f3cf..c129582a358 100644 --- a/components/layout_2020/flow/inline.rs +++ b/components/layout_2020/flow/inline.rs @@ -303,7 +303,11 @@ impl InlineFormattingContext { panic!("display:none does not generate an abspos box") }, }; - let hoisted_box = box_.clone().to_hoisted(initial_start_corner, tree_rank); + let hoisted_box = AbsolutelyPositionedBox::to_hoisted( + box_.clone(), + initial_start_corner, + tree_rank, + ); let hoisted_fragment = hoisted_box.fragment.clone(); ifc.push_hoisted_box_to_positioning_context(hoisted_box); ifc.current_nesting_level.fragments_so_far.push( @@ -786,7 +790,7 @@ impl TextRun { glyphs, text_decoration_line: ifc.current_nesting_level.text_decoration_line, })); - if runs.is_empty() { + if runs.as_slice().is_empty() { break; } else { // New line diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 33bba78de96..eb4a03be62e 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -315,7 +315,8 @@ impl BlockLevelBox { )) }, BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(box_) => { - let hoisted_box = box_.clone().to_hoisted(Vec2::zero(), tree_rank); + let hoisted_box = + AbsolutelyPositionedBox::to_hoisted(box_.clone(), Vec2::zero(), tree_rank); let hoisted_fragment = hoisted_box.fragment.clone(); positioning_context.push(hoisted_box); Fragment::AbsoluteOrFixedPositioned(AbsoluteOrFixedPositionedFragment { diff --git a/components/layout_2020/lib.rs b/components/layout_2020/lib.rs index 6b7a08ec29b..be5008035a5 100644 --- a/components/layout_2020/lib.rs +++ b/components/layout_2020/lib.rs @@ -3,8 +3,6 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #![deny(unsafe_code)] -#![feature(arbitrary_self_types)] -#![feature(exact_size_is_empty)] #[macro_use] extern crate serde; diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs index 899b2b39e61..cb71ad521c4 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout_2020/positioned.rs @@ -100,7 +100,7 @@ impl AbsolutelyPositionedBox { } pub(crate) fn to_hoisted( - self: Arc, + self_: Arc, initial_start_corner: Vec2, tree_rank: usize, ) -> HoistedAbsolutelyPositionedBox { @@ -124,7 +124,7 @@ impl AbsolutelyPositionedBox { } } - let box_offsets = self.contents.style.box_offsets(); + let box_offsets = self_.contents.style.box_offsets(); HoistedAbsolutelyPositionedBox { tree_rank, box_offsets: Vec2 { @@ -140,7 +140,7 @@ impl AbsolutelyPositionedBox { ), }, fragment: ArcRefCell::new(None), - absolutely_positioned_box: self, + absolutely_positioned_box: self_, } } } From 6175a68c102218d0de18b67343ad14cfc193b18d Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 15 Apr 2020 17:54:04 +0200 Subject: [PATCH 4/4] Replace a `transmute` with `.to_ne_bytes()` + constructor --- components/script/dom/bindings/codegen/CodegenRust.py | 9 +++++---- components/script/lib.rs | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 3c9555ba659..021757a4ad1 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -3992,8 +3992,8 @@ class CGMemberJITInfo(CGThing): protoID: PrototypeList::ID::${name} as u16, }, __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: ${depth} }, - _bitfield_1: unsafe { - mem::transmute(new_jsjitinfo_bitfield_1!( + _bitfield_1: __BindgenBitfieldUnit::new( + new_jsjitinfo_bitfield_1!( JSJitInfo_OpType::${opType} as u8, JSJitInfo_AliasSet::${aliasSet} as u8, JSValueType::${returnType} as u8, @@ -4004,8 +4004,8 @@ class CGMemberJITInfo(CGThing): ${isLazilyCachedInSlot}, ${isTypedMethod}, ${slotIndex}, - )) - }, + ).to_ne_bytes() + ), } """, opName=opName, @@ -5988,6 +5988,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries 'js::error::throw_type_error', 'js::error::throw_internal_error', 'js::rust::wrappers::Call', + 'js::jsapi::__BindgenBitfieldUnit', 'js::jsapi::CallArgs', 'js::jsapi::CurrentGlobalOrNull', 'js::rust::wrappers::GetPropertyKeys', diff --git a/components/script/lib.rs b/components/script/lib.rs index 8637411d89c..4eeca229e01 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -3,7 +3,6 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #![feature(const_fn)] -#![feature(const_transmute)] #![feature(core_intrinsics)] #![feature(drain_filter)] #![feature(plugin)]