Skip to content

Commit 9fd6684

Browse files
authored
Auto merge of #26071 - servo:rustup, r=nox
Upgrade to rustc 1.44.0-nightly (42abbd887 2020-04-07) ~Blocked on rust-lang/rust#70280
2 parents 455a99c + 1c0549c commit 9fd6684

File tree

13 files changed

+40
-56
lines changed

13 files changed

+40
-56
lines changed

Xargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ std = { features = ["panic-unwind"] }
33

44
# https://github.com/rust-lang/rust/issues/65313
55
[target.aarch64-uwp-windows-msvc.dependencies]
6-
std = {}
6+
std = { features = ["panic-unwind"] }
77

components/canvas_traits/webgl_channel/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use servo_config::opts;
1515
use std::fmt;
1616

1717
lazy_static! {
18-
static ref IS_MULTIPROCESS: bool = { opts::multiprocess() };
18+
static ref IS_MULTIPROCESS: bool = opts::multiprocess();
1919
}
2020

2121
#[derive(Deserialize, Serialize)]

components/media/media_channel/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use servo_config::opts;
1313
use std::fmt;
1414

1515
lazy_static! {
16-
static ref IS_MULTIPROCESS: bool = { opts::multiprocess() };
16+
static ref IS_MULTIPROCESS: bool = opts::multiprocess();
1717
}
1818

1919
#[derive(Deserialize, Serialize)]

components/net/http_loader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use tokio::prelude::{future, Future, Stream};
5555
use tokio::runtime::Runtime;
5656

5757
lazy_static! {
58-
pub static ref HANDLE: Mutex<Runtime> = { Mutex::new(Runtime::new().unwrap()) };
58+
pub static ref HANDLE: Mutex<Runtime> = Mutex::new(Runtime::new().unwrap());
5959
}
6060

6161
/// The various states an entry of the HttpCache can be in.

components/net/tests/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use tokio::runtime::Runtime;
5151
use tokio_openssl::SslAcceptorExt;
5252

5353
lazy_static! {
54-
pub static ref HANDLE: Mutex<Runtime> = { Mutex::new(Runtime::new().unwrap()) };
54+
pub static ref HANDLE: Mutex<Runtime> = Mutex::new(Runtime::new().unwrap());
5555
}
5656

5757
const DEFAULT_USER_AGENT: &'static str = "Such Browser. Very Layout. Wow.";

components/script/script_thread.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -2017,11 +2017,11 @@ impl ScriptThread {
20172017
// occurs for the rest of the messages
20182018
match msg {
20192019
WebDriverScriptCommand::ExecuteScript(script, reply) => {
2020-
let window = { self.documents.borrow().find_window(pipeline_id) };
2020+
let window = self.documents.borrow().find_window(pipeline_id);
20212021
return webdriver_handlers::handle_execute_script(window, script, reply);
20222022
},
20232023
WebDriverScriptCommand::ExecuteAsyncScript(script, reply) => {
2024-
let window = { self.documents.borrow().find_window(pipeline_id) };
2024+
let window = self.documents.borrow().find_window(pipeline_id);
20252025
return webdriver_handlers::handle_execute_async_script(window, script, reply);
20262026
},
20272027
_ => (),
@@ -2289,7 +2289,7 @@ impl ScriptThread {
22892289
id: PipelineId,
22902290
scroll_states: &[(UntrustedNodeAddress, Vector2D<f32, LayoutPixel>)],
22912291
) {
2292-
let window = match { self.documents.borrow().find_window(id) } {
2292+
let window = match self.documents.borrow().find_window(id) {
22932293
Some(window) => window,
22942294
None => {
22952295
return warn!(
@@ -2696,7 +2696,7 @@ impl ScriptThread {
26962696
Some(r) => r,
26972697
None => return,
26982698
};
2699-
let window = match { self.documents.borrow().find_window(pipeline_id) } {
2699+
let window = match self.documents.borrow().find_window(pipeline_id) {
27002700
Some(window) => window,
27012701
None => return warn!("Registration failed for {}", scope),
27022702
};
@@ -2775,7 +2775,7 @@ impl ScriptThread {
27752775

27762776
/// Handles a request for the window title.
27772777
fn handle_get_title_msg(&self, pipeline_id: PipelineId) {
2778-
let document = match { self.documents.borrow().find_document(pipeline_id) } {
2778+
let document = match self.documents.borrow().find_document(pipeline_id) {
27792779
Some(document) => document,
27802780
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
27812781
};
@@ -2892,7 +2892,7 @@ impl ScriptThread {
28922892

28932893
/// Handles when layout thread finishes all animation in one tick
28942894
fn handle_tick_all_animations(&self, id: PipelineId) {
2895-
let document = match { self.documents.borrow().find_document(id) } {
2895+
let document = match self.documents.borrow().find_document(id) {
28962896
Some(document) => document,
28972897
None => return warn!("Message sent to closed pipeline {}.", id),
28982898
};
@@ -2977,7 +2977,7 @@ impl ScriptThread {
29772977
old_value: Option<String>,
29782978
new_value: Option<String>,
29792979
) {
2980-
let window = match { self.documents.borrow().find_window(pipeline_id) } {
2980+
let window = match self.documents.borrow().find_window(pipeline_id) {
29812981
None => return warn!("Storage event sent to closed pipeline {}.", pipeline_id),
29822982
Some(window) => window,
29832983
};
@@ -3380,7 +3380,7 @@ impl ScriptThread {
33803380
/// TODO: Actually perform DOM event dispatch.
33813381
fn handle_event(&self, pipeline_id: PipelineId, event: CompositorEvent) {
33823382
// Do not handle events if the pipeline exited.
3383-
let window = match { self.documents.borrow().find_window(pipeline_id) } {
3383+
let window = match self.documents.borrow().find_window(pipeline_id) {
33843384
Some(win) => win,
33853385
None => {
33863386
return warn!(
@@ -3424,7 +3424,7 @@ impl ScriptThread {
34243424
},
34253425

34263426
MouseMoveEvent(point, node_address, pressed_mouse_buttons) => {
3427-
let document = match { self.documents.borrow().find_document(pipeline_id) } {
3427+
let document = match self.documents.borrow().find_document(pipeline_id) {
34283428
Some(document) => document,
34293429
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
34303430
};
@@ -3517,15 +3517,15 @@ impl ScriptThread {
35173517
},
35183518

35193519
KeyboardEvent(key_event) => {
3520-
let document = match { self.documents.borrow().find_document(pipeline_id) } {
3520+
let document = match self.documents.borrow().find_document(pipeline_id) {
35213521
Some(document) => document,
35223522
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
35233523
};
35243524
document.dispatch_key_event(key_event);
35253525
},
35263526

35273527
CompositionEvent(composition_event) => {
3528-
let document = match { self.documents.borrow().find_document(pipeline_id) } {
3528+
let document = match self.documents.borrow().find_document(pipeline_id) {
35293529
Some(document) => document,
35303530
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
35313531
};
@@ -3546,7 +3546,7 @@ impl ScriptThread {
35463546
point_in_node: Option<Point2D<f32>>,
35473547
pressed_mouse_buttons: u16,
35483548
) {
3549-
let document = match { self.documents.borrow().find_document(pipeline_id) } {
3549+
let document = match self.documents.borrow().find_document(pipeline_id) {
35503550
Some(document) => document,
35513551
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
35523552
};
@@ -3569,7 +3569,7 @@ impl ScriptThread {
35693569
point: Point2D<f32>,
35703570
node_address: Option<UntrustedNodeAddress>,
35713571
) -> TouchEventResult {
3572-
let document = match { self.documents.borrow().find_document(pipeline_id) } {
3572+
let document = match self.documents.borrow().find_document(pipeline_id) {
35733573
Some(document) => document,
35743574
None => {
35753575
warn!("Message sent to closed pipeline {}.", pipeline_id);
@@ -3592,7 +3592,7 @@ impl ScriptThread {
35923592
point: Point2D<f32>,
35933593
node_address: Option<UntrustedNodeAddress>,
35943594
) {
3595-
let document = match { self.documents.borrow().find_document(pipeline_id) } {
3595+
let document = match self.documents.borrow().find_document(pipeline_id) {
35963596
Some(document) => document,
35973597
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
35983598
};
@@ -3664,7 +3664,7 @@ impl ScriptThread {
36643664
new_size: WindowSizeData,
36653665
size_type: WindowSizeType,
36663666
) {
3667-
let document = match { self.documents.borrow().find_document(pipeline_id) } {
3667+
let document = match self.documents.borrow().find_document(pipeline_id) {
36683668
Some(document) => document,
36693669
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
36703670
};

components/script_plugins/lib.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@
1919
#![feature(rustc_private)]
2020
#![cfg(feature = "unrooted_must_root_lint")]
2121

22-
extern crate rustc;
2322
extern crate rustc_ast;
2423
extern crate rustc_driver;
2524
extern crate rustc_hir;
2625
extern crate rustc_lint;
26+
extern crate rustc_middle;
2727
extern crate rustc_session;
2828
extern crate rustc_span;
2929

30-
use rustc::ty;
3130
use rustc_ast::ast::{AttrKind, Attribute};
3231
use rustc_driver::plugin::Registry;
3332
use rustc_hir::def_id::DefId;
3433
use rustc_hir::intravisit as visit;
3534
use rustc_hir::{self as hir, ExprKind, HirId};
3635
use rustc_lint::{LateContext, LateLintPass, LintContext, LintPass};
36+
use rustc_middle::ty;
3737
use rustc_session::declare_lint;
3838
use rustc_span::source_map;
3939
use rustc_span::source_map::{ExpnKind, MacroKind, Span};
@@ -101,8 +101,16 @@ fn has_lint_attr(sym: &Symbols, attrs: &[Attribute], name: Symbol) -> bool {
101101
/// Checks if a type is unrooted or contains any owned unrooted types
102102
fn is_unrooted_ty(sym: &Symbols, cx: &LateContext, ty: &ty::TyS, in_new_function: bool) -> bool {
103103
let mut ret = false;
104-
ty.maybe_walk(|t| {
105-
match t.kind {
104+
let mut walker = ty.walk();
105+
while let Some(generic_arg) = walker.next() {
106+
let t = match generic_arg.unpack() {
107+
rustc_middle::ty::subst::GenericArgKind::Type(t) => t,
108+
_ => {
109+
walker.skip_current_subtree();
110+
continue;
111+
},
112+
};
113+
let recur_into_subtree = match t.kind {
106114
ty::Adt(did, substs) => {
107115
let has_attr = |did, name| has_lint_attr(sym, &cx.tcx.get_attrs(did), name);
108116
if has_attr(did.did, sym.must_root) {
@@ -180,8 +188,11 @@ fn is_unrooted_ty(sym: &Symbols, cx: &LateContext, ty: &ty::TyS, in_new_function
180188
ty::FnDef(..) | ty::FnPtr(_) => false,
181189

182190
_ => true,
191+
};
192+
if !recur_into_subtree {
193+
walker.skip_current_subtree();
183194
}
184-
});
195+
}
185196
ret
186197
}
187198

@@ -298,7 +309,7 @@ struct FnDefVisitor<'a, 'b: 'a, 'tcx: 'a + 'b> {
298309
}
299310

300311
impl<'a, 'b, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'b, 'tcx> {
301-
type Map = rustc::hir::map::Map<'tcx>;
312+
type Map = rustc_middle::hir::map::Map<'tcx>;
302313

303314
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
304315
let cx = self.cx;

ports/glutin/events_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl EventsLoop {
9090
}
9191
EventLoop::Headless(ref data) => {
9292
let &(ref flag, ref condvar) = &**data;
93-
while { !*flag.lock().unwrap() } {
93+
while !*flag.lock().unwrap() {
9494
self.sleep(flag, condvar);
9595
if callback(glutin::Event::Awakened) == glutin::ControlFlow::Break {
9696
break;

ports/libsimpleservo/capi/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern "C" fn default_panic_handler(msg: *const c_char) {
3737
lazy_static! {
3838
static ref ON_PANIC: RwLock<extern "C" fn(*const c_char)> = RwLock::new(default_panic_handler);
3939
static ref SERVO_VERSION: CString =
40-
{ CString::new(simpleservo::servo_version()).expect("Can't create string") };
40+
CString::new(simpleservo::servo_version()).expect("Can't create string");
4141
}
4242

4343
#[no_mangle]

python/tidy/servo_tidy/tidy.py

-3
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,6 @@ def check_rust(file_name, lines):
625625
(r": &Root<", "use &T instead of &Root<T>", no_filter),
626626
(r": &DomRoot<", "use &T instead of &DomRoot<T>", no_filter),
627627
(r"^&&", "operators should go at the end of the first line", no_filter),
628-
# This particular pattern is not reentrant-safe in script_thread.rs
629-
(r"match self.documents.borrow", "use a separate variable for the match expression",
630-
lambda match, line: file_name.endswith('script_thread.rs')),
631628
# -> () is unnecessary
632629
(r"-> \(\)", "encountered function signature with -> ()", no_filter),
633630
]

python/tidy/servo_tidy_tests/script_thread.rs

-18
This file was deleted.

python/tidy/servo_tidy_tests/test_tidy.py

-6
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ def test_spec_link(self):
140140
self.assertEqual('method declared in webidl is missing a comment with a specification link', next(errors)[2])
141141
self.assertNoMoreErrors(errors)
142142

143-
def test_script_thread(self):
144-
errors = tidy.collect_errors_for_files(iterFile('script_thread.rs'), [], [tidy.check_rust], print_text=False)
145-
self.assertEqual('use a separate variable for the match expression', next(errors)[2])
146-
self.assertEqual('use a separate variable for the match expression', next(errors)[2])
147-
self.assertNoMoreErrors(errors)
148-
149143
def test_webidl(self):
150144
errors = tidy.collect_errors_for_files(iterFile('spec.webidl'), [tidy.check_webidl_spec], [], print_text=False)
151145
self.assertEqual('No specification link found.', next(errors)[2])

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2020-03-16
1+
nightly-2020-04-08

0 commit comments

Comments
 (0)