Skip to content

Commit d05ef97

Browse files
GuillaumeGomezpietroalbini
authored andcommitted
Fix error index CSS file name
1 parent 2db56c6 commit d05ef97

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/bootstrap/doc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@ impl Step for ErrorIndex {
885885
let mut index = builder.tool_cmd(Tool::ErrorIndex);
886886
index.arg("html");
887887
index.arg(out.join("error-index.html"));
888+
index.arg(crate::channel::CFG_RELEASE_NUM);
888889

889890
// FIXME: shouldn't have to pass this env var
890891
index.env("CFG_BUILD", &builder.config.build)

src/tools/error_index_generator/main.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ enum OutputFormat {
2727
}
2828

2929
impl OutputFormat {
30-
fn from(format: &str) -> OutputFormat {
30+
fn from(format: &str, resource_suffix: &str) -> OutputFormat {
3131
match &*format.to_lowercase() {
32-
"html" => OutputFormat::HTML(HTMLFormatter(RefCell::new(IdMap::new()))),
32+
"html" => OutputFormat::HTML(HTMLFormatter(RefCell::new(IdMap::new()),
33+
resource_suffix.to_owned())),
3334
"markdown" => OutputFormat::Markdown(MarkdownFormatter),
3435
s => OutputFormat::Unknown(s.to_owned()),
3536
}
@@ -44,7 +45,7 @@ trait Formatter {
4445
fn footer(&self, output: &mut dyn Write) -> Result<(), Box<dyn Error>>;
4546
}
4647

47-
struct HTMLFormatter(RefCell<IdMap>);
48+
struct HTMLFormatter(RefCell<IdMap>, String);
4849
struct MarkdownFormatter;
4950

5051
impl Formatter for HTMLFormatter {
@@ -55,7 +56,7 @@ impl Formatter for HTMLFormatter {
5556
<title>Rust Compiler Error Index</title>
5657
<meta charset="utf-8">
5758
<!-- Include rust.css after light.css so its rules take priority. -->
58-
<link rel="stylesheet" type="text/css" href="light.css"/>
59+
<link rel="stylesheet" type="text/css" href="light{suffix}.css"/>
5960
<link rel="stylesheet" type="text/css" href="rust.css"/>
6061
<style>
6162
.error-undescribed {{
@@ -64,7 +65,7 @@ impl Formatter for HTMLFormatter {
6465
</style>
6566
</head>
6667
<body>
67-
"##)?;
68+
"##, suffix=self.1)?;
6869
Ok(())
6970
}
7071

@@ -242,9 +243,12 @@ fn main_with_result(format: OutputFormat, dst: &Path) -> Result<(), Box<dyn Erro
242243

243244
fn parse_args() -> (OutputFormat, PathBuf) {
244245
let mut args = env::args().skip(1);
245-
let format = args.next().map(|a| OutputFormat::from(&a))
246-
.unwrap_or(OutputFormat::from("html"));
247-
let dst = args.next().map(PathBuf::from).unwrap_or_else(|| {
246+
let format = args.next();
247+
let dst = args.next();
248+
let resource_suffix = args.next().unwrap_or_else(String::new);
249+
let format = format.map(|a| OutputFormat::from(&a, &resource_suffix))
250+
.unwrap_or(OutputFormat::from("html", &resource_suffix));
251+
let dst = dst.map(PathBuf::from).unwrap_or_else(|| {
248252
match format {
249253
OutputFormat::HTML(..) => PathBuf::from("doc/error-index.html"),
250254
OutputFormat::Markdown(..) => PathBuf::from("doc/error-index.md"),

0 commit comments

Comments
 (0)