diff options
| author | bors <bors@rust-lang.org> | 2022-05-11 06:29:04 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-11 06:29:04 +0000 |
| commit | ee6eaabdd402583ab759eb271ac69d26e06842d7 (patch) | |
| tree | 9794dde2f6169492971376420fe5e6ce0712c0f4 /src | |
| parent | b862b438dbffb959ef4e9643148ecd05b8da4d8a (diff) | |
| parent | 514b585757126a09785765bc5177299cd5bb5e2d (diff) | |
| download | rust-ee6eaabdd402583ab759eb271ac69d26e06842d7.tar.gz rust-ee6eaabdd402583ab759eb271ac69d26e06842d7.zip | |
Auto merge of #96931 - JohnTitor:rollup-3um8o4j, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #96543 (Remove hacks in `make_token_stream`.) - #96887 (rustdoc: correct path to type alias methods) - #96896 (Add regression test for #68408) - #96900 (Fix js error) - #96903 (Use lifetimes on type-alias-impl-trait used in function signatures to infer output type lifetimes) - #96916 (simplify length count) - #96925 (Fix issue #95151) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 9 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 1 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/source-script.js | 3 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/sidebar-source-code-display.goml | 3 | ||||
| -rw-r--r-- | src/test/rustdoc-js-std/asrawfd.js | 14 | ||||
| -rw-r--r-- | src/test/rustdoc-js/foreign-type-path.js | 9 | ||||
| -rw-r--r-- | src/test/rustdoc-js/foreign-type-path.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/lint/dead-code/issue-68408-false-positive.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/rfc-2091-track-caller/macro-declaration.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/type-alias-impl-trait/constrain_inputs.rs | 17 | ||||
| -rw-r--r-- | src/tools/rustfmt/src/parse/macros/mod.rs | 4 |
11 files changed, 89 insertions, 16 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index 30190138750..9dc30d8a189 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -288,14 +288,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> { // for where the type was defined. On the other // hand, `paths` always has the right // information if present. - Some(&( - ref fqp, - ItemType::Trait - | ItemType::Struct - | ItemType::Union - | ItemType::Enum, - )) => Some(&fqp[..fqp.len() - 1]), - Some(..) => Some(&*self.cache.stack), + Some(&(ref fqp, _)) => Some(&fqp[..fqp.len() - 1]), None => None, }; ((Some(*last), path), true) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index eb3ce37e313..0f4d842f433 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -331,7 +331,6 @@ li { nav.sub { position: relative; font-size: 1rem; - text-transform: uppercase; } .sub-container { diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index 92ecd200081..15e3bdf47b2 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -1,5 +1,5 @@ // From rust: -/* global search, sourcesIndex */ +/* global sourcesIndex */ // Local js definitions: /* global addClass, getCurrentValue, hasClass, onEachLazy, removeClass, browserSupportsHistoryApi */ @@ -69,7 +69,6 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { files.appendChild(file); } } - search.fullPath = fullPath; children.appendChild(files); parent.appendChild(name); parent.appendChild(children); diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml index 377ee9c6eef..0066a38eaa5 100644 --- a/src/test/rustdoc-gui/sidebar-source-code-display.goml +++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml @@ -15,6 +15,5 @@ assert-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1}) assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "hidden", "opacity": 0}) // Let's expand the sidebar now. click: "#sidebar-toggle" -// Because of the transition CSS, better wait a second before checking. +// Because of the transition CSS, we check by using `wait-for-css` instead of `assert-css`. wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1}) -assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "visible", "opacity": 1}) diff --git a/src/test/rustdoc-js-std/asrawfd.js b/src/test/rustdoc-js-std/asrawfd.js new file mode 100644 index 00000000000..fd228a59099 --- /dev/null +++ b/src/test/rustdoc-js-std/asrawfd.js @@ -0,0 +1,14 @@ +// ignore-order + +const QUERY = 'RawFd::as_raw_fd'; + +const EXPECTED = { + 'others': [ + // Reproduction test for https://github.com/rust-lang/rust/issues/78724 + // Validate that type alias methods get the correct path. + { 'path': 'std::os::unix::io::AsRawFd', 'name': 'as_raw_fd' }, + { 'path': 'std::os::wasi::io::AsRawFd', 'name': 'as_raw_fd' }, + { 'path': 'std::os::linux::process::PidFd', 'name': 'as_raw_fd' }, + { 'path': 'std::os::unix::io::RawFd', 'name': 'as_raw_fd' }, + ], +}; diff --git a/src/test/rustdoc-js/foreign-type-path.js b/src/test/rustdoc-js/foreign-type-path.js new file mode 100644 index 00000000000..334761badca --- /dev/null +++ b/src/test/rustdoc-js/foreign-type-path.js @@ -0,0 +1,9 @@ +const QUERY = 'MyForeignType::my_method'; + +const EXPECTED = { + 'others': [ + // Test case for https://github.com/rust-lang/rust/pull/96887#pullrequestreview-967154358 + // Validates that the parent path for a foreign type method is correct. + { 'path': 'foreign_type_path::aaaaaaa::MyForeignType', 'name': 'my_method' }, + ], +}; diff --git a/src/test/rustdoc-js/foreign-type-path.rs b/src/test/rustdoc-js/foreign-type-path.rs new file mode 100644 index 00000000000..83400104ea7 --- /dev/null +++ b/src/test/rustdoc-js/foreign-type-path.rs @@ -0,0 +1,13 @@ +#![feature(extern_types)] + +pub mod aaaaaaa { + + extern { + pub type MyForeignType; + } + + impl MyForeignType { + pub fn my_method() {} + } + +} diff --git a/src/test/ui/lint/dead-code/issue-68408-false-positive.rs b/src/test/ui/lint/dead-code/issue-68408-false-positive.rs new file mode 100644 index 00000000000..7ee6b5d7288 --- /dev/null +++ b/src/test/ui/lint/dead-code/issue-68408-false-positive.rs @@ -0,0 +1,22 @@ +// check-pass + +// Make sure we don't have any false positives here. + +#![deny(dead_code)] + +enum X { + A { _a: () }, + B { _b: () }, +} +impl X { + fn a() -> X { + X::A { _a: () } + } + fn b() -> Self { + Self::B { _b: () } + } +} + +fn main() { + let (_, _) = (X::a(), X::b()); +} diff --git a/src/test/ui/rfc-2091-track-caller/macro-declaration.rs b/src/test/ui/rfc-2091-track-caller/macro-declaration.rs new file mode 100644 index 00000000000..6ca09fac819 --- /dev/null +++ b/src/test/ui/rfc-2091-track-caller/macro-declaration.rs @@ -0,0 +1,10 @@ +// check-pass + +// See https://github.com/rust-lang/rust/issues/95151 +#[track_caller] +macro_rules! _foo { + () => {}; +} + +fn main() { +} diff --git a/src/test/ui/type-alias-impl-trait/constrain_inputs.rs b/src/test/ui/type-alias-impl-trait/constrain_inputs.rs new file mode 100644 index 00000000000..c32174288ee --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/constrain_inputs.rs @@ -0,0 +1,17 @@ +// check-pass + +#![feature(type_alias_impl_trait)] + +mod foo { + type Ty<'a> = impl Sized; + fn defining(s: &str) -> Ty<'_> { s } + fn execute(ty: Ty<'_>) -> &str { todo!() } +} + +mod bar { + type Ty<'a> = impl FnOnce() -> &'a str; + fn defining(s: &str) -> Ty<'_> { move || s } + fn execute(ty: Ty<'_>) -> &str { ty() } +} + +fn main() {} diff --git a/src/tools/rustfmt/src/parse/macros/mod.rs b/src/tools/rustfmt/src/parse/macros/mod.rs index d4dbf21f8ca..67f3985926e 100644 --- a/src/tools/rustfmt/src/parse/macros/mod.rs +++ b/src/tools/rustfmt/src/parse/macros/mod.rs @@ -79,9 +79,7 @@ fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> { for &keyword in RUST_KW.iter() { if parser.token.is_keyword(keyword) && parser.look_ahead(1, |t| { - t.kind == TokenKind::Eof - || t.kind == TokenKind::Comma - || t.kind == TokenKind::CloseDelim(Delimiter::Invisible) + t.kind == TokenKind::Eof || t.kind == TokenKind::Comma }) { parser.bump(); |
