From 44163148c2fe2b6b92f1129a493e086ab5594d19 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Fri, 12 Apr 2019 13:49:41 +0200 Subject: [PATCH] Make use of RefCell::try_borrow_unguarded --- components/constellation/constellation.rs | 8 ++++++-- components/script/dom/bindings/cell.rs | 4 +++- components/script/dom/xmlhttprequest.rs | 2 -- components/script/lib.rs | 1 + components/style/error_reporting.rs | 1 - components/style/servo/selector_parser.rs | 1 - rust-toolchain | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 977155e6373..724891ab3f0 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -2030,6 +2030,10 @@ where None }; + // https://github.com/rust-lang/rust/issues/59159 + let browsing_context_size = browsing_context.size; + let browsing_context_is_visible = browsing_context.is_visible; + // Create the new pipeline, attached to the parent and push to pending changes self.new_pipeline( new_pipeline_id, @@ -2037,11 +2041,11 @@ where top_level_browsing_context_id, Some(parent_pipeline_id), None, - browsing_context.size, + browsing_context_size, load_data, load_info.sandbox, is_private, - browsing_context.is_visible, + browsing_context_is_visible, ); self.add_pending_change(SessionHistoryChange { top_level_browsing_context_id: top_level_browsing_context_id, diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index cccc172ee97..525ac069fe3 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -26,7 +26,9 @@ impl DomRefCell { #[allow(unsafe_code)] pub unsafe fn borrow_for_layout(&self) -> &T { debug_assert!(thread_state::get().is_layout()); - &*self.value.as_ptr() + self.value + .try_borrow_unguarded() + .expect("cell is mutably borrowed") } /// Borrow the contents for the purpose of script deallocation. diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index e0ba954964c..cb1d0d06196 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -1442,8 +1442,6 @@ impl XMLHttpRequest { fn filter_response_headers(&self) -> HeaderMap { // https://fetch.spec.whatwg.org/#concept-response-header-list - use http::header::{self, HeaderName}; - let mut headers = self.response_headers.borrow().clone(); headers.remove(header::SET_COOKIE); headers.remove(HeaderName::from_static("set-cookie2")); diff --git a/components/script/lib.rs b/components/script/lib.rs index 565cdbfc6c2..a057540ae22 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -4,6 +4,7 @@ #![cfg_attr(feature = "unstable", feature(core_intrinsics))] #![cfg_attr(feature = "unstable", feature(on_unimplemented))] +#![feature(borrow_state)] #![feature(const_fn)] #![feature(drain_filter)] #![feature(inner_deref)] diff --git a/components/style/error_reporting.rs b/components/style/error_reporting.rs index 04677c26041..6e63b0ad68a 100644 --- a/components/style/error_reporting.rs +++ b/components/style/error_reporting.rs @@ -245,7 +245,6 @@ impl ParseErrorReporter for RustLogReporter { location: SourceLocation, error: ContextualParseError, ) { - use log; if log_enabled!(log::Level::Info) { info!( "Url:\t{}\n{}:{} {}", diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs index d839654a65a..2c316b2deed 100644 --- a/components/style/servo/selector_parser.rs +++ b/components/style/servo/selector_parser.rs @@ -354,7 +354,6 @@ impl NonTSPseudoClass { /// selector matching, and it's set from the DOM. pub fn state_flag(&self) -> ElementState { use self::NonTSPseudoClass::*; - use crate::element_state::ElementState; match *self { Active => ElementState::IN_ACTIVE_STATE, Focus => ElementState::IN_FOCUS_STATE, diff --git a/rust-toolchain b/rust-toolchain index edaeac53761..0ca9244d5d0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2019-03-26 +nightly-2019-04-12