Skip to content

Commit c274e49

Browse files
committed
Auto merge of rust-lang#94648 - RalfJung:rollup-4iorcrd, r=RalfJung
Rollup of 4 pull requests Successful merges: - rust-lang#94630 (Update note about tier 2 docs.) - rust-lang#94633 (Suggest removing a semicolon after derive attributes) - rust-lang#94642 (Fix source code pages scroll) - rust-lang#94645 (do not attempt to open cgroup files under Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ab2bd41 + 00fd87e commit c274e49

File tree

8 files changed

+93
-11
lines changed

8 files changed

+93
-11
lines changed

compiler/rustc_parse/src/parser/item.rs

+10
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,16 @@ impl<'a> Parser<'a> {
449449
if end.is_doc_comment() {
450450
err.span_label(end.span, "this doc comment doesn't document anything");
451451
}
452+
if end.meta_kind().is_some() {
453+
if self.token.kind == TokenKind::Semi {
454+
err.span_suggestion_verbose(
455+
self.token.span,
456+
"consider removing this semicolon",
457+
String::new(),
458+
Applicability::MaybeIncorrect,
459+
);
460+
}
461+
}
452462
if let [.., penultimate, _] = attrs {
453463
err.span_label(start.span.to(penultimate.span), "other attributes here");
454464
}

library/std/src/sys/unix/thread.rs

+5
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,11 @@ fn cgroup2_quota() -> usize {
384384
use crate::path::PathBuf;
385385

386386
let mut quota = usize::MAX;
387+
if cfg!(miri) {
388+
// Attempting to open a file fails under default flags due to isolation.
389+
// And Miri does not have parallelism anyway.
390+
return quota;
391+
}
387392

388393
let _: Option<()> = try {
389394
let mut buf = Vec::with_capacity(128);

src/doc/rustc/src/platform-support.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ Tier Policy.
7373

7474
All tier 2 targets with host tools support the full standard library.
7575

76-
**NOTE:** Tier 2 targets currently do not build the `rust-docs` component.
76+
**NOTE:** The `rust-docs` component is not usually built for tier 2 targets,
77+
so Rustup may install the documentation for a similar tier 1 target instead.
7778

7879
target | notes
7980
-------|-------
@@ -114,7 +115,8 @@ The `std` column in the table below has the following meanings:
114115

115116
[`no_std`]: https://rust-embedded.github.io/book/intro/no-std.html
116117

117-
**NOTE:** Tier 2 targets currently do not build the `rust-docs` component.
118+
**NOTE:** The `rust-docs` component is not usually built for tier 2 targets,
119+
so Rustup may install the documentation for a similar tier 1 target instead.
118120

119121
target | std | notes
120122
-------|:---:|-------

src/librustdoc/html/static/js/source-script.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function createSourceSidebar() {
149149

150150
var lineNumbersRegex = /^#?(\d+)(?:-(\d+))?$/;
151151

152-
function highlightSourceLines(scrollTo, match) {
152+
function highlightSourceLines(match) {
153153
if (typeof match === "undefined") {
154154
match = window.location.hash.match(lineNumbersRegex);
155155
}
@@ -170,11 +170,9 @@ function highlightSourceLines(scrollTo, match) {
170170
if (!elem) {
171171
return;
172172
}
173-
if (scrollTo) {
174-
var x = document.getElementById(from);
175-
if (x) {
176-
x.scrollIntoView();
177-
}
173+
var x = document.getElementById(from);
174+
if (x) {
175+
x.scrollIntoView();
178176
}
179177
onEachLazy(document.getElementsByClassName("line-numbers"), function(e) {
180178
onEachLazy(e.getElementsByTagName("span"), function(i_e) {
@@ -198,7 +196,7 @@ var handleSourceHighlight = (function() {
198196
y = window.scrollY;
199197
if (searchState.browserSupportsHistoryApi()) {
200198
history.replaceState(null, null, "#" + name);
201-
highlightSourceLines(true);
199+
highlightSourceLines();
202200
} else {
203201
location.replace("#" + name);
204202
}
@@ -230,15 +228,15 @@ var handleSourceHighlight = (function() {
230228
window.addEventListener("hashchange", function() {
231229
var match = window.location.hash.match(lineNumbersRegex);
232230
if (match) {
233-
return highlightSourceLines(false, match);
231+
return highlightSourceLines(match);
234232
}
235233
});
236234

237235
onEachLazy(document.getElementsByClassName("line-numbers"), function(el) {
238236
el.addEventListener("click", handleSourceHighlight);
239237
});
240238

241-
highlightSourceLines(true);
239+
highlightSourceLines();
242240

243241
window.createSourceSidebar = createSourceSidebar;
244242
})();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// We check that when the anchor changes and is output of the displayed content,
2+
// the page is scrolled to it.
3+
goto: file://|DOC_PATH|/src/link_to_definition/lib.rs.html
4+
5+
// We reduce the window size to make it easier to make an element "out of the page".
6+
size: (600, 800)
7+
// We check that the scroll is at the top first.
8+
assert-property: ("html", {"scrollTop": "0"})
9+
10+
click: '//a[text() = "barbar"]'
11+
assert-property: ("html", {"scrollTop": "125"})
12+
click: '//a[text() = "bar"]'
13+
assert-property: ("html", {"scrollTop": "166"})
14+
click: '//a[text() = "sub_fn"]'
15+
assert-property: ("html", {"scrollTop": "53"})
16+
17+
// We now check that clicking on lines doesn't change the scroll
18+
// Extra information: the "sub_fn" function header is on line 1.
19+
click: '//*[@id="6"]'
20+
assert-property: ("html", {"scrollTop": "53"})
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
1+
pub fn sub_fn() {
2+
barbar();
3+
}
4+
fn barbar() {
5+
bar(vec![], vec![], vec![], vec![], Bar { a: "a".into(), b: 0 });
6+
}
7+
18
pub struct Bar {
29
pub a: String,
310
pub b: u32,
411
}
512

613
pub fn foo(_b: &Bar) {}
14+
15+
// The goal now is to add
16+
// a lot of lines so
17+
// that the next content
18+
// will be out of the screen
19+
// to allow us to test that
20+
// if the anchor changes to
21+
// something outside of the
22+
// current view, it'll
23+
// scroll to it as expected.
24+
25+
// More filling content.
26+
27+
pub fn bar(
28+
_a: Vec<String>,
29+
_b: Vec<String>,
30+
_c: Vec<String>,
31+
_d: Vec<String>,
32+
_e: Bar,
33+
) {
34+
sub_fn();
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#[derive(Debug, Clone)]; //~ERROR expected item after attributes
2+
struct Foo;
3+
4+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: expected item after attributes
2+
--> $DIR/attr-with-a-semicolon.rs:1:1
3+
|
4+
LL | #[derive(Debug, Clone)];
5+
| ^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
help: consider removing this semicolon
8+
|
9+
LL - #[derive(Debug, Clone)];
10+
LL + #[derive(Debug, Clone)]
11+
|
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)