-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Rustdoc remove old style files #57929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
1ac7277
270151b
65440a3
397eb4f
d264755
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,8 @@ struct SharedContext { | |
/// If false, the `select` element to have search filtering by crates on rendered docs | ||
/// won't be generated. | ||
pub generate_search_filter: bool, | ||
/// Option disabled by default to generate files used by RLS and some other tools. | ||
pub generate_redirect_pages: bool, | ||
} | ||
|
||
impl SharedContext { | ||
|
@@ -504,6 +506,7 @@ pub fn run(mut krate: clean::Crate, | |
resource_suffix, | ||
static_root_path, | ||
generate_search_filter, | ||
generate_redirect_pages, | ||
.. | ||
} = options; | ||
|
||
|
@@ -533,6 +536,7 @@ pub fn run(mut krate: clean::Crate, | |
resource_suffix, | ||
static_root_path, | ||
generate_search_filter, | ||
generate_redirect_pages, | ||
}; | ||
|
||
// If user passed in `--playground-url` arg, we fill in crate name here | ||
|
@@ -2229,25 +2233,17 @@ impl Context { | |
if !self.render_redirect_pages { | ||
all.append(full_path(self, &item), &item_type); | ||
} | ||
// Redirect from a sane URL using the namespace to Rustdoc's | ||
// URL for the page. | ||
let redir_name = format!("{}.{}.html", name, item_type.name_space()); | ||
let redir_dst = self.dst.join(redir_name); | ||
if let Ok(redirect_out) = OpenOptions::new().create_new(true) | ||
.write(true) | ||
.open(&redir_dst) { | ||
let mut redirect_out = BufWriter::new(redirect_out); | ||
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst); | ||
} | ||
|
||
// If the item is a macro, redirect from the old macro URL (with !) | ||
// to the new one (without). | ||
if item_type == ItemType::Macro { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have the macro redirects been removed? The decision from #35705 was to keep them. If you really want to remove them then that needs to be done in a different PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, understood it the other way for some reason. Fixing it! |
||
let redir_name = format!("{}.{}!.html", item_type, name); | ||
if self.shared.generate_redirect_pages { | ||
// Redirect from a sane URL using the namespace to Rustdoc's | ||
// URL for the page. | ||
let redir_name = format!("{}.{}.html", name, item_type.name_space()); | ||
let redir_dst = self.dst.join(redir_name); | ||
let redirect_out = try_err!(File::create(&redir_dst), &redir_dst); | ||
let mut redirect_out = BufWriter::new(redirect_out); | ||
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst); | ||
if let Ok(redirect_out) = OpenOptions::new().create_new(true) | ||
.write(true) | ||
.open(&redir_dst) { | ||
let mut redirect_out = BufWriter::new(redirect_out); | ||
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst); | ||
} | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// compile-flags:-Z unstable-options --generate-redirect-pages | ||
|
||
use std::ops::Deref; | ||
|
||
pub struct Foo; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![crate_name = "foo"] | ||
|
||
// @has foo/macro.bar.html | ||
// @!has foo/macro.bar!.html | ||
// @!has foo/bar.m.html | ||
#[macro_export] | ||
macro_rules! bar { | ||
() => {} | ||
} | ||
|
||
// @has foo/struct.Bar.html | ||
// @!has foo/Bar.t.html | ||
pub struct Bar; |
Uh oh!
There was an error while loading. Please reload this page.