diff options
| author | bors <bors@rust-lang.org> | 2022-08-27 06:12:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-27 06:12:17 +0000 |
| commit | d0e1491ecd6ab30a47ebe29f8a86463eacc6a997 (patch) | |
| tree | 80b3628973454308a3c7a18bae640c758422db31 /src | |
| parent | 9845f4c47e7062867c73b6bed8f1df273b56d5d7 (diff) | |
| parent | bd893725637d38e508811c868f100bda3d13583b (diff) | |
Auto merge of #101074 - JohnTitor:rollup-zwznihq, r=JohnTitor
Rollup of 11 pull requests Successful merges: - #96240 (Stabilize `const_ptr_offset_from`.) - #99784 (Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default) - #100811 (Fix wrong compiletest filters on Windows) - #100924 (Smaller improvements of tidy and the unicode generator) - #100953 (Update documentation for `write!` and `writeln!`) - #101018 (rustdoc: omit start/end tags for empty item description blocks) - #101044 (rustdoc: remove unused CSS for `hidden-by-*-hider`) - #101046 (rustdoc: remove incorrect CSS selector `.impl-items table td`) - #101057 (Merge implementations of HIR fn_decl and fn_sig.) - #101062 (rustdoc: remove empty extern_crates and type="text/javascript" on script) - #101063 (Merge duplicated CSS rules) Failed merges: - #101055 (Use smaller span for suggestions) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
19 files changed, 96 insertions, 87 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index baad0c75295..c759d9b88e2 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1514,7 +1514,15 @@ note: if you're sure you want to do this, please open an issue as to why. In the test_args.append(&mut builder.config.cmd.test_args()); - cmd.args(&test_args); + // On Windows, replace forward slashes in test-args by backslashes + // so the correct filters are passed to libtest + if cfg!(windows) { + let test_args_win: Vec<String> = + test_args.iter().map(|s| s.replace("/", "\\")).collect(); + cmd.args(&test_args_win); + } else { + cmd.args(&test_args); + } if builder.is_verbose() { cmd.arg("--verbose"); diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 912601dda20..710064a37d0 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -371,16 +371,21 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: } clean::ImportKind::Glob => String::new(), }; + let stab_tags = stab_tags.unwrap_or_default(); + let (stab_tags_before, stab_tags_after) = if stab_tags.is_empty() { + ("", "") + } else { + ("<div class=\"item-right docblock-short\">", "</div>") + }; write!( w, "<div class=\"item-left {stab}{add}import-item\"{id}>\ <code>{vis}{imp}</code>\ </div>\ - <div class=\"item-right docblock-short\">{stab_tags}</div>", + {stab_tags_before}{stab_tags}{stab_tags_after}", stab = stab.unwrap_or_default(), vis = myitem.visibility.print_with_space(myitem.item_id, cx), imp = import.print(cx), - stab_tags = stab_tags.unwrap_or_default(), ); w.write_str(ITEM_TABLE_ROW_CLOSE); } @@ -412,6 +417,12 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: let doc_value = myitem.doc_value().unwrap_or_default(); w.write_str(ITEM_TABLE_ROW_OPEN); + let docs = MarkdownSummaryLine(&doc_value, &myitem.links(cx)).into_string(); + let (docs_before, docs_after) = if docs.is_empty() { + ("", "") + } else { + ("<div class=\"item-right docblock-short\">", "</div>") + }; write!( w, "<div class=\"item-left {stab}{add}module-item\">\ @@ -420,11 +431,10 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: {unsafety_flag}\ {stab_tags}\ </div>\ - <div class=\"item-right docblock-short\">{docs}</div>", + {docs_before}{docs}{docs_after}", name = myitem.name.unwrap(), visibility_emoji = visibility_emoji, stab_tags = extra_info_tags(myitem, item, cx.tcx()), - docs = MarkdownSummaryLine(&doc_value, &myitem.links(cx)).into_string(), class = myitem.type_(), add = add, stab = stab.unwrap_or_default(), @@ -987,7 +997,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean: // So C's HTML will have something like this: // // ```html - // <script type="text/javascript" src="/implementors/A/trait.Foo.js" + // <script src="/implementors/A/trait.Foo.js" // data-ignore-extern-crates="A,B" async></script> // ``` // @@ -1013,9 +1023,11 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean: .map(|cnum| cx.shared.tcx.crate_name(cnum).to_string()) .collect::<Vec<_>>() .join(","); + let (extern_before, extern_after) = + if extern_crates.is_empty() { ("", "") } else { (" data-ignore-extern-crates=\"", "\"") }; write!( w, - "<script type=\"text/javascript\" src=\"{src}\" data-ignore-extern-crates=\"{extern_crates}\" async></script>", + "<script src=\"{src}\"{extern_before}{extern_crates}{extern_after} async></script>", src = js_src_path.finish(), ); } diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 38cdcd61e88..deed6eaf0cb 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -364,11 +364,6 @@ li { margin-left: 0px; } -nav.sub { - position: relative; - font-size: 1rem; -} - .sub-container { display: flex; flex-direction: row; @@ -638,9 +633,6 @@ h2.location a { } .docblock-short p { display: inline; -} - -.docblock-short p { overflow: hidden; text-overflow: ellipsis; margin: 0; @@ -777,7 +769,7 @@ pre, .rustdoc.source .example-wrap { .content .docblock >.impl-items table td { padding: 0; } -.content .docblock > .impl-items .table-display, .impl-items table td { +.content .docblock > .impl-items .table-display { border: none; } @@ -820,6 +812,8 @@ pre, .rustdoc.source .example-wrap { } nav.sub { + position: relative; + font-size: 1rem; flex-grow: 1; margin-bottom: 25px; } @@ -919,6 +913,7 @@ table, position: relative; display: flex; height: 34px; + margin-top: 4px; } .search-container > * { height: 100%; @@ -990,9 +985,6 @@ so that we can apply CSS-filters to change the arrow color in themes */ #crate-search > option { font-size: 1rem; } -.search-container { - margin-top: 4px; -} .search-input { /* Override Normalize.css: it has a rule that sets -webkit-appearance: textfield for search inputs. That @@ -1188,6 +1180,7 @@ so that we can apply CSS-filters to change the arrow color in themes */ padding-left: 12px; padding-right: 2px; position: initial; + float: right; } .impl-items .srclink, .impl .srclink, .methods .srclink { @@ -1196,10 +1189,6 @@ so that we can apply CSS-filters to change the arrow color in themes */ font-size: 1rem; } -.rightside { - float: right; -} - td.summary-column { width: 100%; } @@ -1226,7 +1215,7 @@ a.test-arrow { .example-wrap:hover .test-arrow { visibility: visible; } -a.test-arrow:hover{ +a.test-arrow:hover { text-decoration: none; } @@ -1494,10 +1483,6 @@ pre.rust { outline: none; } -#copy-path { - height: 34px; - background-color: var(--main-background-color); -} #settings-menu > a, #help-button > button, #copy-path { padding: 5px; width: 33px; @@ -1555,7 +1540,8 @@ input:checked + .slider { } #copy-path { - background: initial; + height: 34px; + background-color: var(--main-background-color); margin-left: 10px; padding: 0; padding-left: 2px; @@ -1573,12 +1559,6 @@ kbd { cursor: default; } -.hidden-by-impl-hider, -.hidden-by-usual-hider { - /* important because of conflicting rule for small screens */ - display: none !important; -} - #implementations-list > h3 > span.in-band { width: 100%; } @@ -1841,10 +1821,6 @@ in storage.js plus the media query with (min-width: 701px) display: none; } - .sidebar-elems { - margin-top: 1em; - } - .sidebar { position: fixed; top: 45px; @@ -1938,6 +1914,7 @@ in storage.js plus the media query with (min-width: 701px) } .sidebar-elems { + margin-top: 1em; background-color: var(--sidebar-background-color); } diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 8591f22d6de..1efa67a44b5 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -153,9 +153,6 @@ a { .sidebar h3 a { color: white; } -.search-results a { - color: #0096cf; -} body.source .example-wrap pre.rust a { background: #333; } @@ -359,7 +356,6 @@ h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type) .content span.constant,.content a.constant,.block a.current.constant,.content span.static, .content a.static, .block a.current.static {} .content span.keyword,.content a.keyword,.block a.current.keyword {} -pre.rust .comment {} .content span.traitalias,.content a.traitalias,.block a.current.traitalias {} .content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method, .block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod, @@ -367,7 +363,6 @@ pre.rust .comment {} pre.rust .kw {} pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute {} .content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype {} -pre.rust .doccomment {} .stab.deprecated {} .content a.attr,.content a.derive,.content a.macro {} .stab.portability {} diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 5dec610b30c..7f61c95e794 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -528,9 +528,9 @@ function loadCss(cssFileName) { // We don't want to include impls from this JS file, when the HTML already has them. // The current crate should always be ignored. Other crates that should also be // ignored are included in the attribute `data-ignore-extern-crates`. - const ignoreExternCrates = document - .querySelector("script[data-ignore-extern-crates]") - .getAttribute("data-ignore-extern-crates"); + const script = document + .querySelector("script[data-ignore-extern-crates]"); + const ignoreExternCrates = script ? script.getAttribute("data-ignore-extern-crates") : ""; for (const lib of libs) { if (lib === window.currentCrate || ignoreExternCrates.indexOf(lib) !== -1) { continue; diff --git a/src/test/codegen/external-no-mangle-statics.rs b/src/test/codegen/external-no-mangle-statics.rs index 6274434cd8f..c6ecb7aa96a 100644 --- a/src/test/codegen/external-no-mangle-statics.rs +++ b/src/test/codegen/external-no-mangle-statics.rs @@ -1,12 +1,11 @@ // revisions: lib staticlib // ignore-emscripten default visibility is hidden // compile-flags: -O +// [lib] compile-flags: --crate-type lib +// [staticlib] compile-flags: --crate-type staticlib // `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their // definitions -#![cfg_attr(lib, crate_type = "lib")] -#![cfg_attr(staticlib, crate_type = "staticlib")] - // CHECK: @A = local_unnamed_addr constant #[no_mangle] static A: u8 = 0; diff --git a/src/test/rustdoc-gui/docblock-table.goml b/src/test/rustdoc-gui/docblock-table.goml new file mode 100644 index 00000000000..7263156ab2b --- /dev/null +++ b/src/test/rustdoc-gui/docblock-table.goml @@ -0,0 +1,4 @@ +goto: file://|DOC_PATH|/test_docs/doc_block_table/struct.DocBlockTable.html#method.func + +compare-elements-css: (".impl-items .docblock table th", ".top-doc .docblock table th", ["border"]) +compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock table td", ["border"]) diff --git a/src/test/rustdoc-gui/item-summary-table.goml b/src/test/rustdoc-gui/item-summary-table.goml index 6bf4e288c43..4bff32b3d5d 100644 --- a/src/test/rustdoc-gui/item-summary-table.goml +++ b/src/test/rustdoc-gui/item-summary-table.goml @@ -3,4 +3,4 @@ goto: file://|DOC_PATH|/lib2/summary_table/index.html // We check that we picked the right item first. assert-text: (".item-table .item-left", "Foo") // Then we check that its summary is empty. -assert-text: (".item-table .item-right", "") +assert-false: ".item-table .item-right" diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index 1b26aaecb5e..a02d5934cc2 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -293,3 +293,29 @@ pub mod details { /// </details> pub struct Details; } + +pub mod doc_block_table { + + pub trait DocBlockTableTrait { + fn func(); + } + + /// Struct doc. + /// + /// | header1 | header2 | + /// |--------------------------|--------------------------| + /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum | + pub struct DocBlockTable {} + + impl DocBlockTableTrait for DocBlockTable { + /// Trait impl func doc for struct. + /// + /// | header1 | header2 | + /// |--------------------------|--------------------------| + /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum | + fn func() { + println!(); + } + } + +} diff --git a/src/test/rustdoc/short-docblock-codeblock.rs b/src/test/rustdoc/short-docblock-codeblock.rs index c6b318b0677..3c5fa7b36ad 100644 --- a/src/test/rustdoc/short-docblock-codeblock.rs +++ b/src/test/rustdoc/short-docblock-codeblock.rs @@ -1,8 +1,6 @@ #![crate_name = "foo"] -// @has foo/index.html '//*[@class="item-right docblock-short"]' "" -// @!has foo/index.html '//*[@class="item-right docblock-short"]' "Some text." -// @!has foo/index.html '//*[@class="item-right docblock-short"]' "let x = 12;" +// @count foo/index.html '//*[@class="item-right docblock-short"]' 0 /// ``` /// let x = 12; diff --git a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs index 6cb2ff9d813..1f23dadc432 100644 --- a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs +++ b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs @@ -1,7 +1,6 @@ // check-fail // compile-flags:--cfg foo -#![deny(warnings)] #![cfg_attr(foo, crate_type="bin")] //~^ERROR `crate_type` within //~| WARN this was previously accepted diff --git a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr index 5609f8e9d9f..b52535ffdba 100644 --- a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr +++ b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr @@ -1,20 +1,15 @@ error: `crate_type` within an `#![cfg_attr] attribute is deprecated` - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18 + --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:18 | LL | #![cfg_attr(foo, crate_type="bin")] | ^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(deprecated_cfg_attr_crate_type_name)]` implied by `#[deny(warnings)]` + = note: `#[deny(deprecated_cfg_attr_crate_type_name)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632> error: `crate_name` within an `#![cfg_attr] attribute is deprecated` - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18 + --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18 | LL | #![cfg_attr(foo, crate_name="bar")] | ^^^^^^^^^^^^^^^^ @@ -23,7 +18,7 @@ LL | #![cfg_attr(foo, crate_name="bar")] = note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632> error: `crate_type` within an `#![cfg_attr] attribute is deprecated` - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18 + --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:18 | LL | #![cfg_attr(foo, crate_type="bin")] | ^^^^^^^^^^^^^^^^ @@ -32,7 +27,7 @@ LL | #![cfg_attr(foo, crate_type="bin")] = note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632> error: `crate_name` within an `#![cfg_attr] attribute is deprecated` - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18 + --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18 | LL | #![cfg_attr(foo, crate_name="bar")] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs index e1f5e8ae145..43c99799f77 100644 --- a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs +++ b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs @@ -3,7 +3,6 @@ // Test that we can handle unsized types with an extern type tail part. // Regression test for issue #91827. -#![feature(const_ptr_offset_from)] #![feature(extern_types)] use std::ptr::addr_of; diff --git a/src/test/ui/consts/offset.rs b/src/test/ui/consts/offset.rs index f9ddda554fc..b2c663fe617 100644 --- a/src/test/ui/consts/offset.rs +++ b/src/test/ui/consts/offset.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(const_ptr_offset_from)] use std::ptr; #[repr(C)] diff --git a/src/test/ui/consts/offset_from.rs b/src/test/ui/consts/offset_from.rs index b53718316f3..465147041d9 100644 --- a/src/test/ui/consts/offset_from.rs +++ b/src/test/ui/consts/offset_from.rs @@ -1,6 +1,5 @@ // run-pass -#![feature(const_ptr_offset_from)] #![feature(const_ptr_sub_ptr)] #![feature(ptr_sub_ptr)] diff --git a/src/test/ui/consts/offset_from_ub.rs b/src/test/ui/consts/offset_from_ub.rs index 1f29a690550..51163e650d6 100644 --- a/src/test/ui/consts/offset_from_ub.rs +++ b/src/test/ui/consts/offset_from_ub.rs @@ -1,4 +1,4 @@ -#![feature(const_ptr_offset_from)] +#![feature(const_ptr_sub_ptr)] #![feature(core_intrinsics)] use std::intrinsics::{ptr_offset_from, ptr_offset_from_unsigned}; diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs index f0054a1c1c9..0a226443e01 100644 --- a/src/tools/tidy/src/error_codes_check.rs +++ b/src/tools/tidy/src/error_codes_check.rs @@ -217,7 +217,7 @@ pub fn check(paths: &[&Path], bad: &mut bool) { println!("Checking which error codes lack tests..."); for path in paths { - super::walk(path, &mut |path| super::filter_dirs(path), &mut |entry, contents| { + super::walk(path, &mut super::filter_dirs, &mut |entry, contents| { let file_name = entry.file_name(); let entry_path = entry.path(); diff --git a/src/tools/unicode-table-generator/src/main.rs b/src/tools/unicode-table-generator/src/main.rs index a3327a3c2ff..2fe578acd90 100644 --- a/src/tools/unicode-table-generator/src/main.rs +++ b/src/tools/unicode-table-generator/src/main.rs @@ -221,7 +221,7 @@ fn main() { let write_location = std::env::args().nth(1).unwrap_or_else(|| { eprintln!("Must provide path to write unicode tables to"); eprintln!( - "e.g. {} library/core/unicode/unicode_data.rs", + "e.g. {} library/core/src/unicode/unicode_data.rs", std::env::args().next().unwrap_or_default() ); std::process::exit(1); diff --git a/src/tools/unicode-table-generator/src/unicode_download.rs b/src/tools/unicode-table-generator/src/unicode_download.rs index 9b2e0a25891..714bb53382e 100644 --- a/src/tools/unicode-table-generator/src/unicode_download.rs +++ b/src/tools/unicode-table-generator/src/unicode_download.rs @@ -1,6 +1,6 @@ use crate::UNICODE_DIRECTORY; use std::path::Path; -use std::process::Command; +use std::process::{Command, Output}; static URL_PREFIX: &str = "https://www.unicode.org/Public/UCD/latest/ucd/"; @@ -9,6 +9,18 @@ static README: &str = "ReadMe.txt"; static RESOURCES: &[&str] = &["DerivedCoreProperties.txt", "PropList.txt", "UnicodeData.txt", "SpecialCasing.txt"]; +#[track_caller] +fn fetch(url: &str) -> Output { + let output = Command::new("curl").arg(URL_PREFIX.to_owned() + url).output().unwrap(); + if !output.status.success() { + panic!( + "Failed to run curl to fetch {url}: stderr: {}", + String::from_utf8_lossy(&output.stderr) + ); + } + output +} + pub fn fetch_latest() { let directory = Path::new(UNICODE_DIRECTORY); if directory.exists() { @@ -20,27 +32,14 @@ pub fn fetch_latest() { if let Err(e) = std::fs::create_dir_all(directory) { panic!("Failed to create {UNICODE_DIRECTORY:?}: {e}"); } - let output = Command::new("curl").arg(URL_PREFIX.to_owned() + README).output().unwrap(); - if !output.status.success() { - panic!( - "Failed to run curl to fetch readme: stderr: {}", - String::from_utf8_lossy(&output.stderr) - ); - } + let output = fetch(README); let current = std::fs::read_to_string(directory.join(README)).unwrap_or_default(); if current.as_bytes() != &output.stdout[..] { std::fs::write(directory.join(README), output.stdout).unwrap(); } for resource in RESOURCES { - let output = Command::new("curl").arg(URL_PREFIX.to_owned() + resource).output().unwrap(); - if !output.status.success() { - panic!( - "Failed to run curl to fetch {}: stderr: {}", - resource, - String::from_utf8_lossy(&output.stderr) - ); - } + let output = fetch(resource); std::fs::write(directory.join(resource), output.stdout).unwrap(); } } |
