Skip to content

Commit f1b5f80

Browse files
committed
Auto merge of #59937 - Centril:rollup-6pousju, r=Centril
Rollup of 18 pull requests Successful merges: - #59612 (Use normal newtype_index macro for MIR dataflows) - #59675 (Stabilize the `alloc` crate.) - #59708 (Mark variables captured by reference as mutable correctly) - #59735 (remove lookup_char_pos_adj) - #59747 (Copy book.toml unstable book generator) - #59796 (Retire `IsNotConst` naming) - #59804 (Clean up jobserver integration) - #59818 (Eliminate `FnBox` usages from libstd.) - #59830 (Fix links on keyword docs.) - #59835 (Re-export NonZero signed variant in std) - #59852 (std: Add `{read,write}_vectored` for more types) - #59855 (Fix attributes position in type declaration) - #59858 (Make duplicate matcher bindings a hard error) - #59879 (Use SecRandomCopyBytes instead of /dev/urandom on MacOS) - #59899 (In `-Zprint-type-size` output, sort enum variants by size.) - #59912 (MaybeUninit: remove deprecated functions) - #59925 (Fix paste error in split_ascii_whitespace docs.) - #59930 (Exclude some copies of old book editions from search engines) Failed merges: r? @ghost
2 parents 896c3a5 + b613fd2 commit f1b5f80

File tree

102 files changed

+617
-577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+617
-577
lines changed

src/doc/robots.txt

+8
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ Disallow: /1.0.0-beta.2/
1717
Disallow: /1.0.0-beta.3/
1818
Disallow: /1.0.0-beta.4/
1919
Disallow: /1.0.0-beta.5/
20+
Disallow: /book/first-edition/
21+
Disallow: /book/second-edition/
22+
Disallow: /stable/book/first-edition/
23+
Disallow: /stable/book/second-edition/
24+
Disallow: /beta/book/first-edition/
25+
Disallow: /beta/book/second-edition/
26+
Disallow: /nightly/book/first-edition/
27+
Disallow: /nightly/book/second-edition/

src/doc/unstable-book/book.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[book]
22
title = "The Rust Unstable Book"
3+
author = "The Rust Community"

src/liballoc/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@
5151
//! default global allocator. It is not compatible with the libc allocator API.
5252
5353
#![allow(unused_attributes)]
54-
#![unstable(feature = "alloc",
55-
reason = "this library is unlikely to be stabilized in its current \
56-
form or name",
57-
issue = "27783")]
54+
#![stable(feature = "alloc", since = "1.36.0")]
5855
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
5956
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
6057
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]

src/liballoc/prelude/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
//!
66
//! ```
77
//! # #![allow(unused_imports)]
8-
//! # #![feature(alloc)]
98
//! #![feature(alloc_prelude)]
109
//! extern crate alloc;
1110
//! use alloc::prelude::v1::*;

src/liballoc/raw_vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<T, A: Alloc> RawVec<T, A> {
256256
/// # Examples
257257
///
258258
/// ```
259-
/// # #![feature(alloc, raw_vec_internals)]
259+
/// # #![feature(raw_vec_internals)]
260260
/// # extern crate alloc;
261261
/// # use std::ptr;
262262
/// # use alloc::raw_vec::RawVec;
@@ -460,7 +460,7 @@ impl<T, A: Alloc> RawVec<T, A> {
460460
/// # Examples
461461
///
462462
/// ```
463-
/// # #![feature(alloc, raw_vec_internals)]
463+
/// # #![feature(raw_vec_internals)]
464464
/// # extern crate alloc;
465465
/// # use std::ptr;
466466
/// # use alloc::raw_vec::RawVec;

src/libarena/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![deny(rust_2018_idioms)]
1515
#![cfg_attr(not(stage0), deny(internal))]
1616

17-
#![feature(alloc)]
1817
#![feature(core_intrinsics)]
1918
#![feature(dropck_eyepatch)]
2019
#![feature(raw_vec_internals)]

src/libcore/mem.rs

-34
Original file line numberDiff line numberDiff line change
@@ -1152,15 +1152,6 @@ impl<T> MaybeUninit<T> {
11521152
MaybeUninit { uninit: () }
11531153
}
11541154

1155-
/// Deprecated before stabilization.
1156-
#[unstable(feature = "maybe_uninit", issue = "53491")]
1157-
#[inline(always)]
1158-
// FIXME: still used by stdsimd
1159-
// #[rustc_deprecated(since = "1.35.0", reason = "use `uninit` instead")]
1160-
pub const fn uninitialized() -> MaybeUninit<T> {
1161-
Self::uninit()
1162-
}
1163-
11641155
/// Creates a new `MaybeUninit<T>` in an uninitialized state, with the memory being
11651156
/// filled with `0` bytes. It depends on `T` whether that already makes for
11661157
/// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized,
@@ -1221,14 +1212,6 @@ impl<T> MaybeUninit<T> {
12211212
}
12221213
}
12231214

1224-
/// Deprecated before stabilization.
1225-
#[unstable(feature = "maybe_uninit", issue = "53491")]
1226-
#[inline(always)]
1227-
#[rustc_deprecated(since = "1.35.0", reason = "use `write` instead")]
1228-
pub fn set(&mut self, val: T) -> &mut T {
1229-
self.write(val)
1230-
}
1231-
12321215
/// Gets a pointer to the contained value. Reading from this pointer or turning it
12331216
/// into a reference is undefined behavior unless the `MaybeUninit<T>` is initialized.
12341217
///
@@ -1346,15 +1329,6 @@ impl<T> MaybeUninit<T> {
13461329
ManuallyDrop::into_inner(self.value)
13471330
}
13481331

1349-
/// Deprecated before stabilization.
1350-
#[unstable(feature = "maybe_uninit", issue = "53491")]
1351-
#[inline(always)]
1352-
// FIXME: still used by stdsimd
1353-
// #[rustc_deprecated(since = "1.35.0", reason = "use `assume_init` instead")]
1354-
pub unsafe fn into_initialized(self) -> T {
1355-
self.assume_init()
1356-
}
1357-
13581332
/// Reads the value from the `MaybeUninit<T>` container. The resulting `T` is subject
13591333
/// to the usual drop handling.
13601334
///
@@ -1417,14 +1391,6 @@ impl<T> MaybeUninit<T> {
14171391
self.as_ptr().read()
14181392
}
14191393

1420-
/// Deprecated before stabilization.
1421-
#[unstable(feature = "maybe_uninit", issue = "53491")]
1422-
#[inline(always)]
1423-
#[rustc_deprecated(since = "1.35.0", reason = "use `read` instead")]
1424-
pub unsafe fn read_initialized(&self) -> T {
1425-
self.read()
1426-
}
1427-
14281394
/// Gets a reference to the contained value.
14291395
///
14301396
/// # Safety

src/libcore/str/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2712,7 +2712,7 @@ impl str {
27122712
/// All kinds of ASCII whitespace are considered:
27132713
///
27142714
/// ```
2715-
/// let mut iter = " Mary had\ta little \n\t lamb".split_whitespace();
2715+
/// let mut iter = " Mary had\ta little \n\t lamb".split_ascii_whitespace();
27162716
/// assert_eq!(Some("Mary"), iter.next());
27172717
/// assert_eq!(Some("had"), iter.next());
27182718
/// assert_eq!(Some("a"), iter.next());

src/libpanic_unwind/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
#![deny(rust_2018_idioms)]
2121

22-
#![feature(allocator_api)]
23-
#![feature(alloc)]
2422
#![feature(core_intrinsics)]
2523
#![feature(lang_items)]
2624
#![feature(libc)]

src/librustc/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
278278
}
279279

280280
fn explain_span(self, heading: &str, span: Span) -> (String, Option<Span>) {
281-
let lo = self.sess.source_map().lookup_char_pos_adj(span.lo());
281+
let lo = self.sess.source_map().lookup_char_pos(span.lo());
282282
(
283283
format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize() + 1),
284284
Some(span),

src/librustc/lint/builtin.rs

-7
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,6 @@ declare_lint! {
352352
"outlives requirements can be inferred"
353353
}
354354

355-
declare_lint! {
356-
pub DUPLICATE_MATCHER_BINDING_NAME,
357-
Deny,
358-
"duplicate macro matcher binding name"
359-
}
360-
361355
/// Some lints that are buffered from `libsyntax`. See `syntax::early_buffered_lints`.
362356
pub mod parser {
363357
declare_lint! {
@@ -462,7 +456,6 @@ declare_lint_pass! {
462456
DEPRECATED_IN_FUTURE,
463457
AMBIGUOUS_ASSOCIATED_ITEMS,
464458
NESTED_IMPL_TRAIT,
465-
DUPLICATE_MATCHER_BINDING_NAME,
466459
MUTABLE_BORROW_RESERVATION_CONFLICT,
467460
]
468461
}

src/librustc/lint/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc_data_structures::sync::{self, Lrc};
2626
use crate::hir::def_id::{CrateNum, LOCAL_CRATE};
2727
use crate::hir::intravisit;
2828
use crate::hir;
29-
use crate::lint::builtin::{BuiltinLintDiagnostics, DUPLICATE_MATCHER_BINDING_NAME};
29+
use crate::lint::builtin::BuiltinLintDiagnostics;
3030
use crate::lint::builtin::parser::{QUESTION_MARK_MACRO_SEP, ILL_FORMED_ATTRIBUTE_INPUT};
3131
use crate::session::{Session, DiagnosticMessageId};
3232
use crate::ty::TyCtxt;
@@ -82,7 +82,6 @@ impl Lint {
8282
match lint_id {
8383
BufferedEarlyLintId::QuestionMarkMacroSep => QUESTION_MARK_MACRO_SEP,
8484
BufferedEarlyLintId::IllFormedAttributeInput => ILL_FORMED_ATTRIBUTE_INPUT,
85-
BufferedEarlyLintId::DuplicateMacroMatcherBindingName => DUPLICATE_MATCHER_BINDING_NAME,
8685
}
8786
}
8887

src/librustc/mir/interpret/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> {
6565
write!(f, "inside call to `{}`", self.instance)?;
6666
}
6767
if !self.call_site.is_dummy() {
68-
let lo = tcx.sess.source_map().lookup_char_pos_adj(self.call_site.lo());
69-
write!(f, " at {}:{}:{}", lo.filename, lo.line, lo.col.to_usize() + 1)?;
68+
let lo = tcx.sess.source_map().lookup_char_pos(self.call_site.lo());
69+
write!(f, " at {}:{}:{}", lo.file.name, lo.line, lo.col.to_usize() + 1)?;
7070
}
7171
Ok(())
7272
})

src/librustc/session/code_stats.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ impl CodeStats {
5757
overall_size: Size,
5858
packed: bool,
5959
opt_discr_size: Option<Size>,
60-
variants: Vec<VariantInfo>) {
60+
mut variants: Vec<VariantInfo>) {
61+
// Sort variants so the largest ones are shown first. A stable sort is
62+
// used here so that source code order is preserved for all variants
63+
// that have the same size.
64+
variants.sort_by(|info1, info2| {
65+
info2.size.cmp(&info1.size)
66+
});
6167
let info = TypeSizeInfo {
6268
kind,
6369
type_description: type_desc.to_string(),

src/librustc_data_structures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["dylib"]
1212
[dependencies]
1313
ena = "0.13"
1414
log = "0.4"
15-
jobserver_crate = { version = "0.1", package = "jobserver" }
15+
jobserver_crate = { version = "0.1.13", package = "jobserver" }
1616
lazy_static = "1"
1717
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
1818
serialize = { path = "../libserialize" }
+7-121
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,5 @@
1-
use jobserver_crate::{Client, HelperThread, Acquired};
1+
use jobserver_crate::Client;
22
use lazy_static::lazy_static;
3-
use std::sync::{Condvar, Arc, Mutex};
4-
use std::mem;
5-
6-
#[derive(Default)]
7-
struct LockedProxyData {
8-
/// The number of free thread tokens, this may include the implicit token given to the process
9-
free: usize,
10-
11-
/// The number of threads waiting for a token
12-
waiters: usize,
13-
14-
/// The number of tokens we requested from the server
15-
requested: usize,
16-
17-
/// Stored tokens which will be dropped when we no longer need them
18-
tokens: Vec<Acquired>,
19-
}
20-
21-
impl LockedProxyData {
22-
fn request_token(&mut self, thread: &Mutex<HelperThread>) {
23-
self.requested += 1;
24-
thread.lock().unwrap().request_token();
25-
}
26-
27-
fn release_token(&mut self, cond_var: &Condvar) {
28-
if self.waiters > 0 {
29-
self.free += 1;
30-
cond_var.notify_one();
31-
} else {
32-
if self.tokens.is_empty() {
33-
// We are returning the implicit token
34-
self.free += 1;
35-
} else {
36-
// Return a real token to the server
37-
self.tokens.pop().unwrap();
38-
}
39-
}
40-
}
41-
42-
fn take_token(&mut self, thread: &Mutex<HelperThread>) -> bool {
43-
if self.free > 0 {
44-
self.free -= 1;
45-
self.waiters -= 1;
46-
47-
// We stole some token reqested by someone else
48-
// Request another one
49-
if self.requested + self.free < self.waiters {
50-
self.request_token(thread);
51-
}
52-
53-
true
54-
} else {
55-
false
56-
}
57-
}
58-
59-
fn new_requested_token(&mut self, token: Acquired, cond_var: &Condvar) {
60-
self.requested -= 1;
61-
62-
// Does anything need this token?
63-
if self.waiters > 0 {
64-
self.free += 1;
65-
self.tokens.push(token);
66-
cond_var.notify_one();
67-
} else {
68-
// Otherwise we'll just drop it
69-
mem::drop(token);
70-
}
71-
}
72-
}
73-
74-
#[derive(Default)]
75-
struct ProxyData {
76-
lock: Mutex<LockedProxyData>,
77-
cond_var: Condvar,
78-
}
79-
80-
/// A helper type which makes managing jobserver tokens easier.
81-
/// It also allows you to treat the implicit token given to the process
82-
/// in the same manner as requested tokens.
83-
struct Proxy {
84-
thread: Mutex<HelperThread>,
85-
data: Arc<ProxyData>,
86-
}
873

884
lazy_static! {
895
// We can only call `from_env` once per process
@@ -105,52 +21,22 @@ lazy_static! {
10521
// per-process.
10622
static ref GLOBAL_CLIENT: Client = unsafe {
10723
Client::from_env().unwrap_or_else(|| {
108-
Client::new(32).expect("failed to create jobserver")
24+
let client = Client::new(32).expect("failed to create jobserver");
25+
// Acquire a token for the main thread which we can release later
26+
client.acquire_raw().ok();
27+
client
10928
})
11029
};
111-
112-
static ref GLOBAL_PROXY: Proxy = {
113-
let data = Arc::new(ProxyData::default());
114-
115-
Proxy {
116-
data: data.clone(),
117-
thread: Mutex::new(client().into_helper_thread(move |token| {
118-
data.lock.lock().unwrap().new_requested_token(token.unwrap(), &data.cond_var);
119-
}).unwrap()),
120-
}
121-
};
12230
}
12331

12432
pub fn client() -> Client {
12533
GLOBAL_CLIENT.clone()
12634
}
12735

12836
pub fn acquire_thread() {
129-
GLOBAL_PROXY.acquire_token();
37+
GLOBAL_CLIENT.acquire_raw().ok();
13038
}
13139

13240
pub fn release_thread() {
133-
GLOBAL_PROXY.release_token();
134-
}
135-
136-
impl Proxy {
137-
fn release_token(&self) {
138-
self.data.lock.lock().unwrap().release_token(&self.data.cond_var);
139-
}
140-
141-
fn acquire_token(&self) {
142-
let mut data = self.data.lock.lock().unwrap();
143-
data.waiters += 1;
144-
if data.take_token(&self.thread) {
145-
return;
146-
}
147-
// Request a token for us
148-
data.request_token(&self.thread);
149-
loop {
150-
data = self.data.cond_var.wait(data).unwrap();
151-
if data.take_token(&self.thread) {
152-
return;
153-
}
154-
}
155-
}
41+
GLOBAL_CLIENT.release_raw().ok();
15642
}

src/librustc_lint/lib.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,6 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
428428
reference: "issue #57644 <https://github.com/rust-lang/rust/issues/57644>",
429429
edition: None,
430430
},
431-
FutureIncompatibleInfo {
432-
id: LintId::of(DUPLICATE_MATCHER_BINDING_NAME),
433-
reference: "issue #57593 <https://github.com/rust-lang/rust/issues/57593>",
434-
edition: None,
435-
},
436431
FutureIncompatibleInfo {
437432
id: LintId::of(NESTED_IMPL_TRAIT),
438433
reference: "issue #59014 <https://github.com/rust-lang/rust/issues/59014>",
@@ -494,6 +489,8 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
494489
"no longer a warning, #[no_mangle] statics always exported");
495490
store.register_removed("bad_repr",
496491
"replaced with a generic attribute input check");
492+
store.register_removed("duplicate_matcher_binding_name",
493+
"converted into hard error, see https://github.com/rust-lang/rust/issues/57742");
497494
}
498495

499496
pub fn register_internals(store: &mut lint::LintStore, sess: Option<&Session>) {

0 commit comments

Comments
 (0)