Skip to content

Commit 10505a1

Browse files
committed
Auto merge of rust-lang#124489 - matthiaskrgr:rollup-7pa86bf, r=matthiaskrgr
Rollup of 2 pull requests Successful merges: - rust-lang#123734 (Inline more svg images into CSS) - rust-lang#124473 (Port `print-cfg` run-make test to Rust-based rmake.rs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ce609db + 6edb721 commit 10505a1

File tree

8 files changed

+203
-44
lines changed

8 files changed

+203
-44
lines changed

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

+29-2
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
11331133
.setting-check input:checked {
11341134
background-color: var(--settings-input-color);
11351135
border-width: 1px;
1136+
/* cross-mark image in the settings checkboxes */
11361137
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">\
11371138
<path d="M7,25L17,32L33,12" fill="none" stroke="black" stroke-width="5"/>\
11381139
<path d="M7,23L17,30L33,10" fill="none" stroke="white" stroke-width="5"/></svg>');
@@ -1608,12 +1609,26 @@ a.tooltip:hover::after {
16081609
font-size: 0;
16091610
}
16101611
#settings-menu > a:before {
1611-
content: url('wheel-63255fc4502dca9a.svg');
1612+
/* Wheel <https://www.svgrepo.com/svg/384069/settings-cog-gear> */
1613+
content: url('data:image/svg+xml,<svg width="22" height="22" viewBox="0 0 12 12" \
1614+
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg">\
1615+
<path d="M10.25,6c0-0.1243286-0.0261841-0.241333-0.0366211-0.362915l1.6077881-1.5545654l\
1616+
-1.25-2.1650391 c0,0-1.2674561,0.3625488-2.1323853,0.6099854c-0.2034912-0.1431885-0.421875\
1617+
-0.2639771-0.6494751-0.3701782L7.25,0h-2.5 c0,0-0.3214111,1.2857666-0.5393066,2.1572876\
1618+
C3.9830933,2.2634888,3.7647095,2.3842773,3.5612183,2.5274658L1.428833,1.9174805 \
1619+
l-1.25,2.1650391c0,0,0.9641113,0.9321899,1.6077881,1.5545654C1.7761841,5.758667,\
1620+
1.75,5.8756714,1.75,6 s0.0261841,0.241333,0.0366211,0.362915L0.178833,7.9174805l1.25,\
1621+
2.1650391l2.1323853-0.6099854 c0.2034912,0.1432495,0.421875,0.2639771,0.6494751,0.3701782\
1622+
L4.75,12h2.5l0.5393066-2.1572876 c0.2276001-0.1062012,0.4459839-0.2269287,0.6494751\
1623+
-0.3701782l2.1323853,0.6099854l1.25-2.1650391L10.2133789,6.362915 C10.2238159,6.241333,\
1624+
10.25,6.1243286,10.25,6z M6,7.5C5.1715698,7.5,4.5,6.8284302,4.5,6S5.1715698,4.5,6,4.5S7.5\
1625+
,5.1715698,7.5,6 S6.8284302,7.5,6,7.5z" fill="black"/></svg>');
16121626
width: 22px;
16131627
height: 22px;
16141628
}
16151629

16161630
#sidebar-button > a:before {
1631+
/* sidebar resizer image */
16171632
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" \
16181633
fill="none" stroke="black">\
16191634
<rect x="1" y="1" width="20" height="20" ry="1.5" stroke-width="1.5"/>\
@@ -1636,7 +1651,17 @@ a.tooltip:hover::after {
16361651
}
16371652
#copy-path::before {
16381653
filter: var(--copy-path-img-filter);
1639-
content: url('clipboard-24048e6d87f63d07.svg');
1654+
/* clipboard <https://github.com/rust-lang/crates.io/commits/main/public/assets/copy.svg> */
1655+
content: url('data:image/svg+xml,<svg width="19" height="18" viewBox="0 0 24 25" \
1656+
xmlns="http://www.w3.org/2000/svg" aria-label="Copy to clipboard">\
1657+
<path d="M18 20h2v3c0 1-1 2-2 2H2c-.998 0-2-1-2-2V5c0-.911.755-1.667 1.667-1.667h5A3.323 3.323 0 \
1658+
0110 0a3.323 3.323 0 013.333 3.333h5C19.245 3.333 20 4.09 20 5v8.333h-2V9H2v14h16v-3zM3 \
1659+
7h14c0-.911-.793-1.667-1.75-1.667H13.5c-.957 0-1.75-.755-1.75-1.666C11.75 2.755 10.957 2 10 \
1660+
2s-1.75.755-1.75 1.667c0 .911-.793 1.666-1.75 1.666H4.75C3.793 5.333 3 6.09 3 7z"/>\
1661+
<path d="M4 19h6v2H4zM12 11H4v2h8zM4 17h4v-2H4zM15 15v-3l-4.5 4.5L15 21v-3l8.027-.032L23 15z"/>\
1662+
</svg>');
1663+
width: 19px;
1664+
height: 18px;
16401665
}
16411666
#copy-path:hover::before {
16421667
filter: var(--copy-path-img-hover-filter);
@@ -1837,6 +1862,7 @@ However, it's not needed with smaller screen width because the doc/code block is
18371862
/* sidebar button opens modal
18381863
use hamburger button */
18391864
.src #sidebar-button > a:before, .sidebar-menu-toggle:before {
1865+
/* hamburger button image */
18401866
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
18411867
viewBox="0 0 22 22" fill="none" stroke="black">\
18421868
<path d="M3,5h16M3,11h16M3,17h16" stroke-width="2.75"/></svg>');
@@ -1850,6 +1876,7 @@ However, it's not needed with smaller screen width because the doc/code block is
18501876

18511877
/* src sidebar button opens a folder view */
18521878
.src #sidebar-button > a:before {
1879+
/* folder image */
18531880
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
18541881
viewBox="0 0 22 22" fill="none" stroke="black">\
18551882
<path d="M16,9v-4h-6v-1l-2,-2h-4l-2,2v16h13L21,9h-15L2,19" stroke-width="1.25"/>\

src/librustdoc/html/static/images/clipboard.svg

-1
This file was deleted.

src/librustdoc/html/static/images/wheel.svg

-1
This file was deleted.

src/librustdoc/html/static_files.rs

-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ static_files! {
9999
src_script_js => "static/js/src-script.js",
100100
storage_js => "static/js/storage.js",
101101
scrape_examples_js => "static/js/scrape-examples.js",
102-
wheel_svg => "static/images/wheel.svg",
103-
clipboard_svg => "static/images/clipboard.svg",
104102
copyright => "static/COPYRIGHT.txt",
105103
license_apache => "static/LICENSE-APACHE.txt",
106104
license_mit => "static/LICENSE-MIT.txt",

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ run-make/prefer-rlib/Makefile
219219
run-make/pretty-print-to-file/Makefile
220220
run-make/pretty-print-with-dep-file/Makefile
221221
run-make/print-calling-conventions/Makefile
222-
run-make/print-cfg/Makefile
223222
run-make/print-target-list/Makefile
224223
run-make/profile/Makefile
225224
run-make/prune-link-args/Makefile

tests/run-make/print-cfg/Makefile

-37
This file was deleted.

tests/run-make/print-cfg/rmake.rs

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
//! This checks the output of `--print=cfg`
2+
//!
3+
//! Specifically it checks that output is correctly formatted
4+
//! (ie. no duplicated cfgs, values are between "", names are not).
5+
//!
6+
//! It also checks that some targets have the correct set cfgs.
7+
8+
extern crate run_make_support;
9+
10+
use std::collections::HashSet;
11+
use std::ffi::OsString;
12+
use std::io::BufRead;
13+
use std::iter::FromIterator;
14+
15+
use run_make_support::{rustc, tmp_dir};
16+
17+
struct PrintCfg {
18+
target: &'static str,
19+
includes: &'static [&'static str],
20+
disallow: &'static [&'static str],
21+
}
22+
23+
fn main() {
24+
check(PrintCfg {
25+
target: "x86_64-pc-windows-gnu",
26+
includes: &["windows", "target_arch=\"x86_64\""],
27+
disallow: &["unix"],
28+
});
29+
check(PrintCfg {
30+
target: "i686-pc-windows-msvc",
31+
includes: &["windows", "target_env=\"msvc\""],
32+
disallow: &["unix"],
33+
});
34+
check(PrintCfg {
35+
target: "i686-apple-darwin",
36+
includes: &["unix", "target_os=\"macos\"", "target_vendor=\"apple\""],
37+
disallow: &["windows"],
38+
});
39+
check(PrintCfg {
40+
target: "i686-unknown-linux-gnu",
41+
includes: &["unix", "target_env=\"gnu\""],
42+
disallow: &["windows"],
43+
});
44+
check(PrintCfg {
45+
target: "arm-unknown-linux-gnueabihf",
46+
includes: &["unix", "target_abi=\"eabihf\""],
47+
disallow: &["windows"],
48+
});
49+
}
50+
51+
fn check(PrintCfg { target, includes, disallow }: PrintCfg) {
52+
fn check_(output: &str, includes: &[&str], disallow: &[&str]) {
53+
let mut found = HashSet::<String>::new();
54+
let mut recorded = HashSet::<String>::new();
55+
56+
for l in output.lines() {
57+
assert!(l == l.trim());
58+
if let Some((left, right)) = l.split_once('=') {
59+
assert!(right.starts_with("\""));
60+
assert!(right.ends_with("\""));
61+
assert!(!left.contains("\""));
62+
} else {
63+
assert!(!l.contains("\""));
64+
}
65+
66+
assert!(recorded.insert(l.to_string()), "duplicated: {}", &l);
67+
assert!(!disallow.contains(&l), "found disallowed: {}", &l);
68+
if includes.contains(&l) {
69+
assert!(found.insert(l.to_string()), "duplicated (includes): {}", &l);
70+
}
71+
}
72+
73+
let should_found = HashSet::<String>::from_iter(includes.iter().map(|s| s.to_string()));
74+
let diff: Vec<_> = should_found.difference(&found).collect();
75+
76+
assert!(
77+
diff.is_empty(),
78+
"expected: {:?}, found: {:?} (~ {:?})",
79+
&should_found,
80+
&found,
81+
&diff
82+
);
83+
}
84+
85+
// --print=cfg
86+
{
87+
let output = rustc().target(target).print("cfg").run();
88+
89+
let stdout = String::from_utf8(output.stdout).unwrap();
90+
91+
check_(&stdout, includes, disallow);
92+
}
93+
94+
// --print=cfg=PATH
95+
{
96+
let tmp_path = tmp_dir().join(format!("{target}.cfg"));
97+
let mut print_arg = OsString::from("--print=cfg=");
98+
print_arg.push(tmp_path.as_os_str());
99+
100+
let output = rustc().target(target).arg(print_arg).run();
101+
102+
let output = std::fs::read_to_string(&tmp_path).unwrap();
103+
104+
check_(&output, includes, disallow);
105+
}
106+
}
+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//! This checks the output of some `--print` options when
2+
//! output to a file (instead of stdout)
3+
4+
extern crate run_make_support;
5+
6+
use std::ffi::OsString;
7+
8+
use run_make_support::{rustc, target, tmp_dir};
9+
10+
struct Option<'a> {
11+
target: &'a str,
12+
option: &'static str,
13+
includes: &'static [&'static str],
14+
}
15+
16+
fn main() {
17+
// Printed from CodegenBackend trait impl in rustc_codegen_llvm/src/lib.rs
18+
check(Option {
19+
target: &target(),
20+
option: "relocation-models",
21+
includes: &["dynamic-no-pic"],
22+
});
23+
24+
// Printed by compiler/rustc_codegen_llvm/src/llvm_util.rs
25+
check(Option {
26+
target: "wasm32-unknown-unknown",
27+
option: "target-features",
28+
includes: &["reference-types"],
29+
});
30+
31+
// Printed by C++ code in rustc_llvm/llvm-wrapper/PassWrapper.cpp
32+
check(Option {
33+
target: "wasm32-unknown-unknown",
34+
option: "target-cpus",
35+
includes: &["generic"],
36+
});
37+
}
38+
39+
fn check(args: Option) {
40+
fn check_(output: &str, includes: &[&str]) {
41+
for i in includes {
42+
assert!(output.contains(i), "output doesn't contains: {}", i);
43+
}
44+
}
45+
46+
// --print={option}
47+
let stdout = {
48+
let output = rustc().target(args.target).print(args.option).run();
49+
50+
String::from_utf8(output.stdout).unwrap()
51+
};
52+
53+
// --print={option}=PATH
54+
let output = {
55+
let tmp_path = tmp_dir().join(format!("{}.txt", args.option));
56+
let mut print_arg = OsString::from(format!("--print={}=", args.option));
57+
print_arg.push(tmp_path.as_os_str());
58+
59+
let _output = rustc().target(args.target).arg(print_arg).run();
60+
61+
std::fs::read_to_string(&tmp_path).unwrap()
62+
};
63+
64+
check_(&stdout, args.includes);
65+
check_(&output, args.includes);
66+
67+
assert_eq!(&stdout, &output);
68+
}

0 commit comments

Comments
 (0)