Skip to content

Commit 4bff385

Browse files
committed
Auto merge of #52433 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests Successful merges: - #52286 (Deny bare trait objects in src/librustc_errors) - #52306 (Reduce the number of clone()s needed in obligation_forest) - #52338 (update miri) - #52385 (Pass edition flags to compiler from rustdoc as expected) - #52392 (AsRef doc wording tweaks) - #52430 (update nomicon) - #52434 (Enable incremental independent of stage) - #52435 (Calculate the exact capacity for 2 HashMaps) - #52446 (Block beta if clippy breaks.) r? @ghost
2 parents 025e04e + c0db1aa commit 4bff385

File tree

16 files changed

+97
-41
lines changed

16 files changed

+97
-41
lines changed

src/Cargo.lock

+25-2
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,18 @@ dependencies = [
243243
"serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
244244
]
245245

246+
[[package]]
247+
name = "cargo_metadata"
248+
version = "0.6.0"
249+
source = "registry+https://github.com/rust-lang/crates.io-index"
250+
dependencies = [
251+
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
252+
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
253+
"serde 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
254+
"serde_derive 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
255+
"serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
256+
]
257+
246258
[[package]]
247259
name = "cargotest2"
248260
version = "0.1.0"
@@ -629,6 +641,14 @@ dependencies = [
629641
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
630642
]
631643

644+
[[package]]
645+
name = "error-chain"
646+
version = "0.12.0"
647+
source = "registry+https://github.com/rust-lang/crates.io-index"
648+
dependencies = [
649+
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
650+
]
651+
632652
[[package]]
633653
name = "error_index_generator"
634654
version = "0.0.0"
@@ -1216,12 +1236,13 @@ name = "miri"
12161236
version = "0.1.0"
12171237
dependencies = [
12181238
"byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
1219-
"cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
1239+
"cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
1240+
"colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
12201241
"compiletest_rs 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
12211242
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
12221243
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
12231244
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
1224-
"regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
1245+
"regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
12251246
]
12261247

12271248
[[package]]
@@ -3031,6 +3052,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
30313052
"checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32"
30323053
"checksum byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9"
30333054
"checksum cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1efca0b863ca03ed4c109fb1c55e0bc4bbeb221d3e103d86251046b06a526bd0"
3055+
"checksum cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6809b327f87369e6f3651efd2c5a96c49847a3ed2559477ecba79014751ee1"
30343056
"checksum cc 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "49ec142f5768efb5b7622aebc3fdbdbb8950a4b9ba996393cb76ef7466e8747d"
30353057
"checksum cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efe5c877e17a9c717a0bf3613b2709f723202c4e4675cc8f12926ded29bcb17e"
30363058
"checksum chalk-engine 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a146c19172c7eea48ea55a7123ac95da786639bc665097f1e14034ee5f1d8699"
@@ -3062,6 +3084,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
30623084
"checksum env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0e6e40ebb0e66918a37b38c7acab4e10d299e0463fe2af5d29b9cc86710cfd2a"
30633085
"checksum environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4b14e20978669064c33b4c1e0fb4083412e40fe56cbea2eae80fd7591503ee"
30643086
"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
3087+
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
30653088
"checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82"
30663089
"checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b"
30673090
"checksum filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da4b9849e77b13195302c174324b5ba73eec9b236b24c221a61000daefb95c5f"

src/bootstrap/builder.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -903,10 +903,7 @@ impl<'a> Builder<'a> {
903903
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler));
904904
}
905905

906-
// Ignore incremental modes except for stage0, since we're
907-
// not guaranteeing correctness across builds if the compiler
908-
// is changing under your feet.`
909-
if self.config.incremental && compiler.stage == 0 {
906+
if self.config.incremental {
910907
cargo.env("CARGO_INCREMENTAL", "1");
911908
}
912909

src/bootstrap/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn build(build: &mut Build) {
5151
build_krate("", build, &mut resolves, "src/libtest");
5252
build_krate(&build.rustc_features(), build, &mut resolves, "src/rustc");
5353

54-
let mut id2name = HashMap::new();
54+
let mut id2name = HashMap::with_capacity(build.crates.len());
5555
for (name, krate) in build.crates.iter() {
5656
id2name.insert(krate.id.clone(), name.clone());
5757
}

src/ci/docker/x86_64-gnu-tools/checktools.sh

+9-7
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ status_check() {
8181
check_dispatch $1 beta rust-by-example src/doc/rust-by-example
8282
check_dispatch $1 beta rls src/tools/rls
8383
check_dispatch $1 beta rustfmt src/tools/rustfmt
84+
check_dispatch $1 beta clippy-driver src/tools/clippy
8485
# these tools are not required for beta to successfully branch
85-
check_dispatch $1 nightly clippy-driver src/tools/clippy
8686
check_dispatch $1 nightly miri src/tools/miri
8787
}
8888

@@ -106,12 +106,14 @@ $COMMIT\t$(cat "$TOOLSTATE_FILE")
106106
fi
107107
}
108108

109-
if [ "$RUST_RELEASE_CHANNEL" = nightly -a -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
110-
. "$(dirname $0)/repo.sh"
111-
MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
112-
echo "($OS CI update)" > "$MESSAGE_FILE"
113-
commit_toolstate_change "$MESSAGE_FILE" change_toolstate
114-
rm -f "$MESSAGE_FILE"
109+
if [ "$RUST_RELEASE_CHANNEL" = nightly ]; then
110+
if [ -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
111+
. "$(dirname $0)/repo.sh"
112+
MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
113+
echo "($OS CI update)" > "$MESSAGE_FILE"
114+
commit_toolstate_change "$MESSAGE_FILE" change_toolstate
115+
rm -f "$MESSAGE_FILE"
116+
fi
115117
exit 0
116118
fi
117119

src/doc/nomicon

src/libcore/convert.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
///
6464
/// The key difference between the two traits is the intention:
6565
///
66-
/// - Use `AsRef` when goal is to simply convert into a reference
67-
/// - Use `Borrow` when goal is related to writing code that is agnostic to the
68-
/// type of borrow and if is reference or value
66+
/// - Use `AsRef` when the goal is to simply convert into a reference
67+
/// - Use `Borrow` when the goal is related to writing code that is agnostic to
68+
/// the type of borrow and whether it is a reference or value
6969
///
7070
/// See [the book][book] for a more detailed comparison.
7171
///

src/librustc_data_structures/obligation_forest/mod.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,14 @@ impl<O: ForestObligation> ObligationForest<O> {
496496
}
497497
}
498498
NodeState::Done => {
499-
self.waiting_cache.remove(self.nodes[i].obligation.as_predicate());
500-
// FIXME(HashMap): why can't I get my key back?
501-
self.done_cache.insert(self.nodes[i].obligation.as_predicate().clone());
499+
// Avoid cloning the key (predicate) in case it exists in the waiting cache
500+
if let Some((predicate, _)) = self.waiting_cache
501+
.remove_entry(self.nodes[i].obligation.as_predicate())
502+
{
503+
self.done_cache.insert(predicate);
504+
} else {
505+
self.done_cache.insert(self.nodes[i].obligation.as_predicate().clone());
506+
}
502507
node_rewrites[i] = nodes_len;
503508
dead_nodes += 1;
504509
}

src/librustc_driver/profile/trace.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ pub fn write_counts(count_file: &mut File, counts: &mut HashMap<String,QueryMetr
220220
}
221221

222222
pub fn write_traces(html_file: &mut File, counts_file: &mut File, traces: &Vec<Rec>) {
223-
let mut counts : HashMap<String,QueryMetric> = HashMap::new();
223+
let capacity = traces.iter().fold(0, |acc, t| acc + 1 + t.extent.len());
224+
let mut counts : HashMap<String, QueryMetric> = HashMap::with_capacity(capacity);
224225
compute_counts_rec(&mut counts, traces);
225226
write_counts(counts_file, &mut counts);
226227

src/librustc_errors/diagnostic.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl Diagnostic {
121121
}
122122

123123
pub fn note_expected_found(&mut self,
124-
label: &fmt::Display,
124+
label: &dyn fmt::Display,
125125
expected: DiagnosticStyledString,
126126
found: DiagnosticStyledString)
127127
-> &mut Self
@@ -130,11 +130,11 @@ impl Diagnostic {
130130
}
131131

132132
pub fn note_expected_found_extra(&mut self,
133-
label: &fmt::Display,
133+
label: &dyn fmt::Display,
134134
expected: DiagnosticStyledString,
135135
found: DiagnosticStyledString,
136-
expected_extra: &fmt::Display,
137-
found_extra: &fmt::Display)
136+
expected_extra: &dyn fmt::Display,
137+
found_extra: &dyn fmt::Display)
138138
-> &mut Self
139139
{
140140
let mut msg: Vec<_> = vec![(format!("expected {} `", label), Style::NoStyle)];

src/librustc_errors/diagnostic_builder.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ impl<'a> DiagnosticBuilder<'a> {
148148
}
149149

150150
forward!(pub fn note_expected_found(&mut self,
151-
label: &fmt::Display,
151+
label: &dyn fmt::Display,
152152
expected: DiagnosticStyledString,
153153
found: DiagnosticStyledString)
154154
-> &mut Self);
155155

156156
forward!(pub fn note_expected_found_extra(&mut self,
157-
label: &fmt::Display,
157+
label: &dyn fmt::Display,
158158
expected: DiagnosticStyledString,
159159
found: DiagnosticStyledString,
160-
expected_extra: &fmt::Display,
161-
found_extra: &fmt::Display)
160+
expected_extra: &dyn fmt::Display,
161+
found_extra: &dyn fmt::Display)
162162
-> &mut Self);
163163

164164
forward!(pub fn note(&mut self, msg: &str) -> &mut Self);

src/librustc_errors/emitter.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl EmitterWriter {
148148
}
149149
}
150150

151-
pub fn new(dst: Box<Write + Send>,
151+
pub fn new(dst: Box<dyn Write + Send>,
152152
code_map: Option<Lrc<CodeMapperDyn>>,
153153
short_message: bool,
154154
teach: bool)
@@ -1469,13 +1469,13 @@ fn emit_to_destination(rendered_buffer: &Vec<Vec<StyledString>>,
14691469
pub enum Destination {
14701470
Terminal(StandardStream),
14711471
Buffered(BufferWriter),
1472-
Raw(Box<Write + Send>),
1472+
Raw(Box<dyn Write + Send>),
14731473
}
14741474

14751475
pub enum WritableDst<'a> {
14761476
Terminal(&'a mut StandardStream),
14771477
Buffered(&'a mut BufferWriter, Buffer),
1478-
Raw(&'a mut Box<Write + Send>),
1478+
Raw(&'a mut Box<dyn Write + Send>),
14791479
}
14801480

14811481
impl Destination {

src/librustc_errors/lib.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![deny(bare_trait_objects)]
12+
1113
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1214
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1315
html_root_url = "https://doc.rust-lang.org/nightly/")]
@@ -110,7 +112,7 @@ pub struct SubstitutionPart {
110112
pub snippet: String,
111113
}
112114

113-
pub type CodeMapperDyn = CodeMapper + sync::Send + sync::Sync;
115+
pub type CodeMapperDyn = dyn CodeMapper + sync::Send + sync::Sync;
114116

115117
pub trait CodeMapper {
116118
fn lookup_char_pos(&self, pos: BytePos) -> Loc;
@@ -270,7 +272,7 @@ pub struct Handler {
270272
pub flags: HandlerFlags,
271273

272274
err_count: AtomicUsize,
273-
emitter: Lock<Box<Emitter + sync::Send>>,
275+
emitter: Lock<Box<dyn Emitter + sync::Send>>,
274276
continue_after_error: LockCell<bool>,
275277
delayed_span_bug: Lock<Option<Diagnostic>>,
276278

@@ -326,7 +328,7 @@ impl Handler {
326328

327329
pub fn with_emitter(can_emit_warnings: bool,
328330
treat_err_as_bug: bool,
329-
e: Box<Emitter + sync::Send>)
331+
e: Box<dyn Emitter + sync::Send>)
330332
-> Handler {
331333
Handler::with_emitter_and_flags(
332334
e,
@@ -337,7 +339,8 @@ impl Handler {
337339
})
338340
}
339341

340-
pub fn with_emitter_and_flags(e: Box<Emitter + sync::Send>, flags: HandlerFlags) -> Handler {
342+
pub fn with_emitter_and_flags(e: Box<dyn Emitter + sync::Send>, flags: HandlerFlags) -> Handler
343+
{
341344
Handler {
342345
flags,
343346
err_count: AtomicUsize::new(0),

src/librustc_errors/lock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::any::Any;
2323

2424
#[cfg(windows)]
2525
#[allow(bad_style)]
26-
pub fn acquire_global_lock(name: &str) -> Box<Any> {
26+
pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
2727
use std::ffi::CString;
2828
use std::io;
2929

@@ -110,6 +110,6 @@ pub fn acquire_global_lock(name: &str) -> Box<Any> {
110110
}
111111

112112
#[cfg(unix)]
113-
pub fn acquire_global_lock(_name: &str) -> Box<Any> {
113+
pub fn acquire_global_lock(_name: &str) -> Box<dyn Any> {
114114
Box::new(())
115115
}

src/librustdoc/test.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use syntax::codemap::CodeMap;
3737
use syntax::edition::Edition;
3838
use syntax::feature_gate::UnstableFeatures;
3939
use syntax::with_globals;
40-
use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName};
40+
use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName, hygiene};
4141
use errors;
4242
use errors::emitter::ColorConfig;
4343

@@ -561,6 +561,7 @@ impl Collector {
561561
rustc_driver::in_rustc_thread(move || with_globals(move || {
562562
io::set_panic(panic);
563563
io::set_print(print);
564+
hygiene::set_default_edition(edition);
564565
run_test(&test,
565566
&cratename,
566567
&filename,

src/test/rustdoc/edition-flag.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags:--test -Z unstable-options
12+
// edition:2018
13+
14+
#![feature(async_await)]
15+
16+
/// ```rust
17+
/// #![feature(async_await)]
18+
/// fn main() {
19+
/// let _ = async { };
20+
/// }
21+
/// ```
22+
fn main() {
23+
let _ = async { };
24+
}

src/tools/miri

Submodule miri updated from 5b7bb32 to 911aedf

0 commit comments

Comments
 (0)