Skip to content

Commit 5bfeee5

Browse files
committed
Auto merge of rust-lang#77172 - jonas-schievink:rollup-a041rou, r=jonas-schievink
Rollup of 15 pull requests Successful merges: - rust-lang#75438 (Use adaptive SVG favicon for rustdoc like other rust sites) - rust-lang#76304 (Make delegation methods of `std::net::IpAddr` unstably const) - rust-lang#76724 (Allow a unique name to be assigned to dataflow graphviz output) - rust-lang#76978 (Documented From impls in std/sync/mpsc/mod.rs) - rust-lang#77044 (Liballoc bench vec use mem take not replace) - rust-lang#77050 (Typo fix: "satsify" -> "satisfy") - rust-lang#77074 (add array::from_ref) - rust-lang#77078 (Don't use an if guard to check equality with a constant) - rust-lang#77079 (Use `Self` in docs when possible) - rust-lang#77081 (Merge two almost identical match arms) - rust-lang#77121 (Updated html_root_url for compiler crates) - rust-lang#77136 (Suggest `const_mut_refs`, not `const_fn` for mutable references in `const fn`) - rust-lang#77160 (Suggest `const_fn_transmute`, not `const_fn`) - rust-lang#77164 (Remove workaround for deref issue that no longer exists.) - rust-lang#77165 (Followup to rust-lang#76673) Failed merges: r? `@ghost`
2 parents 9b5c98f + 8515efb commit 5bfeee5

File tree

76 files changed

+365
-214
lines changed

Some content is hidden

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

76 files changed

+365
-214
lines changed

compiler/rustc_apfloat/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//!
3131
//! This API is completely unstable and subject to change.
3232
33-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
33+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
3434
#![no_std]
3535
#![forbid(unsafe_code)]
3636
#![feature(nll)]

compiler/rustc_arena/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! This crate implements several kinds of arena.
99
1010
#![doc(
11-
html_root_url = "https://doc.rust-lang.org/nightly/",
11+
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1212
test(no_crate_inject, attr(deny(warnings)))
1313
)]
1414
#![feature(dropck_eyepatch)]

compiler/rustc_ast/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
//!
55
//! This API is completely unstable and subject to change.
66
7-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
7+
#![doc(
8+
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
9+
test(attr(deny(warnings)))
10+
)]
811
#![feature(box_syntax)]
912
#![feature(const_fn)] // For the `transmute` in `P::new`
1013
#![feature(const_fn_transmute)]

compiler/rustc_attr/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ where
301301
.emit();
302302
};
303303
match issue.parse() {
304-
Ok(num) if num == 0 => {
304+
Ok(0) => {
305305
emit_diag(
306306
"`issue` must not be \"0\", \
307307
use \"none\" instead",

compiler/rustc_builtin_macros/src/format_foreign.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,7 @@ pub mod printf {
518518
.and_then(|end| end.at_next_cp())
519519
.map(|end| (next.slice_between(end).unwrap(), end));
520520
let end = match end {
521-
Some(("32", end)) => end,
522-
Some(("64", end)) => end,
521+
Some(("32" | "64", end)) => end,
523522
_ => next,
524523
};
525524
state = Type;

compiler/rustc_builtin_macros/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This crate contains implementations of built-in macros and other code generating facilities
22
//! injecting code into the crate before it is lowered to HIR.
33
4-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
4+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
55
#![feature(bool_to_option)]
66
#![feature(crate_visibility_modifier)]
77
#![feature(decl_macro)]

compiler/rustc_codegen_llvm/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//!
55
//! This API is completely unstable and subject to change.
66
7-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
7+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
88
#![feature(bool_to_option)]
99
#![feature(const_cstr_unchecked)]
1010
#![feature(crate_visibility_modifier)]

compiler/rustc_codegen_ssa/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
1+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
22
#![feature(bool_to_option)]
33
#![feature(option_expect_none)]
44
#![feature(box_patterns)]

compiler/rustc_data_structures/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//!
77
//! This API is completely unstable and subject to change.
88
9-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
9+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1010
#![allow(incomplete_features)]
1111
#![feature(array_windows)]
1212
#![feature(control_flow_enum)]

compiler/rustc_driver/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//!
55
//! This API is completely unstable and subject to change.
66
7-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
7+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
88
#![feature(nll)]
99
#![feature(once_cell)]
1010
#![recursion_limit = "256"]

compiler/rustc_errors/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! This module contains the code for creating and emitting diagnostics.
44
5-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
5+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
66
#![feature(crate_visibility_modifier)]
77
#![feature(backtrace)]
88
#![feature(nll)]

compiler/rustc_graphviz/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
//! * [DOT language](http://www.graphviz.org/doc/info/lang.html)
273273
274274
#![doc(
275-
html_root_url = "https://doc.rust-lang.org/nightly/",
275+
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
276276
test(attr(allow(unused_variables), deny(warnings)))
277277
)]
278278
#![feature(nll)]

compiler/rustc_incremental/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Support for serializing the dep-graph and reloading it.
22
3-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
3+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
44
#![feature(in_band_lifetimes)]
55
#![feature(nll)]
66
#![recursion_limit = "256"]

compiler/rustc_infer/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//!
1313
//! This API is completely unstable and subject to change.
1414
15-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
15+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1616
#![feature(bool_to_option)]
1717
#![feature(box_patterns)]
1818
#![feature(box_syntax)]

compiler/rustc_lint/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
//!
2626
//! This API is completely unstable and subject to change.
2727
28-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
28+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2929
#![cfg_attr(test, feature(test))]
3030
#![feature(array_windows)]
3131
#![feature(bool_to_option)]

compiler/rustc_llvm/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(nll)]
22
#![feature(static_nobundle)]
3-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
3+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
44

55
// NOTE: This crate only exists to allow linking on mingw targets.
66

compiler/rustc_metadata/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
1+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
22
#![feature(bool_to_option)]
33
#![feature(core_intrinsics)]
44
#![feature(crate_visibility_modifier)]

compiler/rustc_middle/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
//!
2323
//! This API is completely unstable and subject to change.
2424
25-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
25+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2626
#![feature(array_windows)]
2727
#![feature(backtrace)]
2828
#![feature(bool_to_option)]

compiler/rustc_middle/src/mir/terminator/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ pub enum TerminatorKind<'tcx> {
9696
/// P <- V
9797
/// }
9898
/// ```
99+
///
100+
/// Note that DropAndReplace is eliminated as part of the `ElaborateDrops` pass.
99101
DropAndReplace {
100102
place: Place<'tcx>,
101103
value: Operand<'tcx>,

compiler/rustc_mir/src/borrow_check/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ fn do_mir_borrowck<'a, 'tcx>(
205205

206206
let mut flow_inits = MaybeInitializedPlaces::new(tcx, &body, &mdpe)
207207
.into_engine(tcx, &body, def.did.to_def_id())
208+
.pass_name("borrowck")
208209
.iterate_to_fixpoint()
209210
.into_results_cursor(&body);
210211

@@ -264,12 +265,15 @@ fn do_mir_borrowck<'a, 'tcx>(
264265

265266
let flow_borrows = Borrows::new(tcx, &body, regioncx.clone(), &borrow_set)
266267
.into_engine(tcx, &body, def.did.to_def_id())
268+
.pass_name("borrowck")
267269
.iterate_to_fixpoint();
268270
let flow_uninits = MaybeUninitializedPlaces::new(tcx, &body, &mdpe)
269271
.into_engine(tcx, &body, def.did.to_def_id())
272+
.pass_name("borrowck")
270273
.iterate_to_fixpoint();
271274
let flow_ever_inits = EverInitializedPlaces::new(tcx, &body, &mdpe)
272275
.into_engine(tcx, &body, def.did.to_def_id())
276+
.pass_name("borrowck")
273277
.iterate_to_fixpoint();
274278

275279
let movable_generator = match tcx.hir().get(id) {

compiler/rustc_mir/src/dataflow/framework/engine.rs

+20-2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ where
8484
def_id: DefId,
8585
dead_unwinds: Option<&'a BitSet<BasicBlock>>,
8686
entry_sets: IndexVec<BasicBlock, A::Domain>,
87+
pass_name: Option<&'static str>,
8788
analysis: A,
8889

8990
/// Cached, cumulative transfer functions for each block.
@@ -174,6 +175,7 @@ where
174175
body,
175176
def_id,
176177
dead_unwinds: None,
178+
pass_name: None,
177179
entry_sets,
178180
apply_trans_for_block,
179181
}
@@ -189,6 +191,15 @@ where
189191
self
190192
}
191193

194+
/// Adds an identifier to the graphviz output for this particular run of a dataflow analysis.
195+
///
196+
/// Some analyses are run multiple times in the compilation pipeline. Give them a `pass_name`
197+
/// to differentiate them. Otherwise, only the results for the latest run will be saved.
198+
pub fn pass_name(mut self, name: &'static str) -> Self {
199+
self.pass_name = Some(name);
200+
self
201+
}
202+
192203
/// Computes the fixpoint for this dataflow problem and returns it.
193204
pub fn iterate_to_fixpoint(self) -> Results<'tcx, A>
194205
where
@@ -202,6 +213,7 @@ where
202213
mut entry_sets,
203214
tcx,
204215
apply_trans_for_block,
216+
pass_name,
205217
..
206218
} = self;
207219

@@ -249,7 +261,7 @@ where
249261

250262
let results = Results { analysis, entry_sets };
251263

252-
let res = write_graphviz_results(tcx, def_id, &body, &results);
264+
let res = write_graphviz_results(tcx, def_id, &body, &results, pass_name);
253265
if let Err(e) = res {
254266
warn!("Failed to write graphviz dataflow results: {}", e);
255267
}
@@ -267,6 +279,7 @@ fn write_graphviz_results<A>(
267279
def_id: DefId,
268280
body: &mir::Body<'tcx>,
269281
results: &Results<'tcx, A>,
282+
pass_name: Option<&'static str>,
270283
) -> std::io::Result<()>
271284
where
272285
A: Analysis<'tcx>,
@@ -285,12 +298,17 @@ where
285298
None if tcx.sess.opts.debugging_opts.dump_mir_dataflow
286299
&& dump_enabled(tcx, A::NAME, def_id) =>
287300
{
301+
// FIXME: Use some variant of `pretty::dump_path` for this
288302
let mut path = PathBuf::from(&tcx.sess.opts.debugging_opts.dump_mir_dir);
289303

304+
let crate_name = tcx.crate_name(def_id.krate);
290305
let item_name = ty::print::with_forced_impl_filename_line(|| {
291306
tcx.def_path(def_id).to_filename_friendly_no_crate()
292307
});
293-
path.push(format!("rustc.{}.{}.dot", item_name, A::NAME));
308+
309+
let pass_name = pass_name.map(|s| format!(".{}", s)).unwrap_or_default();
310+
311+
path.push(format!("{}.{}.{}{}.dot", crate_name, item_name, A::NAME, pass_name));
294312
path
295313
}
296314

compiler/rustc_mir/src/transform/check_consts/ops.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,14 @@ impl NonConstOp for Transmute {
489489
}
490490

491491
fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
492-
mcf_emit_error(ccx, span, "can only call `transmute` from const items, not `const fn`");
492+
feature_err(
493+
&ccx.tcx.sess.parse_sess,
494+
sym::const_fn_transmute,
495+
span,
496+
&format!("`transmute` is not allowed in {}s", ccx.const_kind()),
497+
)
498+
.note("`transmute` is only allowed in constants and statics for now")
499+
.emit();
493500
}
494501
}
495502

@@ -535,6 +542,7 @@ impl NonConstOp for UnsizingCast {
535542
}
536543
}
537544

545+
// Types that cannot appear in the signature or locals of a `const fn`.
538546
pub mod ty {
539547
use super::*;
540548

@@ -548,7 +556,13 @@ pub mod ty {
548556
}
549557

550558
fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
551-
mcf_emit_error(ccx, span, "mutable references in const fn are unstable");
559+
feature_err(
560+
&ccx.tcx.sess.parse_sess,
561+
sym::const_mut_refs,
562+
span,
563+
&format!("mutable references are not allowed in {}s", ccx.const_kind()),
564+
)
565+
.emit()
552566
}
553567
}
554568

compiler/rustc_mir/src/transform/check_consts/validation.rs

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ impl Qualifs<'mir, 'tcx> {
5959
MaybeMutBorrowedLocals::mut_borrows_only(tcx, &body, param_env)
6060
.unsound_ignore_borrow_on_drop()
6161
.into_engine(tcx, &body, def_id.to_def_id())
62+
.pass_name("const_qualification")
6263
.iterate_to_fixpoint()
6364
.into_results_cursor(&body)
6465
});

compiler/rustc_mir/src/transform/elaborate_drops.rs

+3
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@ impl<'tcx> MirPass<'tcx> for ElaborateDrops {
4444
let inits = MaybeInitializedPlaces::new(tcx, body, &env)
4545
.into_engine(tcx, body, def_id)
4646
.dead_unwinds(&dead_unwinds)
47+
.pass_name("elaborate_drops")
4748
.iterate_to_fixpoint()
4849
.into_results_cursor(body);
4950

5051
let uninits = MaybeUninitializedPlaces::new(tcx, body, &env)
5152
.mark_inactive_variants_as_uninit()
5253
.into_engine(tcx, body, def_id)
5354
.dead_unwinds(&dead_unwinds)
55+
.pass_name("elaborate_drops")
5456
.iterate_to_fixpoint()
5557
.into_results_cursor(body);
5658

@@ -83,6 +85,7 @@ fn find_dead_unwinds<'tcx>(
8385
let mut dead_unwinds = BitSet::new_empty(body.basic_blocks().len());
8486
let mut flow_inits = MaybeInitializedPlaces::new(tcx, body, &env)
8587
.into_engine(tcx, body, def_id)
88+
.pass_name("find_dead_unwinds")
8689
.iterate_to_fixpoint()
8790
.into_results_cursor(body);
8891
for (bb, bb_data) in body.basic_blocks().iter_enumerated() {

compiler/rustc_mir/src/transform/generator.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,10 @@ fn locals_live_across_suspend_points(
467467

468468
// Calculate the MIR locals which have been previously
469469
// borrowed (even if they are still active).
470-
let borrowed_locals_results =
471-
MaybeBorrowedLocals::all_borrows().into_engine(tcx, body_ref, def_id).iterate_to_fixpoint();
470+
let borrowed_locals_results = MaybeBorrowedLocals::all_borrows()
471+
.into_engine(tcx, body_ref, def_id)
472+
.pass_name("generator")
473+
.iterate_to_fixpoint();
472474

473475
let mut borrowed_locals_cursor =
474476
dataflow::ResultsCursor::new(body_ref, &borrowed_locals_results);
@@ -484,6 +486,7 @@ fn locals_live_across_suspend_points(
484486
// Calculate the liveness of MIR locals ignoring borrows.
485487
let mut liveness = MaybeLiveLocals
486488
.into_engine(tcx, body_ref, def_id)
489+
.pass_name("generator")
487490
.iterate_to_fixpoint()
488491
.into_results_cursor(body_ref);
489492

compiler/rustc_mir/src/transform/remove_unneeded_drops.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ impl<'tcx> MirPass<'tcx> for RemoveUnneededDrops {
3838
impl<'a, 'tcx> Visitor<'tcx> for RemoveUnneededDropsOptimizationFinder<'a, 'tcx> {
3939
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) {
4040
match terminator.kind {
41-
TerminatorKind::Drop { place, target, .. }
42-
| TerminatorKind::DropAndReplace { place, target, .. } => {
41+
TerminatorKind::Drop { place, target, .. } => {
4342
let ty = place.ty(self.body, self.tcx);
4443
let needs_drop = ty.ty.needs_drop(self.tcx, self.tcx.param_env(self.def_id));
4544
if !needs_drop {

compiler/rustc_parse_format/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! generated instead.
66
77
#![doc(
8-
html_root_url = "https://doc.rust-lang.org/nightly/",
8+
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
99
html_playground_url = "https://play.rust-lang.org/",
1010
test(attr(deny(warnings)))
1111
)]

compiler/rustc_passes/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//!
55
//! This API is completely unstable and subject to change.
66
7-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
7+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
88
#![feature(in_band_lifetimes)]
99
#![feature(nll)]
1010
#![feature(or_patterns)]

compiler/rustc_plugin_impl/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//! feature](https://doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html)
77
//! of the Unstable Book for some examples.
88
9-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
9+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1010
#![feature(nll)]
1111
#![recursion_limit = "256"]
1212

0 commit comments

Comments
 (0)