Skip to content

Commit 130b2ab

Browse files
committed
Auto merge of rust-lang#82611 - Dylan-DPC:rollup-l7xlpks, r=Dylan-DPC
Rollup of 11 pull requests Successful merges: - rust-lang#81856 (Suggest character encoding is incorrect when encountering random null bytes) - rust-lang#82395 (Add missing "see its documentation for more" stdio) - rust-lang#82401 (Remove a redundant macro) - rust-lang#82498 (Use log level to control partitioning debug output) - rust-lang#82534 (Link crtbegin/crtend on musl to terminate .eh_frame) - rust-lang#82537 (Update measureme dependency to the latest version) - rust-lang#82561 (doc: cube root, not cubic root) - rust-lang#82563 (Fix intra-doc handling of `Self` in enum) - rust-lang#82584 (Add ARIA role to sidebar toggle in Rustdoc) - rust-lang#82596 (clarify RW lock's priority gotcha) - rust-lang#82607 (Add a getter for Frame.loc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 94736c4 + 7847f69 commit 130b2ab

File tree

25 files changed

+102
-33
lines changed

25 files changed

+102
-33
lines changed

Cargo.lock

+14-2
Original file line numberDiff line numberDiff line change
@@ -2149,11 +2149,14 @@ dependencies = [
21492149

21502150
[[package]]
21512151
name = "measureme"
2152-
version = "9.0.0"
2152+
version = "9.1.0"
21532153
source = "registry+https://github.com/rust-lang/crates.io-index"
2154-
checksum = "22bf8d885d073610aee20e7fa205c4341ed32a761dbde96da5fd96301a8d3e82"
2154+
checksum = "4a98e07fe802486895addb2b5467f33f205e82c426bfaf350f5d8109b137767c"
21552155
dependencies = [
2156+
"log",
2157+
"memmap",
21562158
"parking_lot",
2159+
"perf-event-open-sys",
21572160
"rustc-hash",
21582161
"smallvec 1.6.1",
21592162
]
@@ -2550,6 +2553,15 @@ version = "2.1.0"
25502553
source = "registry+https://github.com/rust-lang/crates.io-index"
25512554
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
25522555

2556+
[[package]]
2557+
name = "perf-event-open-sys"
2558+
version = "1.0.1"
2559+
source = "registry+https://github.com/rust-lang/crates.io-index"
2560+
checksum = "ce9bedf5da2c234fdf2391ede2b90fabf585355f33100689bc364a3ea558561a"
2561+
dependencies = [
2562+
"libc",
2563+
]
2564+
25532565
[[package]]
25542566
name = "pest"
25552567
version = "2.1.3"

compiler/rustc_codegen_llvm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ doctest = false
1212
bitflags = "1.0"
1313
cstr = "0.2"
1414
libc = "0.2"
15-
measureme = "9.0.0"
15+
measureme = "9.1.0"
1616
snap = "1"
1717
tracing = "0.1"
1818
rustc_middle = { path = "../rustc_middle" }

compiler/rustc_data_structures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ rustc-hash = "1.1.0"
2525
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
2626
rustc_index = { path = "../rustc_index", package = "rustc_index" }
2727
bitflags = "1.2.1"
28-
measureme = "9.0.0"
28+
measureme = "9.1.0"
2929
libc = "0.2"
3030
stacker = "0.1.12"
3131
tempfile = "3.0.5"

compiler/rustc_middle/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ rustc_ast = { path = "../rustc_ast" }
2828
rustc_span = { path = "../rustc_span" }
2929
chalk-ir = "0.55.0"
3030
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
31-
measureme = "9.0.0"
31+
measureme = "9.1.0"
3232
rustc_session = { path = "../rustc_session" }
3333
rustc_type_ir = { path = "../rustc_type_ir" }

compiler/rustc_mir/src/interpret/eval_context.rs

+10
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ impl<'mir, 'tcx, Tag> Frame<'mir, 'tcx, Tag> {
226226
}
227227

228228
impl<'mir, 'tcx, Tag, Extra> Frame<'mir, 'tcx, Tag, Extra> {
229+
/// Get the current location within the Frame.
230+
///
231+
/// If this is `Err`, we are not currently executing any particular statement in
232+
/// this frame (can happen e.g. during frame initialization, and during unwinding on
233+
/// frames without cleanup code).
234+
/// We basically abuse `Result` as `Either`.
235+
pub fn current_loc(&self) -> Result<mir::Location, Span> {
236+
self.loc
237+
}
238+
229239
/// Return the `SourceInfo` of the current instruction.
230240
pub fn current_source_info(&self) -> Option<&mir::SourceInfo> {
231241
self.loc.ok().map(|loc| self.body.source_info(loc))

compiler/rustc_mir/src/monomorphize/partitioning/mod.rs

+15-6
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,22 @@ where
239239
I: Iterator<Item = &'a CodegenUnit<'tcx>>,
240240
'tcx: 'a,
241241
{
242-
if cfg!(debug_assertions) {
243-
debug!("{}", label);
242+
let dump = move || {
243+
use std::fmt::Write;
244+
245+
let s = &mut String::new();
246+
let _ = writeln!(s, "{}", label);
244247
for cgu in cgus {
245-
debug!("CodegenUnit {} estimated size {} :", cgu.name(), cgu.size_estimate());
248+
let _ =
249+
writeln!(s, "CodegenUnit {} estimated size {} :", cgu.name(), cgu.size_estimate());
246250

247251
for (mono_item, linkage) in cgu.items() {
248252
let symbol_name = mono_item.symbol_name(tcx).name;
249253
let symbol_hash_start = symbol_name.rfind('h');
250254
let symbol_hash = symbol_hash_start.map_or("<no hash>", |i| &symbol_name[i..]);
251255

252-
debug!(
256+
let _ = writeln!(
257+
s,
253258
" - {} [{:?}] [{}] estimated size {}",
254259
mono_item,
255260
linkage,
@@ -258,9 +263,13 @@ where
258263
);
259264
}
260265

261-
debug!("");
266+
let _ = writeln!(s, "");
262267
}
263-
}
268+
269+
std::mem::take(s)
270+
};
271+
272+
debug!("{}", dump());
264273
}
265274

266275
#[inline(never)] // give this a place in the profiler

compiler/rustc_parse/src/lexer/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ impl<'a> StringReader<'a> {
268268
// tokens like `<<` from `rustc_lexer`, and then add fancier error recovery to it,
269269
// as there will be less overall work to do this way.
270270
let token = unicode_chars::check_for_substitution(self, start, c, &mut err);
271+
if c == '\x00' {
272+
err.help("source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used");
273+
}
271274
err.emit();
272275
token?
273276
}

compiler/rustc_target/src/spec/crt_objects.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,24 @@ pub(super) fn all(obj: &str) -> CrtObjects {
6464

6565
pub(super) fn pre_musl_fallback() -> CrtObjects {
6666
new(&[
67-
(LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o"]),
68-
(LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o"]),
69-
(LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o"]),
70-
(LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o"]),
71-
(LinkOutputKind::DynamicDylib, &["crti.o"]),
72-
(LinkOutputKind::StaticDylib, &["crti.o"]),
67+
(LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]),
68+
(LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o", "crtbeginS.o"]),
69+
(LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]),
70+
(LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o", "crtbeginS.o"]),
71+
(LinkOutputKind::DynamicDylib, &["crti.o", "crtbeginS.o"]),
72+
(LinkOutputKind::StaticDylib, &["crti.o", "crtbeginS.o"]),
7373
])
7474
}
7575

7676
pub(super) fn post_musl_fallback() -> CrtObjects {
77-
all("crtn.o")
77+
new(&[
78+
(LinkOutputKind::DynamicNoPicExe, &["crtend.o", "crtn.o"]),
79+
(LinkOutputKind::DynamicPicExe, &["crtendS.o", "crtn.o"]),
80+
(LinkOutputKind::StaticNoPicExe, &["crtend.o", "crtn.o"]),
81+
(LinkOutputKind::StaticPicExe, &["crtendS.o", "crtn.o"]),
82+
(LinkOutputKind::DynamicDylib, &["crtendS.o", "crtn.o"]),
83+
(LinkOutputKind::StaticDylib, &["crtendS.o", "crtn.o"]),
84+
])
7885
}
7986

8087
pub(super) fn pre_mingw_fallback() -> CrtObjects {

compiler/rustc_typeck/src/check/method/suggest.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -517,21 +517,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
517517
}
518518

519519
if self.is_fn_ty(&rcvr_ty, span) {
520-
macro_rules! report_function {
521-
($span:expr, $name:expr) => {
522-
err.note(&format!(
523-
"`{}` is a function, perhaps you wish to call it",
524-
$name
525-
));
526-
};
520+
fn report_function<T: std::fmt::Display>(
521+
err: &mut DiagnosticBuilder<'_>,
522+
name: T,
523+
) {
524+
err.note(
525+
&format!("`{}` is a function, perhaps you wish to call it", name,),
526+
);
527527
}
528528

529529
if let SelfSource::MethodCall(expr) = source {
530530
if let Ok(expr_string) = tcx.sess.source_map().span_to_snippet(expr.span) {
531-
report_function!(expr.span, expr_string);
531+
report_function(&mut err, expr_string);
532532
} else if let ExprKind::Path(QPath::Resolved(_, ref path)) = expr.kind {
533533
if let Some(segment) = path.segments.last() {
534-
report_function!(expr.span, segment.ident);
534+
report_function(&mut err, segment.ident);
535535
}
536536
}
537537
}

library/std/src/f32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ impl f32 {
503503
unsafe { cmath::fdimf(self, other) }
504504
}
505505

506-
/// Returns the cubic root of a number.
506+
/// Returns the cube root of a number.
507507
///
508508
/// # Examples
509509
///

library/std/src/f64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ impl f64 {
505505
unsafe { cmath::fdim(self, other) }
506506
}
507507

508-
/// Returns the cubic root of a number.
508+
/// Returns the cube root of a number.
509509
///
510510
/// # Examples
511511
///

library/std/src/io/stdio.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ pub struct Stdout {
497497
/// A locked reference to the [`Stdout`] handle.
498498
///
499499
/// This handle implements the [`Write`] trait, and is constructed via
500-
/// the [`Stdout::lock`] method.
500+
/// the [`Stdout::lock`] method. See its documentation for more.
501501
///
502502
/// ### Note: Windows Portability Consideration
503503
/// When operating in a console, the Windows implementation of this stream does not support
@@ -711,7 +711,7 @@ pub struct Stderr {
711711
/// A locked reference to the [`Stderr`] handle.
712712
///
713713
/// This handle implements the [`Write`] trait and is constructed via
714-
/// the [`Stderr::lock`] method.
714+
/// the [`Stderr::lock`] method. See its documentation for more.
715715
///
716716
/// ### Note: Windows Portability Consideration
717717
/// When operating in a console, the Windows implementation of this stream does not support

library/std/src/sync/rwlock.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ use crate::sys_common::rwlock as sys;
2323
///
2424
/// The priority policy of the lock is dependent on the underlying operating
2525
/// system's implementation, and this type does not guarantee that any
26-
/// particular policy will be used.
26+
/// particular policy will be used. In particular, a writer which is waiting to
27+
/// acquire the lock in `write` might or might not block concurrent calls to
28+
/// `read`.
2729
///
2830
/// The type parameter `T` represents the data that this lock protects. It is
2931
/// required that `T` satisfies [`Send`] to be shared across threads and

src/bootstrap/compile.rs

+6
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ fn copy_self_contained_objects(
189189
DependencyType::TargetSelfContained,
190190
);
191191
}
192+
for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] {
193+
let src = compiler_file(builder, builder.cc(target), target, obj);
194+
let target = libdir_self_contained.join(obj);
195+
builder.copy(&src, &target);
196+
target_deps.push((target, DependencyType::TargetSelfContained));
197+
}
192198
} else if target.ends_with("-wasi") {
193199
let srcdir = builder.wasi_root(target).unwrap().join("lib/wasm32-wasi");
194200
for &obj in &["crt1.o", "crt1-reactor.o"] {

src/librustdoc/html/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ crate fn render<T: Print, S: Print>(
7575
<![endif]-->\
7676
{before_content}\
7777
<nav class=\"sidebar\">\
78-
<div class=\"sidebar-menu\">&#9776;</div>\
78+
<div class=\"sidebar-menu\" role=\"button\">&#9776;</div>\
7979
{logo}\
8080
{sidebar}\
8181
</nav>\

src/librustdoc/passes/collect_intra_doc_links.rs

+8
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,14 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
838838
debug!("looking for the `Self` type");
839839
let self_id = if item.is_fake() {
840840
None
841+
// Checking if the item is a field in an enum variant
842+
} else if (matches!(self.cx.tcx.def_kind(item.def_id), DefKind::Field)
843+
&& matches!(
844+
self.cx.tcx.def_kind(self.cx.tcx.parent(item.def_id).unwrap()),
845+
DefKind::Variant
846+
))
847+
{
848+
self.cx.tcx.parent(item.def_id).and_then(|item_id| self.cx.tcx.parent(item_id))
841849
} else if matches!(
842850
self.cx.tcx.def_kind(item.def_id),
843851
DefKind::AssocConst
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![crate_name = "foo"]
2+
#![deny(broken_intra_doc_links)]
3+
pub enum Foo {
4+
Bar {
5+
abc: i32,
6+
/// [Self::Bar::abc]
7+
xyz: i32,
8+
},
9+
}
10+
11+
// @has foo/enum.Foo.html '//a/@href' '../foo/enum.Foo.html#variant.Bar.field.abc'

src/test/ui/parser/issue-66473.stderr

2.54 KB
Binary file not shown.

src/test/ui/parser/issue-68629.stderr

390 Bytes
Binary file not shown.

src/test/ui/parser/issue-68730.stderr

260 Bytes
Binary file not shown.
125 Bytes
Binary file not shown.
3.45 KB
Binary file not shown.
126 Bytes
Binary file not shown.
3.42 KB
Binary file not shown.

src/tools/tidy/src/deps.rs

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
132132
"parking_lot",
133133
"parking_lot_core",
134134
"pathdiff",
135+
"perf-event-open-sys",
135136
"pkg-config",
136137
"polonius-engine",
137138
"ppv-lite86",

0 commit comments

Comments
 (0)