Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 415d8fc

Browse files
committedOct 19, 2022
Auto merge of rust-lang#103213 - matthiaskrgr:rollup-diloxg3, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#101889 (doc: rewrite doc for uint::{carrying_add,borrowing_sub}) - rust-lang#102507 (More slice::partition_point examples) - rust-lang#103164 (rustdoc: remove CSS ``@media` (min-width: 701px)`) - rust-lang#103189 (Clean up code-color and headers-color rustdoc GUI tests) - rust-lang#103203 (Retrieve LLVM version from llvm-filecheck binary if it is not set yet) - rust-lang#103204 (Add some more autolabels) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2efc90e + e0c162f commit 415d8fc

File tree

11 files changed

+232
-191
lines changed

11 files changed

+232
-191
lines changed
 

‎library/core/src/num/uint_macros.rs

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,37 +1469,42 @@ macro_rules! uint_impl {
14691469
(a as Self, b)
14701470
}
14711471

1472-
/// Calculates `self + rhs + carry` without the ability to overflow.
1472+
/// Calculates `self` + `rhs` + `carry` and returns a tuple containing
1473+
/// the sum and the output carry.
14731474
///
1474-
/// Performs "ternary addition" which takes in an extra bit to add, and may return an
1475-
/// additional bit of overflow. This allows for chaining together multiple additions
1476-
/// to create "big integers" which represent larger values.
1475+
/// Performs "ternary addition" of two integer operands and a carry-in
1476+
/// bit, and returns an output integer and a carry-out bit. This allows
1477+
/// chaining together multiple additions to create a wider addition, and
1478+
/// can be useful for bignum addition.
14771479
///
14781480
#[doc = concat!("This can be thought of as a ", stringify!($BITS), "-bit \"full adder\", in the electronics sense.")]
14791481
///
1480-
/// # Examples
1482+
/// If the input carry is false, this method is equivalent to
1483+
/// [`overflowing_add`](Self::overflowing_add), and the output carry is
1484+
/// equal to the overflow flag. Note that although carry and overflow
1485+
/// flags are similar for unsigned integers, they are different for
1486+
/// signed integers.
14811487
///
1482-
/// Basic usage
1488+
/// # Examples
14831489
///
14841490
/// ```
14851491
/// #![feature(bigint_helper_methods)]
1486-
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".carrying_add(2, false), (7, false));")]
1487-
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".carrying_add(2, true), (8, false));")]
1488-
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(1, false), (0, true));")]
1489-
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(0, true), (0, true));")]
1490-
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(1, true), (1, true));")]
1491-
#[doc = concat!("assert_eq!(",
1492-
stringify!($SelfT), "::MAX.carrying_add(", stringify!($SelfT), "::MAX, true), ",
1493-
"(", stringify!($SelfT), "::MAX, true));"
1494-
)]
1495-
/// ```
14961492
///
1497-
/// If `carry` is false, this method is equivalent to [`overflowing_add`](Self::overflowing_add):
1493+
#[doc = concat!("// 3 MAX (a = 3 × 2^", stringify!($BITS), " + 2^", stringify!($BITS), " - 1)")]
1494+
#[doc = concat!("// + 5 7 (b = 5 × 2^", stringify!($BITS), " + 7)")]
1495+
/// // ---------
1496+
#[doc = concat!("// 9 6 (sum = 9 × 2^", stringify!($BITS), " + 6)")]
14981497
///
1499-
/// ```
1500-
/// #![feature(bigint_helper_methods)]
1501-
#[doc = concat!("assert_eq!(5_", stringify!($SelfT), ".carrying_add(2, false), 5_", stringify!($SelfT), ".overflowing_add(2));")]
1502-
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(1, false), ", stringify!($SelfT), "::MAX.overflowing_add(1));")]
1498+
#[doc = concat!("let (a1, a0): (", stringify!($SelfT), ", ", stringify!($SelfT), ") = (3, ", stringify!($SelfT), "::MAX);")]
1499+
#[doc = concat!("let (b1, b0): (", stringify!($SelfT), ", ", stringify!($SelfT), ") = (5, 7);")]
1500+
/// let carry0 = false;
1501+
///
1502+
/// let (sum0, carry1) = a0.carrying_add(b0, carry0);
1503+
/// assert_eq!(carry1, true);
1504+
/// let (sum1, carry2) = a1.carrying_add(b1, carry1);
1505+
/// assert_eq!(carry2, false);
1506+
///
1507+
/// assert_eq!((sum1, sum0), (9, 6));
15031508
/// ```
15041509
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
15051510
#[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")]
@@ -1563,22 +1568,35 @@ macro_rules! uint_impl {
15631568
(a as Self, b)
15641569
}
15651570

1566-
/// Calculates `self - rhs - borrow` without the ability to overflow.
1571+
/// Calculates `self` − `rhs` − `borrow` and returns a tuple
1572+
/// containing the difference and the output borrow.
15671573
///
1568-
/// Performs "ternary subtraction" which takes in an extra bit to subtract, and may return
1569-
/// an additional bit of overflow. This allows for chaining together multiple subtractions
1570-
/// to create "big integers" which represent larger values.
1574+
/// Performs "ternary subtraction" by subtracting both an integer
1575+
/// operand and a borrow-in bit from `self`, and returns an output
1576+
/// integer and a borrow-out bit. This allows chaining together multiple
1577+
/// subtractions to create a wider subtraction, and can be useful for
1578+
/// bignum subtraction.
15711579
///
15721580
/// # Examples
15731581
///
1574-
/// Basic usage
1575-
///
15761582
/// ```
15771583
/// #![feature(bigint_helper_methods)]
1578-
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".borrowing_sub(2, false), (3, false));")]
1579-
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".borrowing_sub(2, true), (2, false));")]
1580-
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".borrowing_sub(1, false), (", stringify!($SelfT), "::MAX, true));")]
1581-
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".borrowing_sub(1, true), (", stringify!($SelfT), "::MAX - 1, true));")]
1584+
///
1585+
#[doc = concat!("// 9 6 (a = 9 × 2^", stringify!($BITS), " + 6)")]
1586+
#[doc = concat!("// - 5 7 (b = 5 × 2^", stringify!($BITS), " + 7)")]
1587+
/// // ---------
1588+
#[doc = concat!("// 3 MAX (diff = 3 × 2^", stringify!($BITS), " + 2^", stringify!($BITS), " - 1)")]
1589+
///
1590+
#[doc = concat!("let (a1, a0): (", stringify!($SelfT), ", ", stringify!($SelfT), ") = (9, 6);")]
1591+
#[doc = concat!("let (b1, b0): (", stringify!($SelfT), ", ", stringify!($SelfT), ") = (5, 7);")]
1592+
/// let borrow0 = false;
1593+
///
1594+
/// let (diff0, borrow1) = a0.borrowing_sub(b0, borrow0);
1595+
/// assert_eq!(borrow1, true);
1596+
/// let (diff1, borrow2) = a1.borrowing_sub(b1, borrow1);
1597+
/// assert_eq!(borrow2, false);
1598+
///
1599+
#[doc = concat!("assert_eq!((diff1, diff0), (3, ", stringify!($SelfT), "::MAX));")]
15821600
/// ```
15831601
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
15841602
#[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")]

‎library/core/src/slice/mod.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,6 +2359,28 @@ impl<T> [T] {
23592359
/// assert!(match r { Ok(1..=4) => true, _ => false, });
23602360
/// ```
23612361
///
2362+
/// If you want to find that whole *range* of matching items, rather than
2363+
/// an arbitrary matching one, that can be done using [`partition_point`]:
2364+
/// ```
2365+
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
2366+
///
2367+
/// let low = s.partition_point(|x| x < &1);
2368+
/// assert_eq!(low, 1);
2369+
/// let high = s.partition_point(|x| x <= &1);
2370+
/// assert_eq!(high, 5);
2371+
/// let r = s.binary_search(&1);
2372+
/// assert!((low..high).contains(&r.unwrap()));
2373+
///
2374+
/// assert!(s[..low].iter().all(|&x| x < 1));
2375+
/// assert!(s[low..high].iter().all(|&x| x == 1));
2376+
/// assert!(s[high..].iter().all(|&x| x > 1));
2377+
///
2378+
/// // For something not found, the "range" of equal items is empty
2379+
/// assert_eq!(s.partition_point(|x| x < &11), 9);
2380+
/// assert_eq!(s.partition_point(|x| x <= &11), 9);
2381+
/// assert_eq!(s.binary_search(&11), Err(9));
2382+
/// ```
2383+
///
23622384
/// If you want to insert an item to a sorted vector, while maintaining
23632385
/// sort order, consider using [`partition_point`]:
23642386
///
@@ -3787,6 +3809,16 @@ impl<T> [T] {
37873809
/// assert!(v[i..].iter().all(|&x| !(x < 5)));
37883810
/// ```
37893811
///
3812+
/// If all elements of the slice match the predicate, including if the slice
3813+
/// is empty, then the length of the slice will be returned:
3814+
///
3815+
/// ```
3816+
/// let a = [2, 4, 8];
3817+
/// assert_eq!(a.partition_point(|x| x < &100), a.len());
3818+
/// let a: [i32; 0] = [];
3819+
/// assert_eq!(a.partition_point(|x| x < &100), 0);
3820+
/// ```
3821+
///
37903822
/// If you want to insert an item to a sorted vector, while maintaining
37913823
/// sort order:
37923824
///

‎src/librustdoc/html/static/css/rustdoc.css

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ img {
437437

438438
.source-sidebar-expanded .source .sidebar {
439439
overflow-y: auto;
440+
width: 300px;
440441
}
441442

442443
.source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) {
@@ -1692,31 +1693,20 @@ details.rustdoc-toggle[open] > summary.hideme::after {
16921693
display: inline-block;
16931694
}
16941695

1695-
/* Media Queries */
1696-
1697-
/*
1698-
WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY;
1699-
If you update this line, then you also need to update the line with the same warning
1700-
in storage.js plus the media query with (max-width: 700px)
1701-
*/
1702-
@media (min-width: 701px) {
1703-
/* In case there is no documentation before a code block, we need to add some margin at the top
1704-
to prevent an overlay between the "collapse toggle" and the information tooltip.
1705-
However, it's not needed with smaller screen width because the doc/code block is always put
1706-
"one line" below. */
1707-
.docblock > .example-wrap:first-child .tooltip {
1708-
margin-top: 16px;
1709-
}
1710-
1711-
.source-sidebar-expanded .source .sidebar {
1712-
width: 300px;
1713-
}
1696+
/* In case there is no documentation before a code block, we need to add some margin at the top
1697+
to prevent an overlay between the "collapse toggle" and the information tooltip.
1698+
However, it's not needed with smaller screen width because the doc/code block is always put
1699+
"one line" below. */
1700+
.docblock > .example-wrap:first-child .tooltip {
1701+
margin-top: 16px;
17141702
}
17151703

1704+
/* Media Queries */
1705+
17161706
/*
17171707
WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY
17181708
If you update this line, then you also need to update the line with the same warning
1719-
in storage.js plus the media query with (min-width: 701px)
1709+
in storage.js
17201710
*/
17211711
@media (max-width: 700px) {
17221712
/* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,

‎src/librustdoc/html/static/js/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ function loadCss(cssFileName) {
737737

738738
window.rustdocMobileScrollLock = function() {
739739
const mobile_topbar = document.querySelector(".mobile-topbar");
740-
if (window.innerWidth < window.RUSTDOC_MOBILE_BREAKPOINT) {
740+
if (window.innerWidth <= window.RUSTDOC_MOBILE_BREAKPOINT) {
741741
// This is to keep the scroll position on mobile.
742742
oldSidebarScrollPosition = window.scrollY;
743743
document.body.style.width = `${document.body.offsetWidth}px`;
@@ -783,7 +783,7 @@ function loadCss(cssFileName) {
783783
}
784784

785785
window.addEventListener("resize", () => {
786-
if (window.innerWidth >= window.RUSTDOC_MOBILE_BREAKPOINT &&
786+
if (window.innerWidth > window.RUSTDOC_MOBILE_BREAKPOINT &&
787787
oldSidebarScrollPosition !== null) {
788788
// If the user opens the sidebar in "mobile" mode, and then grows the browser window,
789789
// we need to switch away from mobile mode and make the main content area scrollable.

‎src/librustdoc/html/static/js/storage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ window.currentTheme = document.getElementById("themeStyle");
1010
window.mainTheme = document.getElementById("mainThemeStyle");
1111

1212
// WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY
13-
// If you update this line, then you also need to update the two media queries with the same
13+
// If you update this line, then you also need to update the media query with the same
1414
// warning in rustdoc.css
15-
window.RUSTDOC_MOBILE_BREAKPOINT = 701;
15+
window.RUSTDOC_MOBILE_BREAKPOINT = 700;
1616

1717
const settingsDataset = (function() {
1818
const settingsElement = document.getElementById("default-settings");

‎src/test/rustdoc-gui/code-color.goml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,20 @@
55
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
66
// If the text isn't displayed, the browser doesn't compute color style correctly...
77
show-text: true
8-
// Set the theme to dark.
9-
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
10-
// We reload the page so the local storage settings are being used.
11-
reload:
128

13-
assert-css: (".docblock pre > code", {"color": "rgb(221, 221, 221)"}, ALL)
14-
assert-css: (".docblock > p > code", {"color": "rgb(221, 221, 221)"}, ALL)
9+
define-function: (
10+
"check-colors",
11+
(theme, doc_code_color, doc_inline_code_color),
12+
[
13+
// Set the theme.
14+
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
15+
// We reload the page so the local storage settings are being used.
16+
("reload"),
17+
("assert-css", (".docblock pre > code", {"color": |doc_code_color|}, ALL)),
18+
("assert-css", (".docblock > p > code", {"color": |doc_inline_code_color|}, ALL)),
19+
],
20+
)
1521

16-
// Set the theme to ayu.
17-
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
18-
// We reload the page so the local storage settings are being used.
19-
reload:
20-
21-
assert-css: (".docblock pre > code", {"color": "rgb(230, 225, 207)"}, ALL)
22-
assert-css: (".docblock > p > code", {"color": "rgb(255, 180, 84)"}, ALL)
23-
24-
// Set the theme to light.
25-
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
26-
// We reload the page so the local storage settings are being used.
27-
reload:
28-
29-
assert-css: (".docblock pre > code", {"color": "rgb(0, 0, 0)"}, ALL)
30-
assert-css: (".docblock > p > code", {"color": "rgb(0, 0, 0)"}, ALL)
22+
call-function: ("check-colors", ("ayu", "rgb(230, 225, 207)", "rgb(255, 180, 84)"))
23+
call-function: ("check-colors", ("dark", "rgb(221, 221, 221)", "rgb(221, 221, 221)"))
24+
call-function: ("check-colors", ("light", "rgb(0, 0, 0)", "rgb(0, 0, 0)"))
Lines changed: 63 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,70 @@
11
// This test check for headers text and background colors for the different themes.
2-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
32

4-
// This is needed so that the text color is computed.
5-
show-text: true
6-
7-
// Ayu theme
8-
local-storage: {
9-
"rustdoc-theme": "ayu",
10-
"rustdoc-preferred-dark-theme": "ayu",
11-
"rustdoc-use-system-theme": "false",
12-
}
13-
reload:
14-
15-
assert-css: (
16-
".impl",
17-
{"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
18-
ALL,
19-
)
20-
assert-css: (
21-
".impl .code-header",
22-
{"color": "rgb(230, 225, 207)", "background-color": "rgba(0, 0, 0, 0)"},
23-
ALL,
3+
define-function: (
4+
"check-colors",
5+
(theme, color, code_header_color, focus_background_color, headings_color),
6+
[
7+
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"),
8+
// This is needed so that the text color is computed.
9+
("show-text", true),
10+
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
11+
("reload"),
12+
("assert-css", (
13+
".impl",
14+
{"color": |color|, "background-color": "rgba(0, 0, 0, 0)"},
15+
ALL,
16+
)),
17+
("assert-css", (
18+
".impl .code-header",
19+
{"color": |code_header_color|, "background-color": "rgba(0, 0, 0, 0)"},
20+
ALL,
21+
)),
22+
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"),
23+
("assert-css", (
24+
"#impl-Foo",
25+
{"color": |color|, "background-color": |focus_background_color|},
26+
)),
27+
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"),
28+
("assert-css", (
29+
"#method\.must_use",
30+
{"color": |color|, "background-color": |focus_background_color|},
31+
ALL,
32+
)),
33+
("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"),
34+
("assert-css", (".small-section-header a", {"color": |color|}, ALL)),
35+
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"),
36+
// We select headings (h2, h3, h...).
37+
("assert-css", (".docblock > :not(p) > a", {"color": |headings_color|}, ALL)),
38+
],
2439
)
2540

26-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
27-
assert-css: (
28-
"#impl-Foo",
29-
{"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"},
41+
call-function: (
42+
"check-colors",
43+
{
44+
"theme": "ayu",
45+
"color": "rgb(197, 197, 197)",
46+
"code_header_color": "rgb(230, 225, 207)",
47+
"focus_background_color": "rgba(255, 236, 164, 0.06)",
48+
"headings_color": "rgb(57, 175, 215)",
49+
},
3050
)
31-
32-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
33-
assert-css: (
34-
"#method\.must_use",
35-
{"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"},
36-
ALL,
51+
call-function: (
52+
"check-colors",
53+
{
54+
"theme": "dark",
55+
"color": "rgb(221, 221, 221)",
56+
"code_header_color": "rgb(221, 221, 221)",
57+
"focus_background_color": "rgb(73, 74, 61)",
58+
"headings_color": "rgb(210, 153, 29)",
59+
},
3760
)
38-
39-
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
40-
assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL)
41-
42-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
43-
// We select headings (h2, h3, h...).
44-
assert-css: (".docblock > :not(p) > a", {"color": "rgb(57, 175, 215)"}, ALL)
45-
46-
// Dark theme
47-
local-storage: {
48-
"rustdoc-theme": "dark",
49-
"rustdoc-preferred-dark-theme": "dark",
50-
"rustdoc-use-system-theme": "false",
51-
}
52-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
53-
54-
assert-css: (
55-
".impl",
56-
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
57-
ALL,
58-
)
59-
assert-css: (
60-
".impl .code-header",
61-
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
62-
ALL,
63-
)
64-
65-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
66-
assert-css: (
67-
"#impl-Foo",
68-
{"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"},
69-
)
70-
71-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
72-
assert-css: (
73-
"#method\.must_use",
74-
{"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"},
75-
ALL,
61+
call-function: (
62+
"check-colors",
63+
{
64+
"theme": "light",
65+
"color": "rgb(0, 0, 0)",
66+
"code_header_color": "rgb(0, 0, 0)",
67+
"focus_background_color": "rgb(253, 255, 211)",
68+
"headings_color": "rgb(56, 115, 173)",
69+
},
7670
)
77-
78-
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
79-
assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL)
80-
81-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
82-
// We select headings (h2, h3, h...).
83-
assert-css: (".docblock > :not(p) > a", {"color": "rgb(210, 153, 29)"}, ALL)
84-
85-
// Light theme
86-
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
87-
reload:
88-
89-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
90-
91-
assert-css: (
92-
".impl",
93-
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
94-
ALL,
95-
)
96-
assert-css: (
97-
".impl .code-header",
98-
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
99-
ALL,
100-
)
101-
102-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
103-
assert-css: ("#impl-Foo", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"})
104-
105-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
106-
assert-css: (
107-
"#method\.must_use",
108-
{"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"},
109-
ALL,
110-
)
111-
112-
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
113-
assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL)
114-
115-
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
116-
// We select headings (h2, h3, h...).
117-
assert-css: (".docblock > :not(p) > a", {"color": "rgb(56, 115, 173)"}, ALL)

‎src/test/rustdoc-gui/sidebar-mobile-scroll.goml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// This test ensures that the mobile sidebar preserves scroll position.
22
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
33
// Switching to "mobile view" by reducing the width to 600px.
4-
size: (600, 600)
4+
size: (700, 600)
55
assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
66

77
// Scroll down.
88
scroll-to: "//h2[@id='blanket-implementations']"
9-
assert-window-property: {"pageYOffset": "651"}
9+
assert-window-property: {"pageYOffset": "627"}
1010

1111
// Open the sidebar menu.
1212
click: ".sidebar-menu-toggle"
@@ -21,11 +21,11 @@ assert-window-property: {"pageYOffset": "0"}
2121
// Close the sidebar menu. Make sure the scroll position gets restored.
2222
click: ".sidebar-menu-toggle"
2323
wait-for-css: (".sidebar", {"left": "-1000px"})
24-
assert-window-property: {"pageYOffset": "651"}
24+
assert-window-property: {"pageYOffset": "627"}
2525

2626
// Now test that scrollability returns when the browser window is just resized.
2727
click: ".sidebar-menu-toggle"
2828
wait-for-css: (".sidebar", {"left": "0px"})
2929
assert-window-property: {"pageYOffset": "0"}
3030
size: (900, 600)
31-
assert-window-property: {"pageYOffset": "651"}
31+
assert-window-property: {"pageYOffset": "627"}

‎src/tools/compiletest/src/header.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::fs::File;
44
use std::io::prelude::*;
55
use std::io::BufReader;
66
use std::path::{Path, PathBuf};
7+
use std::process::Command;
78

89
use tracing::*;
910

@@ -843,6 +844,20 @@ pub fn extract_llvm_version(version: &str) -> Option<u32> {
843844
Some(version)
844845
}
845846

847+
pub fn extract_llvm_version_from_binary(binary_path: &str) -> Option<u32> {
848+
let output = Command::new(binary_path).arg("--version").output().ok()?;
849+
if !output.status.success() {
850+
return None;
851+
}
852+
let version = String::from_utf8(output.stdout).ok()?;
853+
for line in version.lines() {
854+
if let Some(version) = line.split("LLVM version ").skip(1).next() {
855+
return extract_llvm_version(version);
856+
}
857+
}
858+
None
859+
}
860+
846861
/// Takes a directive of the form "<version1> [- <version2>]",
847862
/// returns the numeric representation of <version1> and <version2> as
848863
/// tuple: (<version1> as u32, <version2> as u32)

‎src/tools/compiletest/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ pub fn parse_config(args: Vec<String>) -> Config {
200200
Some(x) => panic!("argument for --color must be auto, always, or never, but found `{}`", x),
201201
};
202202
let llvm_version =
203-
matches.opt_str("llvm-version").as_deref().and_then(header::extract_llvm_version);
203+
matches.opt_str("llvm-version").as_deref().and_then(header::extract_llvm_version).or_else(
204+
|| header::extract_llvm_version_from_binary(&matches.opt_str("llvm-filecheck")?),
205+
);
204206

205207
let src_base = opt_path(matches, "src-base");
206208
let run_ignored = matches.opt_present("ignored");

‎triagebot.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ trigger_files = [
183183
"x.ps1",
184184
"src/bootstrap",
185185
"src/tools/rust-installer",
186+
"configure",
187+
"Cargo.toml",
188+
"Cargo.lock",
189+
"config.toml.example",
190+
"src/stage0.json"
186191
]
187192

188193
[autolabel."T-infra"]
@@ -210,6 +215,38 @@ trigger_files = [
210215
"compiler/rustc_macros/src/query.rs"
211216
]
212217

218+
[autolabel."A-testsuite"]
219+
trigger_files = [
220+
"src/test",
221+
"src/ci",
222+
"src/tools/compiletest",
223+
"src/tools/cargotest",
224+
"src/tools/tidy",
225+
"src/tools/remote-test-server",
226+
"src/tools/remote-test-client",
227+
"src/tools/tier-check"
228+
]
229+
230+
[autolabel."A-meta"]
231+
trigger_files = [
232+
"triagebot.toml",
233+
"rustfmt.toml",
234+
"LICENSES",
235+
"README.md",
236+
"CONTRIBUTING.md",
237+
".reuse",
238+
".mailmap",
239+
".git-blame-ignore-revs",
240+
".editorconfig"
241+
]
242+
243+
[autolabel."T-release"]
244+
trigger_files = [
245+
"RELEASES.md",
246+
"src/stage0.json",
247+
"src/version"
248+
]
249+
213250
[notify-zulip."I-prioritize"]
214251
zulip_stream = 245100 # #t-compiler/wg-prioritization/alerts
215252
topic = "#{number} {title}"

0 commit comments

Comments
 (0)
Please sign in to comment.