diff options
| author | bors <bors@rust-lang.org> | 2022-04-16 14:24:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-16 14:24:14 +0000 |
| commit | d9b3ff7d34335c5bc0b2afed640b65d64a85fe03 (patch) | |
| tree | 5e6cfdb26695ef535ca98195430c9f1ddbebede8 /src | |
| parent | febce1fc316f5618d5bb8f05d19e2e3ba868c007 (diff) | |
| parent | 4ed76271170ed781f0fc079ead9a5997a96f984f (diff) | |
| download | rust-d9b3ff7d34335c5bc0b2afed640b65d64a85fe03.tar.gz rust-d9b3ff7d34335c5bc0b2afed640b65d64a85fe03.zip | |
Auto merge of #96117 - Dylan-DPC:rollup-5traczf, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #95887 (resolve: Create dummy bindings for all unresolved imports) - #96023 (couple of clippy::perf fixes) - #96035 (Update GitHub Actions actions/checkout Version v2 -> v3) - #96038 (docs: add link from zip to unzip) - #96047 (:arrow_up: rust-analyzer) - #96059 (clarify doc(cfg) wording) - #96081 (Make some `usize`-typed masks definitions agnostic to the size of `usize`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/ci/github-actions/ci.yml | 4 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/doc-cfg.md | 2 | ||||
| -rw-r--r-- | src/librustdoc/clean/cfg.rs | 9 | ||||
| -rw-r--r-- | src/librustdoc/clean/cfg/tests.rs | 40 | ||||
| -rw-r--r-- | src/librustdoc/passes/html_tags.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/item-info-overflow.goml | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/item-info-width.goml | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.rs | 6 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr | 11 | ||||
| -rw-r--r-- | src/test/rustdoc/doc-cfg.rs | 22 | ||||
| -rw-r--r-- | src/test/rustdoc/duplicate-cfg.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/use/use-super-global-path.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/use/use-super-global-path.stderr | 16 | ||||
| m--------- | src/tools/rust-analyzer | 47 |
14 files changed, 82 insertions, 103 deletions
diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 5622422d50f..173ee170c9f 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -99,7 +99,7 @@ x--expand-yaml-anchors--remove: run: git config --global core.autocrlf false - name: checkout the source code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 2 @@ -703,7 +703,7 @@ jobs: if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust' steps: - name: checkout the source code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 2 diff --git a/src/doc/unstable-book/src/language-features/doc-cfg.md b/src/doc/unstable-book/src/language-features/doc-cfg.md index e75f1aea992..b15f5ee66ab 100644 --- a/src/doc/unstable-book/src/language-features/doc-cfg.md +++ b/src/doc/unstable-book/src/language-features/doc-cfg.md @@ -7,7 +7,7 @@ The tracking issue for this feature is: [#43781] The `doc_cfg` feature allows an API be documented as only available in some specific platforms. This attribute has two effects: -1. In the annotated item's documentation, there will be a message saying "This is supported on +1. In the annotated item's documentation, there will be a message saying "Available on (platform) only". 2. The item's doc-tests will only run on the specific platform. diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index b72d2624177..0d213a5a2de 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -171,11 +171,8 @@ impl Cfg { pub(crate) fn render_long_html(&self) -> String { let on = if self.should_use_with_in_description() { "with" } else { "on" }; - let mut msg = format!( - "This is supported {} <strong>{}</strong>", - on, - Display(self, Format::LongHtml) - ); + let mut msg = + format!("Available {on} <strong>{}</strong>", Display(self, Format::LongHtml)); if self.should_append_only_to_description() { msg.push_str(" only"); } @@ -187,7 +184,7 @@ impl Cfg { pub(crate) fn render_long_plain(&self) -> String { let on = if self.should_use_with_in_description() { "with" } else { "on" }; - let mut msg = format!("This is supported {} {}", on, Display(self, Format::LongPlain)); + let mut msg = format!("Available {on} {}", Display(self, Format::LongPlain)); if self.should_append_only_to_description() { msg.push_str(" only"); } diff --git a/src/librustdoc/clean/cfg/tests.rs b/src/librustdoc/clean/cfg/tests.rs index 275d1b3ebd9..ece3fcb18b6 100644 --- a/src/librustdoc/clean/cfg/tests.rs +++ b/src/librustdoc/clean/cfg/tests.rs @@ -359,81 +359,73 @@ fn test_render_short_html() { #[test] fn test_render_long_html() { create_default_session_globals_then(|| { - assert_eq!( - word_cfg("unix").render_long_html(), - "This is supported on <strong>Unix</strong> only." - ); + assert_eq!(word_cfg("unix").render_long_html(), "Available on <strong>Unix</strong> only."); assert_eq!( name_value_cfg("target_os", "macos").render_long_html(), - "This is supported on <strong>macOS</strong> only." + "Available on <strong>macOS</strong> only." ); assert_eq!( name_value_cfg("target_os", "wasi").render_long_html(), - "This is supported on <strong>WASI</strong> only." + "Available on <strong>WASI</strong> only." ); assert_eq!( name_value_cfg("target_pointer_width", "16").render_long_html(), - "This is supported on <strong>16-bit</strong> only." + "Available on <strong>16-bit</strong> only." ); assert_eq!( name_value_cfg("target_endian", "little").render_long_html(), - "This is supported on <strong>little-endian</strong> only." + "Available on <strong>little-endian</strong> only." ); assert_eq!( (!word_cfg("windows")).render_long_html(), - "This is supported on <strong>non-Windows</strong> only." + "Available on <strong>non-Windows</strong> only." ); assert_eq!( (word_cfg("unix") & word_cfg("windows")).render_long_html(), - "This is supported on <strong>Unix and Windows</strong> only." + "Available on <strong>Unix and Windows</strong> only." ); assert_eq!( (word_cfg("unix") | word_cfg("windows")).render_long_html(), - "This is supported on <strong>Unix or Windows</strong> only." + "Available on <strong>Unix or Windows</strong> only." ); assert_eq!( (word_cfg("unix") & word_cfg("windows") & word_cfg("debug_assertions")) .render_long_html(), - "This is supported on <strong>Unix and Windows and debug-assertions enabled\ - </strong> only." + "Available on <strong>Unix and Windows and debug-assertions enabled</strong> only." ); assert_eq!( (word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions")) .render_long_html(), - "This is supported on <strong>Unix or Windows or debug-assertions enabled\ - </strong> only." + "Available on <strong>Unix or Windows or debug-assertions enabled</strong> only." ); assert_eq!( (!(word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions"))) .render_long_html(), - "This is supported on <strong>neither Unix nor Windows nor debug-assertions \ - enabled</strong>." + "Available on <strong>neither Unix nor Windows nor debug-assertions enabled</strong>." ); assert_eq!( ((word_cfg("unix") & name_value_cfg("target_arch", "x86_64")) | (word_cfg("windows") & name_value_cfg("target_pointer_width", "64"))) .render_long_html(), - "This is supported on <strong>Unix and x86-64, or Windows and 64-bit</strong> only." + "Available on <strong>Unix and x86-64, or Windows and 64-bit</strong> only." ); assert_eq!( (!(word_cfg("unix") & word_cfg("windows"))).render_long_html(), - "This is supported on <strong>not (Unix and Windows)</strong>." + "Available on <strong>not (Unix and Windows)</strong>." ); assert_eq!( ((word_cfg("debug_assertions") | word_cfg("windows")) & word_cfg("unix")) .render_long_html(), - "This is supported on <strong>(debug-assertions enabled or Windows) and Unix\ - </strong> only." + "Available on <strong>(debug-assertions enabled or Windows) and Unix</strong> only." ); assert_eq!( name_value_cfg("target_feature", "sse2").render_long_html(), - "This is supported with <strong>target feature <code>sse2</code></strong> only." + "Available with <strong>target feature <code>sse2</code></strong> only." ); assert_eq!( (name_value_cfg("target_arch", "x86_64") & name_value_cfg("target_feature", "sse2")) .render_long_html(), - "This is supported on <strong>x86-64 and target feature \ - <code>sse2</code></strong> only." + "Available on <strong>x86-64 and target feature <code>sse2</code></strong> only." ); }) } diff --git a/src/librustdoc/passes/html_tags.rs b/src/librustdoc/passes/html_tags.rs index 00e10c6d5a7..a620ffa9878 100644 --- a/src/librustdoc/passes/html_tags.rs +++ b/src/librustdoc/passes/html_tags.rs @@ -215,7 +215,7 @@ impl<'a, 'tcx> DocVisitor for InvalidHtmlTagsLinter<'a, 'tcx> { // We don't try to detect stuff `<like, this>` because that's not valid HTML, // and we don't try to detect stuff `<like this>` because that's not valid Rust. if let Some(Some(generics_start)) = (is_open_tag - && dox[..range.end].ends_with(">")) + && dox[..range.end].ends_with('>')) .then(|| extract_path_backwards(&dox, range.start)) { let generics_sp = match super::source_span_for_markdown_range( diff --git a/src/test/rustdoc-gui/item-info-overflow.goml b/src/test/rustdoc-gui/item-info-overflow.goml index 4ff719bfb7d..d6385e2acb8 100644 --- a/src/test/rustdoc-gui/item-info-overflow.goml +++ b/src/test/rustdoc-gui/item-info-overflow.goml @@ -8,7 +8,7 @@ assert-property: (".item-info", {"scrollWidth": "890"}) // Just to be sure we're comparing the correct "item-info": assert-text: ( ".item-info", - "This is supported on Android or Linux or Emscripten or DragonFly BSD", + "Available on Android or Linux or Emscripten or DragonFly BSD", STARTS_WITH, ) @@ -23,6 +23,6 @@ assert-property: ("#impl-SimpleTrait .item-info", {"scrollWidth": "866"}) // Just to be sure we're comparing the correct "item-info": assert-text: ( "#impl-SimpleTrait .item-info", - "This is supported on Android or Linux or Emscripten or DragonFly BSD", + "Available on Android or Linux or Emscripten or DragonFly BSD", STARTS_WITH, ) diff --git a/src/test/rustdoc-gui/item-info-width.goml b/src/test/rustdoc-gui/item-info-width.goml index 7a32d902910..8b6d355a8f1 100644 --- a/src/test/rustdoc-gui/item-info-width.goml +++ b/src/test/rustdoc-gui/item-info-width.goml @@ -4,5 +4,5 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html size: (1100, 800) // We check that ".item-info" is bigger than its content. assert-css: (".item-info", {"width": "790px"}) -assert-css: (".item-info .stab", {"width": "340px"}) +assert-css: (".item-info .stab", {"width": "289px"}) assert-position: (".item-info .stab", {"x": 295}) diff --git a/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.rs b/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.rs new file mode 100644 index 00000000000..c71e5bee12e --- /dev/null +++ b/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.rs @@ -0,0 +1,6 @@ +// Regression test for issue #95879. + +use unresolved_crate::module::Name; //~ ERROR failed to resolve + +/// [Name] +pub struct S; diff --git a/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr b/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr new file mode 100644 index 00000000000..b60ab6050d7 --- /dev/null +++ b/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr @@ -0,0 +1,11 @@ +error[E0433]: failed to resolve: maybe a missing crate `unresolved_crate`? + --> $DIR/unresolved-import-recovery.rs:3:5 + | +LL | use unresolved_crate::module::Name; + | ^^^^^^^^^^^^^^^^ maybe a missing crate `unresolved_crate`? + +error: Compilation failed, aborting rustdoc + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/rustdoc/doc-cfg.rs b/src/test/rustdoc/doc-cfg.rs index 9465c8a35c8..4cddb0b76d4 100644 --- a/src/test/rustdoc/doc-cfg.rs +++ b/src/test/rustdoc/doc-cfg.rs @@ -4,21 +4,21 @@ // @has doc_cfg/struct.Portable.html // @!has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' '' // @has - '//*[@id="method.unix_and_arm_only_function"]' 'fn unix_and_arm_only_function()' -// @has - '//*[@class="stab portability"]' 'This is supported on Unix and ARM only.' +// @has - '//*[@class="stab portability"]' 'Available on Unix and ARM only.' // @has - '//*[@id="method.wasi_and_wasm32_only_function"]' 'fn wasi_and_wasm32_only_function()' -// @has - '//*[@class="stab portability"]' 'This is supported on WASI and WebAssembly only.' +// @has - '//*[@class="stab portability"]' 'Available on WASI and WebAssembly only.' pub struct Portable; // @has doc_cfg/unix_only/index.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ -// 'This is supported on Unix only.' +// 'Available on Unix only.' // @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AARM\Z' // @count - '//*[@class="stab portability"]' 2 #[doc(cfg(unix))] pub mod unix_only { // @has doc_cfg/unix_only/fn.unix_only_function.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ - // 'This is supported on Unix only.' + // 'Available on Unix only.' // @count - '//*[@class="stab portability"]' 1 pub fn unix_only_function() { content::should::be::irrelevant(); @@ -26,7 +26,7 @@ pub mod unix_only { // @has doc_cfg/unix_only/trait.ArmOnly.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ - // 'This is supported on Unix and ARM only.' + // 'Available on Unix and ARM only.' // @count - '//*[@class="stab portability"]' 1 #[doc(cfg(target_arch = "arm"))] pub trait ArmOnly { @@ -41,14 +41,14 @@ pub mod unix_only { // @has doc_cfg/wasi_only/index.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ -// 'This is supported on WASI only.' +// 'Available on WASI only.' // @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z' // @count - '//*[@class="stab portability"]' 2 #[doc(cfg(target_os = "wasi"))] pub mod wasi_only { // @has doc_cfg/wasi_only/fn.wasi_only_function.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ - // 'This is supported on WASI only.' + // 'Available on WASI only.' // @count - '//*[@class="stab portability"]' 1 pub fn wasi_only_function() { content::should::be::irrelevant(); @@ -56,7 +56,7 @@ pub mod wasi_only { // @has doc_cfg/wasi_only/trait.Wasm32Only.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ - // 'This is supported on WASI and WebAssembly only.' + // 'Available on WASI and WebAssembly only.' // @count - '//*[@class="stab portability"]' 1 #[doc(cfg(target_arch = "wasm32"))] pub trait Wasm32Only { @@ -78,7 +78,7 @@ pub mod wasi_only { // @has doc_cfg/fn.uses_target_feature.html // @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ -// 'This is supported with target feature avx only.' +// 'Available with target feature avx only.' #[target_feature(enable = "avx")] pub unsafe fn uses_target_feature() { content::should::be::irrelevant(); @@ -86,7 +86,7 @@ pub unsafe fn uses_target_feature() { // @has doc_cfg/fn.uses_cfg_target_feature.html // @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ -// 'This is supported with target feature avx only.' +// 'Available with target feature avx only.' #[doc(cfg(target_feature = "avx"))] pub fn uses_cfg_target_feature() { uses_target_feature(); @@ -95,7 +95,7 @@ pub fn uses_cfg_target_feature() { // multiple attributes should be allowed // @has doc_cfg/fn.multiple_attrs.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ -// 'This is supported on x and y and z only.' +// 'Available on x and y and z only.' #[doc(cfg(x))] #[doc(cfg(y), cfg(z))] pub fn multiple_attrs() {} diff --git a/src/test/rustdoc/duplicate-cfg.rs b/src/test/rustdoc/duplicate-cfg.rs index 886ec675030..18f3900b263 100644 --- a/src/test/rustdoc/duplicate-cfg.rs +++ b/src/test/rustdoc/duplicate-cfg.rs @@ -3,7 +3,7 @@ // @has 'foo/index.html' // @matches '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]' '^sync$' -// @has '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]/@title' 'This is supported on crate feature `sync` only' +// @has '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]/@title' 'Available on crate feature `sync` only' // @has 'foo/struct.Foo.html' // @has '-' '//*[@class="stab portability"]' 'sync' @@ -13,41 +13,41 @@ pub struct Foo; // @has 'foo/bar/index.html' -// @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync only.' +// @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync only.' #[doc(cfg(feature = "sync"))] pub mod bar { // @has 'foo/bar/struct.Bar.html' - // @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync only.' + // @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync only.' #[doc(cfg(feature = "sync"))] pub struct Bar; } // @has 'foo/baz/index.html' -// @has '-' '//*[@class="stab portability"]' 'This is supported on crate features sync and send only.' +// @has '-' '//*[@class="stab portability"]' 'Available on crate features sync and send only.' #[doc(cfg(all(feature = "sync", feature = "send")))] pub mod baz { // @has 'foo/baz/struct.Baz.html' - // @has '-' '//*[@class="stab portability"]' 'This is supported on crate features sync and send only.' + // @has '-' '//*[@class="stab portability"]' 'Available on crate features sync and send only.' #[doc(cfg(feature = "sync"))] pub struct Baz; } // @has 'foo/qux/index.html' -// @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync only.' +// @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync only.' #[doc(cfg(feature = "sync"))] pub mod qux { // @has 'foo/qux/struct.Qux.html' - // @has '-' '//*[@class="stab portability"]' 'This is supported on crate features sync and send only.' + // @has '-' '//*[@class="stab portability"]' 'Available on crate features sync and send only.' #[doc(cfg(all(feature = "sync", feature = "send")))] pub struct Qux; } // @has 'foo/quux/index.html' -// @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync and crate feature send and foo only.' +// @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync and crate feature send and foo only.' #[doc(cfg(all(feature = "sync", feature = "send", foo)))] pub mod quux { // @has 'foo/quux/struct.Quux.html' - // @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync and crate feature send and foo and bar only.' + // @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync and crate feature send and foo and bar only.' #[doc(cfg(all(feature = "send", feature = "sync", bar)))] pub struct Quux; } diff --git a/src/test/ui/use/use-super-global-path.rs b/src/test/ui/use/use-super-global-path.rs index 27a4a653b49..64bfd14b7e7 100644 --- a/src/test/ui/use/use-super-global-path.rs +++ b/src/test/ui/use/use-super-global-path.rs @@ -9,7 +9,7 @@ mod foo { pub fn g() { use ::super::main; //~ ERROR global paths cannot start with `super` - main(); //~ ERROR cannot find function `main` in this scope + main(); } } diff --git a/src/test/ui/use/use-super-global-path.stderr b/src/test/ui/use/use-super-global-path.stderr index edde26c1fc1..7014a12e9dd 100644 --- a/src/test/ui/use/use-super-global-path.stderr +++ b/src/test/ui/use/use-super-global-path.stderr @@ -16,18 +16,6 @@ error[E0433]: failed to resolve: global paths cannot start with `super` LL | use ::super::main; | ^^^^^ global paths cannot start with `super` -error[E0425]: cannot find function `main` in this scope - --> $DIR/use-super-global-path.rs:12:9 - | -LL | main(); - | ^^^^ not found in this scope - | -help: consider importing this function - | -LL | use main; - | - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0425, E0433. -For more information about an error, try `rustc --explain E0425`. +For more information about this error, try `rustc --explain E0433`. diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer -Subproject 46d7ee68f26285db26b2640f2c07d6332380c75 +Subproject 24cf957627d5ede1b395f92ff871fd7a281d49a |
