Auto merge of #23726 - servo:rustup, r=emilio

Upgrade to rustc 1.38.0-nightly (4b65a86eb 2019-07-15)

<del>This uses `MaybeUninit` in Stylo. `MaybeUninit` is stable in Rust 1.36.0, which Firefox [plans](https://wiki.mozilla.org/Rust_Update_Policy_for_Firefox) to require on 2019-06-18.</del>

Update: `MaybeUninit` in Stylo removed from this PR, after https://github.com/rust-lang/rust/pull/62599.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23726)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-07-17 08:56:27 -04:00 committed by GitHub
commit 25d8a6999b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 80 additions and 82 deletions

View file

@ -64,15 +64,15 @@ struct PosixSemaphore {
impl PosixSemaphore {
pub fn new(value: u32) -> io::Result<Self> {
let mut sem: libc::sem_t = unsafe { mem::uninitialized() };
let mut sem = mem::MaybeUninit::uninit();
let r = unsafe {
libc::sem_init(&mut sem, 0 /* not shared */, value)
libc::sem_init(sem.as_mut_ptr(), 0 /* not shared */, value)
};
if r == -1 {
return Err(io::Error::last_os_error());
}
Ok(PosixSemaphore {
sem: UnsafeCell::new(sem),
sem: UnsafeCell::new(unsafe { sem.assume_init() }),
})
}
@ -150,7 +150,7 @@ enum RegNum {
Sp = UNW_REG_SP as isize,
}
fn get_register(cursor: &mut unw_cursor_t, num: RegNum) -> Result<u64, i32> {
fn get_register(cursor: *mut unw_cursor_t, num: RegNum) -> Result<u64, i32> {
unsafe {
let mut val = 0;
let ret = unw_get_reg(cursor, num as i32, &mut val);
@ -162,7 +162,7 @@ fn get_register(cursor: &mut unw_cursor_t, num: RegNum) -> Result<u64, i32> {
}
}
fn step(cursor: &mut unw_cursor_t) -> Result<bool, i32> {
fn step(cursor: *mut unw_cursor_t) -> Result<bool, i32> {
unsafe {
// libunwind 1.1 seems to get confused and walks off the end of the stack. The last IP
// it reports is 0, so we'll stop if we're there.
@ -204,23 +204,23 @@ impl Sampler for LinuxSampler {
}
let context = unsafe { SHARED_STATE.context.load(Ordering::SeqCst) };
let mut cursor = unsafe { mem::uninitialized() };
let ret = unsafe { unw_init_local(&mut cursor, context) };
let mut cursor = mem::MaybeUninit::uninit();
let ret = unsafe { unw_init_local(cursor.as_mut_ptr(), context) };
let result = if ret == UNW_ESUCCESS {
let mut native_stack = NativeStack::new();
loop {
let ip = match get_register(&mut cursor, RegNum::Ip) {
let ip = match get_register(cursor.as_mut_ptr(), RegNum::Ip) {
Ok(ip) => ip,
Err(_) => break,
};
let sp = match get_register(&mut cursor, RegNum::Sp) {
let sp = match get_register(cursor.as_mut_ptr(), RegNum::Sp) {
Ok(sp) => sp,
Err(_) => break,
};
if native_stack
.process_register(ip as *mut _, sp as *mut _)
.is_err() ||
!step(&mut cursor).unwrap_or(false)
!step(cursor.as_mut_ptr()).unwrap_or(false)
{
break;
}

View file

@ -21,7 +21,7 @@ use dom_struct::dom_struct;
use mozangle::shaders::{BuiltInResources, Output, ShaderValidator};
use std::cell::Cell;
use std::os::raw::c_int;
use std::sync::{Once, ONCE_INIT};
use std::sync::Once;
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum ShaderCompilationStatus {
@ -42,7 +42,7 @@ pub struct WebGLShader {
compilation_status: Cell<ShaderCompilationStatus>,
}
static GLSLANG_INITIALIZATION: Once = ONCE_INIT;
static GLSLANG_INITIALIZATION: Once = Once::new();
impl WebGLShader {
fn new_inherited(context: &WebGLRenderingContext, id: WebGLShaderId, shader_type: u32) -> Self {

View file

@ -106,14 +106,16 @@ use script_traits::SWManagerSenders;
#[cfg(target_os = "linux")]
#[allow(unsafe_code)]
fn perform_platform_specific_initialization() {
use std::mem;
// 4096 is default max on many linux systems
const MAX_FILE_LIMIT: libc::rlim_t = 4096;
// Bump up our number of file descriptors to save us from impending doom caused by an onslaught
// of iframes.
unsafe {
let mut rlim: libc::rlimit = mem::uninitialized();
let mut rlim = libc::rlimit {
rlim_cur: 0,
rlim_max: 0,
};
match libc::getrlimit(libc::RLIMIT_NOFILE, &mut rlim) {
0 => {
if rlim.rlim_cur >= MAX_FILE_LIMIT {

View file

@ -22,6 +22,10 @@
#[macro_use]
extern crate rustc;
// Work around TLS failure: https://github.com/rust-lang/rust/issues/62717#issuecomment-511876555
#[allow(unused)]
extern crate rustc_driver;
extern crate rustc_plugin;
extern crate syntax;

View file

@ -161,7 +161,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnrootedPass {
.all(|a| !a.check_name(self.symbols.must_root))
{
for ref field in def.fields() {
let def_id = cx.tcx.hir().local_def_id_from_hir_id(field.hir_id);
let def_id = cx.tcx.hir().local_def_id(field.hir_id);
if is_unrooted_ty(&self.symbols, cx, cx.tcx.type_of(def_id), false) {
cx.span_lint(UNROOTED_MUST_ROOT, field.span,
"Type must be rooted, use #[must_root] on the struct definition to propagate")
@ -182,7 +182,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnrootedPass {
match var.node.data {
hir::VariantData::Tuple(ref fields, ..) => {
for ref field in fields {
let def_id = cx.tcx.hir().local_def_id_from_hir_id(field.hir_id);
let def_id = cx.tcx.hir().local_def_id(field.hir_id);
if is_unrooted_ty(&self.symbols, cx, cx.tcx.type_of(def_id), false) {
cx.span_lint(
UNROOTED_MUST_ROOT,
@ -215,7 +215,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnrootedPass {
};
if !in_derive_expn(span) {
let def_id = cx.tcx.hir().local_def_id_from_hir_id(id);
let def_id = cx.tcx.hir().local_def_id(id);
let sig = cx.tcx.type_of(def_id).fn_sig(cx.tcx);
for (arg, ty) in decl.inputs.iter().zip(sig.inputs().skip_binder().iter()) {

View file

@ -4,7 +4,7 @@
use rustc::hir::def_id::DefId;
use rustc::lint::LateContext;
use syntax::source_map::{ExpnFormat, Span};
use syntax::source_map::{ExpnKind, MacroKind, Span};
use syntax::symbol::Symbol;
/// check if a DefId's path matches the given absolute type path
@ -31,7 +31,7 @@ pub fn match_def_path(cx: &LateContext, def_id: DefId, path: &[Symbol]) -> bool
pub fn in_derive_expn(span: Span) -> bool {
if let Some(i) = span.ctxt().outer().expn_info() {
if let ExpnFormat::MacroAttribute(n) = i.format {
if let ExpnKind::Macro(MacroKind::Attr, n) = i.kind {
n.as_str().contains("derive")
} else {
false

View file

@ -185,7 +185,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for WebIdlPass {
_gen: &'tcx hir::Generics,
id: HirId,
) {
let def_id = cx.tcx.hir().local_def_id_from_hir_id(id);
let def_id = cx.tcx.hir().local_def_id(id);
if !is_webidl_ty(&self.symbols, cx, cx.tcx.type_of(def_id)) {
return;
}
@ -196,7 +196,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for WebIdlPass {
};
let parent_name = def.fields().iter().next().map(|field| {
let def_id = cx.tcx.hir().local_def_id_from_hir_id(field.hir_id);
let def_id = cx.tcx.hir().local_def_id(field.hir_id);
let ty = cx.tcx.type_of(def_id).to_string();
get_ty_name(&ty).to_string()
});