Make meta-item API compatible with LocalInternedString::get soundness fix
This commit is contained in:
parent
7cf074a1e6
commit
db74efce69
17 changed files with 84 additions and 97 deletions
|
|
@ -521,21 +521,21 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||
for attr in krate.module.as_ref().unwrap().attrs.lists("doc") {
|
||||
let diag = ctxt.sess().diagnostic();
|
||||
|
||||
let name = attr.ident_str();
|
||||
let name = attr.name_or_empty();
|
||||
if attr.is_word() {
|
||||
if name == Some("no_default_passes") {
|
||||
if name == "no_default_passes" {
|
||||
report_deprecated_attr("no_default_passes", diag);
|
||||
if default_passes == passes::DefaultPassOption::Default {
|
||||
default_passes = passes::DefaultPassOption::None;
|
||||
}
|
||||
}
|
||||
} else if let Some(value) = attr.value_str() {
|
||||
let sink = match name {
|
||||
Some("passes") => {
|
||||
let sink = match name.get() {
|
||||
"passes" => {
|
||||
report_deprecated_attr("passes = \"...\"", diag);
|
||||
&mut manual_passes
|
||||
},
|
||||
Some("plugins") => {
|
||||
"plugins" => {
|
||||
report_deprecated_attr("plugins = \"...\"", diag);
|
||||
eprintln!("WARNING: #![doc(plugins = \"...\")] no longer functions; \
|
||||
see CVE-2018-1000622");
|
||||
|
|
@ -548,7 +548,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||
}
|
||||
}
|
||||
|
||||
if attr.is_word() && name == Some("document_private_items") {
|
||||
if attr.is_word() && name == "document_private_items" {
|
||||
if default_passes == passes::DefaultPassOption::Default {
|
||||
default_passes = passes::DefaultPassOption::Private;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -562,23 +562,23 @@ pub fn run(mut krate: clean::Crate,
|
|||
// going to emit HTML
|
||||
if let Some(attrs) = krate.module.as_ref().map(|m| &m.attrs) {
|
||||
for attr in attrs.lists("doc") {
|
||||
match (attr.ident_str(), attr.value_str()) {
|
||||
(Some("html_favicon_url"), Some(s)) => {
|
||||
match (attr.name_or_empty().get(), attr.value_str()) {
|
||||
("html_favicon_url", Some(s)) => {
|
||||
scx.layout.favicon = s.to_string();
|
||||
}
|
||||
(Some("html_logo_url"), Some(s)) => {
|
||||
("html_logo_url", Some(s)) => {
|
||||
scx.layout.logo = s.to_string();
|
||||
}
|
||||
(Some("html_playground_url"), Some(s)) => {
|
||||
("html_playground_url", Some(s)) => {
|
||||
markdown::PLAYGROUND.with(|slot| {
|
||||
let name = krate.name.clone();
|
||||
*slot.borrow_mut() = Some((Some(name), s.to_string()));
|
||||
});
|
||||
}
|
||||
(Some("issue_tracker_base_url"), Some(s)) => {
|
||||
("issue_tracker_base_url", Some(s)) => {
|
||||
scx.issue_tracker_base_url = Some(s.to_string());
|
||||
}
|
||||
(Some("html_no_source"), None) if attr.is_word() => {
|
||||
("html_no_source", None) if attr.is_word() => {
|
||||
scx.include_sources = false;
|
||||
}
|
||||
_ => {}
|
||||
|
|
@ -3749,7 +3749,7 @@ fn render_attributes(w: &mut fmt::Formatter<'_>, it: &clean::Item) -> fmt::Resul
|
|||
let mut attrs = String::new();
|
||||
|
||||
for attr in &it.attrs.other_attrs {
|
||||
if !attr.ident_str().map_or(false, |name| ATTRIBUTE_WHITELIST.contains(&name)) {
|
||||
if !ATTRIBUTE_WHITELIST.contains(&attr.name_or_empty().get()) {
|
||||
continue;
|
||||
}
|
||||
if let Some(s) = render_attribute(&attr.meta().unwrap()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue