Skip to content

Commit b082bd5

Browse files
committed
Auto merge of #150496 - JonathanBrouwer:rollup-va9ofgq, r=JonathanBrouwer
Rollup of 3 pull requests Successful merges: - #150396 ([rustdoc] If line number setting is disabled, do not make line numbers take space) - #150489 (Disable debuginfo when building GCC) - #150490 (Specify bug URL when building GCC) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 67944d6 + 18b3b66 commit b082bd5

4 files changed

Lines changed: 77 additions & 56 deletions

File tree

src/bootstrap/src/core/build_steps/gcc.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ fn build_gcc(metadata: &Meta, builder: &Builder<'_>, target_pair: GccTargetPair)
325325
.arg("--enable-checking=release")
326326
.arg("--disable-bootstrap")
327327
.arg("--disable-multilib")
328+
.arg("--with-bugurl=https://github.com/rust-lang/gcc/")
328329
.arg(format!("--prefix={}", install_dir.display()));
329330

330331
let cc = builder.build.cc(host).display().to_string();
@@ -346,6 +347,9 @@ fn build_gcc(metadata: &Meta, builder: &Builder<'_>, target_pair: GccTargetPair)
346347
.map_or_else(|| cxx.clone(), |ccache| format!("{ccache} {cxx}"));
347348
configure_cmd.env("CXX", cxx);
348349
}
350+
// Disable debuginfo to reduce size of libgccjit.so 10x
351+
configure_cmd.env("CXXFLAGS", "-O2 -g0");
352+
configure_cmd.env("CFLAGS", "-O2 -g0");
349353
configure_cmd.run(builder);
350354

351355
command("make")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ rustdoc-topbar {
997997
.example-wrap [data-nosnippet] {
998998
width: calc(var(--example-wrap-digits-count) + var(--line-number-padding) * 2);
999999
}
1000-
.example-wrap pre > code {
1000+
.example-wrap:not(.hide-lines) pre > code {
10011001
padding-left: calc(
10021002
var(--example-wrap-digits-count) + var(--line-number-padding) * 2
10031003
+ var(--line-number-right-margin));

tests/rustdoc-gui/docblock-code-block-line-number.goml

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
// Checks that the setting "line numbers" is working as expected.
22
include: "utils.goml"
3+
34
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
45

6+
// Otherwise, we can't check text color
7+
show-text: true
8+
9+
store-value: (line_numbers_selector, ".example-wrap pre.rust code [data-nosnippet]")
510
// We check that without this setting, there is no line number displayed.
6-
assert-false: "pre.example-line-numbers"
11+
assert-count: (|line_numbers_selector|, 0)
712

813
// All corners should be rounded.
914
assert-css: (
@@ -17,14 +22,16 @@ assert-css: (
1722
ALL,
1823
)
1924

20-
// We set the setting to show the line numbers on code examples.
21-
set-local-storage: {"rustdoc-line-numbers": "true"}
22-
reload:
23-
// We wait for the line numbers to be added into the DOM by the JS...
24-
wait-for: ".digits-1 pre"
25+
// Before we add line numbers, we get the X position of a span in a code example that we will
26+
// use later on to ensure that when we disable the line numbers, it goes back to its original
27+
// position.
28+
store-position: (".example-wrap code .macro", {"x": span_x_pos})
2529

26-
// Otherwise, we can't check text color
27-
show-text: true
30+
// We enable the setting to show the line numbers on code examples.
31+
call-function: ("switch-line-numbers-setting", {"expected_status": "true"})
32+
// We ensure that there are actually line numbers generated in the DOM.
33+
assert-text: (".example-wrap pre.rust code span[data-nosnippet]", "1")
34+
assert-position-false: (".example-wrap code .macro", {"x": |span_x_pos|})
2835

2936
// Let's now check some CSS properties...
3037
define-function: (
@@ -68,20 +75,18 @@ call-function: ("check-colors", {
6875
// Now, try changing the setting dynamically. We'll turn it off, using the settings menu,
6976
// and make sure it goes away.
7077

71-
// First, open the settings menu.
72-
click: "rustdoc-toolbar .settings-menu"
73-
wait-for: "#settings"
74-
assert-css: ("#settings", {"display": "block"})
78+
call-function: ("switch-line-numbers-setting", {"expected_status": "false"})
79+
assert: ".digits-1.hide-lines"
7580

76-
// Then, click the toggle button.
77-
click: "input#line-numbers"
78-
wait-for: ".digits-1.hide-lines"
79-
assert-local-storage: {"rustdoc-line-numbers": "false" }
81+
// The line numbers not being displayed, their "space" should have disappear as well.
82+
assert-position: (".example-wrap code .macro", {"x": |span_x_pos|})
8083

8184
// Finally, turn it on again.
82-
click: "input#line-numbers"
85+
call-function: ("switch-line-numbers-setting", {"expected_status": "true"})
8386
wait-for: ".digits-1:not(.hide-lines)"
84-
assert-local-storage: {"rustdoc-line-numbers": "true" }
87+
88+
// The line numbers are being displayed, their "space" should be back.
89+
assert-position-false: (".example-wrap code .macro", {"x": |span_x_pos|})
8590

8691
// Same check with scraped examples line numbers.
8792
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
@@ -119,26 +124,14 @@ call-function: ("check-padding", {
119124
})
120125

121126
define-function: ("check-line-numbers-existence", [], block {
122-
assert-local-storage: {"rustdoc-line-numbers": "true" }
123-
assert-false: ".example-line-numbers"
124-
click: "rustdoc-toolbar .settings-menu"
125-
wait-for: "#settings"
126-
127-
// Then, click the toggle button.
128-
click: "input#line-numbers"
129-
wait-for-local-storage-false: {"rustdoc-line-numbers": "true" }
130-
assert-false: ".example-line-numbers"
131-
// Line numbers should still be there.
132-
assert-css: ("[data-nosnippet]", { "display": "block"})
133-
// Now disabling the setting.
134-
click: "input#line-numbers"
135-
wait-for-local-storage: {"rustdoc-line-numbers": "true" }
136-
assert-false: ".example-line-numbers"
127+
assert-local-storage: {"rustdoc-line-numbers": "true"}
128+
assert-count-false: (|line_numbers_selector|, 0)
129+
call-function: ("switch-line-numbers-setting", {"expected_status": "false"})
137130
// Line numbers should still be there.
138-
assert-css: ("[data-nosnippet]", { "display": "block"})
139-
// Closing settings menu.
140-
click: "rustdoc-toolbar .settings-menu"
141-
wait-for-css: ("#settings", {"display": "none"})
131+
assert-count-false: (|line_numbers_selector|, 0)
132+
assert-css: (|line_numbers_selector|, {"display": "block"})
133+
// Now re-enabling the setting.
134+
call-function: ("switch-line-numbers-setting", {"expected_status": "true"})
142135
})
143136

144137
// Checking that turning off the line numbers setting won't remove line numbers from scraped
@@ -168,16 +161,11 @@ assert: ".example-wrap > pre.rust"
168161
assert-count: (".example-wrap", 2)
169162
assert-count: (".example-wrap.digits-1", 2)
170163

171-
click: "rustdoc-toolbar .settings-menu"
172-
wait-for: "#settings"
173-
174-
// Then, click the toggle button.
175-
click: "input#line-numbers"
164+
// Disabling the line numbers setting.
165+
call-function: ("switch-line-numbers-setting", {"expected_status": "false"})
176166
wait-for-count: (".example-wrap.digits-1.hide-lines", 2)
177-
assert-local-storage-false: {"rustdoc-line-numbers": "true" }
178167

179-
// Now turning off the setting.
180-
click: "input#line-numbers"
168+
// Now re-enabling the setting.
169+
call-function: ("switch-line-numbers-setting", {"expected_status": "true"})
181170
wait-for-count: (".example-wrap.digits-1", 2)
182171
wait-for-count: (".example-wrap.digits-1.hide-lines", 0)
183-
assert-local-storage: {"rustdoc-line-numbers": "true" }

tests/rustdoc-gui/utils.goml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,52 @@
11
// This file contains code to be re-used by other tests.
2+
23
define-function: (
3-
"switch-theme",
4-
[theme],
4+
"open-settings-menu",
5+
[],
56
block {
6-
// Set the theme.
77
// Open the settings menu.
88
click: "rustdoc-toolbar .settings-menu"
99
// Wait for the popover to appear...
10-
wait-for: "#settings"
10+
wait-for-css: ("#settings", {"display": "block"})
11+
}
12+
)
13+
14+
define-function: (
15+
"close-settings-menu",
16+
[],
17+
block {
18+
click: "rustdoc-toolbar .settings-menu"
19+
wait-for-css-false: ("#settings", {"display": "block"})
20+
}
21+
)
22+
23+
define-function: (
24+
"switch-theme",
25+
[theme],
26+
block {
27+
// Set the theme.
28+
call-function: ("open-settings-menu", {})
1129
// Change the setting.
1230
click: "#theme-"+ |theme|
13-
// Close the popover.
14-
click: "rustdoc-toolbar .settings-menu"
31+
call-function: ("close-settings-menu", {})
1532
// Ensure that the local storage was correctly updated.
1633
assert-local-storage: {"rustdoc-theme": |theme|}
1734
},
1835
)
1936

37+
// FIXME: To be removed once `browser-ui-test` has conditions.
2038
define-function: (
2139
"switch-theme-mobile",
2240
[theme],
2341
block {
24-
// Set the theme.
2542
// Open the settings menu.
2643
click: "rustdoc-topbar .settings-menu"
2744
// Wait for the popover to appear...
28-
wait-for: "#settings"
45+
wait-for-css: ("#settings", {"display": "block"})
2946
// Change the setting.
3047
click: "#theme-"+ |theme|
31-
// Close the popover.
3248
click: "rustdoc-topbar .settings-menu"
49+
wait-for-css-false: ("#settings", {"display": "block"})
3350
// Ensure that the local storage was correctly updated.
3451
assert-local-storage: {"rustdoc-theme": |theme|}
3552
},
@@ -56,3 +73,15 @@ define-function: (
5673
wait-for-false: "#search-tabs .count.loading"
5774
}
5875
)
76+
77+
define-function: (
78+
"switch-line-numbers-setting",
79+
[expected_status],
80+
block {
81+
call-function: ("open-settings-menu", {})
82+
// We change the line numbers setting.
83+
click: "#line-numbers"
84+
call-function: ("close-settings-menu", {})
85+
assert-local-storage: {"rustdoc-line-numbers": |expected_status|}
86+
}
87+
)

0 commit comments

Comments
 (0)