Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 17 pull requests #59921

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
968ea1c
Mark variables captured by reference as mutable correctly
matthewjasper Apr 4, 2019
fd7f605
Increase `Span` from 4 bytes to 8 bytes.
nnethercote Apr 4, 2019
63080b3
remove lookup_char_pos_adj
matklad Apr 5, 2019
1c3979c
Add book.toml to tools/unstable, add copy_book_toml to scipt
Apr 6, 2019
5ddb339
Remove copy_book_toml method in favor for copy_recursive
Apr 6, 2019
280277a
path -> from
Apr 6, 2019
2f948ea
Limit dylib symbols
Zoxc Apr 6, 2019
34c1572
Change root path for unstable-book
Apr 7, 2019
b8e9da7
`asm!` output can neither be promotable nor const
oli-obk Apr 8, 2019
6b01844
Generalize initial "not const" assignments
oli-obk Apr 8, 2019
ec52065
Explicit promotion is indistinguishable from explicit promotion
oli-obk Apr 8, 2019
d3d5673
Get rid of "is not const" naming
oli-obk Apr 8, 2019
c63b9ff
Pacify tidy
oli-obk Apr 8, 2019
ae4717d
Elaborate on implicit promotability
oli-obk Apr 8, 2019
03727a4
Clean up jobserver integration
Zoxc Apr 8, 2019
1ad46cd
Fix links on keyword docs.
ehuss Apr 9, 2019
6635fbe
Eliminate `FnBox` usages from libstd.
crlf0710 Apr 9, 2019
2f97552
Re-export NonZero signed variant in std
tesuji Apr 10, 2019
404df31
Update ui test
tesuji Apr 10, 2019
f10394a
Documentation should have proper grammar
oli-obk Apr 10, 2019
acf3ddb
std: Add `{read,write}_vectored` for more types
alexcrichton Apr 10, 2019
825a11e
Fix attributes position in type declaration
GuillaumeGomez Apr 10, 2019
d7f5c50
make duplicate matcher bindings a hard error
mark-i-m Mar 28, 2019
6fd3f5a
forgot one
mark-i-m Apr 11, 2019
22f2afe
Use SecRandomCopyBytes instead of /dev/urandom on MacOS
ebarnard Apr 11, 2019
e149dc0
remove warn
mark-i-m Apr 11, 2019
ca1ab3e
In `-Zprint-type-size` output, sort enum variants by size.
nnethercote Apr 12, 2019
1ce6645
MaybeUninit: remove deprecated functions
RalfJung Apr 12, 2019
fc928a1
Stabilize the `alloc` crate.
SimonSapin Apr 3, 2019
e728ee0
Rollup merge of #59675 - SimonSapin:stable-alloc, r=alexcrichton
Centril Apr 12, 2019
dcbbb1b
Rollup merge of #59693 - nnethercote:64-bit-Spans, r=petrochenkov
Centril Apr 12, 2019
aa687ed
Rollup merge of #59708 - matthewjasper:double-closure-unused-mut, r=p…
Centril Apr 12, 2019
927c7cf
Rollup merge of #59735 - matklad:deadcode, r=sanxiyn
Centril Apr 12, 2019
ef08a1c
Rollup merge of #59747 - gruberb:copy-book-toml-unstable-book, r=ehuss
Centril Apr 12, 2019
968b1e5
Rollup merge of #59752 - Zoxc:dylib-fix, r=michaelwoerister
Centril Apr 12, 2019
eb29fd0
Rollup merge of #59796 - oli-obk:const_arg_ice, r=eddyb
Centril Apr 12, 2019
85c7cc2
Rollup merge of #59804 - Zoxc:cleaner-jobserver, r=alexcrichton
Centril Apr 12, 2019
66548ae
Rollup merge of #59818 - crlf0710:eliminate_libstd_fnbox, r=cramertj
Centril Apr 12, 2019
4b160ef
Rollup merge of #59830 - ehuss:keyword-links, r=Mark-Simulacrum
Centril Apr 12, 2019
2a24c8f
Rollup merge of #59835 - lzutao:nonzero-signed, r=Mark-Simulacrum
Centril Apr 12, 2019
23c824e
Rollup merge of #59852 - alexcrichton:more-vectored, r=sfackler
Centril Apr 12, 2019
6218a44
Rollup merge of #59855 - GuillaumeGomez:fix-attr-position-in-type-dec…
Centril Apr 12, 2019
1ccd4cd
Rollup merge of #59858 - mark-i-m:dup-matcher-bindings-3, r=Centril
Centril Apr 12, 2019
020ed28
Rollup merge of #59879 - ebarnard:patch-1, r=alexcrichton
Centril Apr 12, 2019
c07ccc4
Rollup merge of #59899 - nnethercote:sort-enum-variants-by-size, r=pn…
Centril Apr 12, 2019
910c719
Rollup merge of #59912 - RalfJung:maybe-uninit, r=Centril
Centril Apr 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/doc/unstable-book/book.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[book]
title = "The Rust Unstable Book"
author = "The Rust Community"
5 changes: 1 addition & 4 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@
//! default global allocator. It is not compatible with the libc allocator API.

#![allow(unused_attributes)]
#![unstable(feature = "alloc",
reason = "this library is unlikely to be stabilized in its current \
form or name",
issue = "27783")]
#![stable(feature = "alloc", since = "1.36.0")]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/prelude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//!
//! ```
//! # #![allow(unused_imports)]
//! # #![feature(alloc)]
//! #![feature(alloc_prelude)]
//! extern crate alloc;
//! use alloc::prelude::v1::*;
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl<T, A: Alloc> RawVec<T, A> {
/// # Examples
///
/// ```
/// # #![feature(alloc, raw_vec_internals)]
/// # #![feature(raw_vec_internals)]
/// # extern crate alloc;
/// # use std::ptr;
/// # use alloc::raw_vec::RawVec;
Expand Down Expand Up @@ -460,7 +460,7 @@ impl<T, A: Alloc> RawVec<T, A> {
/// # Examples
///
/// ```
/// # #![feature(alloc, raw_vec_internals)]
/// # #![feature(raw_vec_internals)]
/// # extern crate alloc;
/// # use std::ptr;
/// # use alloc::raw_vec::RawVec;
Expand Down
1 change: 0 additions & 1 deletion src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]

#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(raw_vec_internals)]
Expand Down
34 changes: 0 additions & 34 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1152,15 +1152,6 @@ impl<T> MaybeUninit<T> {
MaybeUninit { uninit: () }
}

/// Deprecated before stabilization.
#[unstable(feature = "maybe_uninit", issue = "53491")]
#[inline(always)]
// FIXME: still used by stdsimd
// #[rustc_deprecated(since = "1.35.0", reason = "use `uninit` instead")]
pub const fn uninitialized() -> MaybeUninit<T> {
Self::uninit()
}

/// Creates a new `MaybeUninit<T>` in an uninitialized state, with the memory being
/// filled with `0` bytes. It depends on `T` whether that already makes for
/// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized,
Expand Down Expand Up @@ -1221,14 +1212,6 @@ impl<T> MaybeUninit<T> {
}
}

/// Deprecated before stabilization.
#[unstable(feature = "maybe_uninit", issue = "53491")]
#[inline(always)]
#[rustc_deprecated(since = "1.35.0", reason = "use `write` instead")]
pub fn set(&mut self, val: T) -> &mut T {
self.write(val)
}

/// Gets a pointer to the contained value. Reading from this pointer or turning it
/// into a reference is undefined behavior unless the `MaybeUninit<T>` is initialized.
///
Expand Down Expand Up @@ -1346,15 +1329,6 @@ impl<T> MaybeUninit<T> {
ManuallyDrop::into_inner(self.value)
}

/// Deprecated before stabilization.
#[unstable(feature = "maybe_uninit", issue = "53491")]
#[inline(always)]
// FIXME: still used by stdsimd
// #[rustc_deprecated(since = "1.35.0", reason = "use `assume_init` instead")]
pub unsafe fn into_initialized(self) -> T {
self.assume_init()
}

/// Reads the value from the `MaybeUninit<T>` container. The resulting `T` is subject
/// to the usual drop handling.
///
Expand Down Expand Up @@ -1417,14 +1391,6 @@ impl<T> MaybeUninit<T> {
self.as_ptr().read()
}

/// Deprecated before stabilization.
#[unstable(feature = "maybe_uninit", issue = "53491")]
#[inline(always)]
#[rustc_deprecated(since = "1.35.0", reason = "use `read` instead")]
pub unsafe fn read_initialized(&self) -> T {
self.read()
}

/// Gets a reference to the contained value.
///
/// # Safety
Expand Down
2 changes: 0 additions & 2 deletions src/libpanic_unwind/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#![deny(rust_2018_idioms)]

#![feature(allocator_api)]
#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(lang_items)]
#![feature(libc)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}

fn explain_span(self, heading: &str, span: Span) -> (String, Option<Span>) {
let lo = self.sess.source_map().lookup_char_pos_adj(span.lo());
let lo = self.sess.source_map().lookup_char_pos(span.lo());
(
format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize() + 1),
Some(span),
Expand Down
7 changes: 0 additions & 7 deletions src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,6 @@ declare_lint! {
"outlives requirements can be inferred"
}

declare_lint! {
pub DUPLICATE_MATCHER_BINDING_NAME,
Deny,
"duplicate macro matcher binding name"
}

/// Some lints that are buffered from `libsyntax`. See `syntax::early_buffered_lints`.
pub mod parser {
declare_lint! {
Expand Down Expand Up @@ -462,7 +456,6 @@ declare_lint_pass! {
DEPRECATED_IN_FUTURE,
AMBIGUOUS_ASSOCIATED_ITEMS,
NESTED_IMPL_TRAIT,
DUPLICATE_MATCHER_BINDING_NAME,
MUTABLE_BORROW_RESERVATION_CONFLICT,
]
}
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use rustc_data_structures::sync::{self, Lrc};
use crate::hir::def_id::{CrateNum, LOCAL_CRATE};
use crate::hir::intravisit;
use crate::hir;
use crate::lint::builtin::{BuiltinLintDiagnostics, DUPLICATE_MATCHER_BINDING_NAME};
use crate::lint::builtin::BuiltinLintDiagnostics;
use crate::lint::builtin::parser::{QUESTION_MARK_MACRO_SEP, ILL_FORMED_ATTRIBUTE_INPUT};
use crate::session::{Session, DiagnosticMessageId};
use crate::ty::TyCtxt;
Expand Down Expand Up @@ -82,7 +82,6 @@ impl Lint {
match lint_id {
BufferedEarlyLintId::QuestionMarkMacroSep => QUESTION_MARK_MACRO_SEP,
BufferedEarlyLintId::IllFormedAttributeInput => ILL_FORMED_ATTRIBUTE_INPUT,
BufferedEarlyLintId::DuplicateMacroMatcherBindingName => DUPLICATE_MATCHER_BINDING_NAME,
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> {
write!(f, "inside call to `{}`", self.instance)?;
}
if !self.call_site.is_dummy() {
let lo = tcx.sess.source_map().lookup_char_pos_adj(self.call_site.lo());
write!(f, " at {}:{}:{}", lo.filename, lo.line, lo.col.to_usize() + 1)?;
let lo = tcx.sess.source_map().lookup_char_pos(self.call_site.lo());
write!(f, " at {}:{}:{}", lo.file.name, lo.line, lo.col.to_usize() + 1)?;
}
Ok(())
})
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ pub struct Statement<'tcx> {

// `Statement` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_arch = "x86_64")]
static_assert!(MEM_SIZE_OF_STATEMENT: mem::size_of::<Statement<'_>>() == 48);
static_assert!(MEM_SIZE_OF_STATEMENT: mem::size_of::<Statement<'_>>() == 56);

impl<'tcx> Statement<'tcx> {
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
Expand Down
8 changes: 7 additions & 1 deletion src/librustc/session/code_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ impl CodeStats {
overall_size: Size,
packed: bool,
opt_discr_size: Option<Size>,
variants: Vec<VariantInfo>) {
mut variants: Vec<VariantInfo>) {
// Sort variants so the largest ones are shown first. A stable sort is
// used here so that source code order is preserved for all variants
// that have the same size.
variants.sort_by(|info1, info2| {
info2.size.cmp(&info1.size)
});
let info = TypeSizeInfo {
kind,
type_description: type_desc.to_string(),
Expand Down
14 changes: 5 additions & 9 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,11 @@ impl<'a> Linker for GccLinker<'a> {
}

fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType) {
// If we're compiling a dylib, then we let symbol visibility in object
// files to take care of whether they're exported or not.
//
// If we're compiling a cdylib, however, we manually create a list of
// exported symbols to ensure we don't expose any more. The object files
// have far more public symbols than we actually want to export, so we
// hide them all here.
if crate_type == CrateType::Dylib ||
crate_type == CrateType::ProcMacro {
// We manually create a list of exported symbols to ensure we don't expose any more.
// The object files have far more public symbols than we actually want to export,
// so we hide them all here.

if crate_type == CrateType::ProcMacro {
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["dylib"]
[dependencies]
ena = "0.13"
log = "0.4"
jobserver_crate = { version = "0.1", package = "jobserver" }
jobserver_crate = { version = "0.1.13", package = "jobserver" }
lazy_static = "1"
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
serialize = { path = "../libserialize" }
Expand Down
128 changes: 7 additions & 121 deletions src/librustc_data_structures/jobserver.rs
Original file line number Diff line number Diff line change
@@ -1,89 +1,5 @@
use jobserver_crate::{Client, HelperThread, Acquired};
use jobserver_crate::Client;
use lazy_static::lazy_static;
use std::sync::{Condvar, Arc, Mutex};
use std::mem;

#[derive(Default)]
struct LockedProxyData {
/// The number of free thread tokens, this may include the implicit token given to the process
free: usize,

/// The number of threads waiting for a token
waiters: usize,

/// The number of tokens we requested from the server
requested: usize,

/// Stored tokens which will be dropped when we no longer need them
tokens: Vec<Acquired>,
}

impl LockedProxyData {
fn request_token(&mut self, thread: &Mutex<HelperThread>) {
self.requested += 1;
thread.lock().unwrap().request_token();
}

fn release_token(&mut self, cond_var: &Condvar) {
if self.waiters > 0 {
self.free += 1;
cond_var.notify_one();
} else {
if self.tokens.is_empty() {
// We are returning the implicit token
self.free += 1;
} else {
// Return a real token to the server
self.tokens.pop().unwrap();
}
}
}

fn take_token(&mut self, thread: &Mutex<HelperThread>) -> bool {
if self.free > 0 {
self.free -= 1;
self.waiters -= 1;

// We stole some token reqested by someone else
// Request another one
if self.requested + self.free < self.waiters {
self.request_token(thread);
}

true
} else {
false
}
}

fn new_requested_token(&mut self, token: Acquired, cond_var: &Condvar) {
self.requested -= 1;

// Does anything need this token?
if self.waiters > 0 {
self.free += 1;
self.tokens.push(token);
cond_var.notify_one();
} else {
// Otherwise we'll just drop it
mem::drop(token);
}
}
}

#[derive(Default)]
struct ProxyData {
lock: Mutex<LockedProxyData>,
cond_var: Condvar,
}

/// A helper type which makes managing jobserver tokens easier.
/// It also allows you to treat the implicit token given to the process
/// in the same manner as requested tokens.
struct Proxy {
thread: Mutex<HelperThread>,
data: Arc<ProxyData>,
}

lazy_static! {
// We can only call `from_env` once per process
Expand All @@ -105,52 +21,22 @@ lazy_static! {
// per-process.
static ref GLOBAL_CLIENT: Client = unsafe {
Client::from_env().unwrap_or_else(|| {
Client::new(32).expect("failed to create jobserver")
let client = Client::new(32).expect("failed to create jobserver");
// Acquire a token for the main thread which we can release later
client.acquire_raw().ok();
client
})
};

static ref GLOBAL_PROXY: Proxy = {
let data = Arc::new(ProxyData::default());

Proxy {
data: data.clone(),
thread: Mutex::new(client().into_helper_thread(move |token| {
data.lock.lock().unwrap().new_requested_token(token.unwrap(), &data.cond_var);
}).unwrap()),
}
};
}

pub fn client() -> Client {
GLOBAL_CLIENT.clone()
}

pub fn acquire_thread() {
GLOBAL_PROXY.acquire_token();
GLOBAL_CLIENT.acquire_raw().ok();
}

pub fn release_thread() {
GLOBAL_PROXY.release_token();
}

impl Proxy {
fn release_token(&self) {
self.data.lock.lock().unwrap().release_token(&self.data.cond_var);
}

fn acquire_token(&self) {
let mut data = self.data.lock.lock().unwrap();
data.waiters += 1;
if data.take_token(&self.thread) {
return;
}
// Request a token for us
data.request_token(&self.thread);
loop {
data = self.data.cond_var.wait(data).unwrap();
if data.take_token(&self.thread) {
return;
}
}
}
GLOBAL_CLIENT.release_raw().ok();
}
Loading