Skip to content

Rollup of 11 pull requests #82574

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 38 commits into from

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

upsuper and others added 30 commits February 14, 2021 09:45
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links`
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests

  Otherwise, all `rustdoc::` lints would be ignored.

- Register all existing lints as removed

  This unfortunately doesn't work with `register_renamed` because tool
  lints have not yet been registered when rustc is running. For similar
  reasons, `check_backwards_compat` doesn't work either. Call
  `register_removed` directly instead.

- Fix fallout

  + Rustdoc lints for compiler/
  + Rustdoc lints for library/

Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for
`rustdoc::intra_doc_link_resolution_failure`, since there was no time
when the latter was valid.
- Use `register_renamed` when rustdoc is running so the lint will still
  be active and use a structured suggestion
- Test the behavior for rustc, not just for rustdoc (because it differs)
- Move MISSING_CRATE_LEVEL_DOCS to rustdoc directly
- Update documentation

This also takes the opportunity to make the `no-crate-level-doc-lint`
test more specific.
Note that the FIXME was removed because this can't be fixed,
`register_renamed` calls LintId::of and there's no LintId for rustdoc
lints when rustc is running.
WASI's `filestat` type includes a size field, so expose it in
`MetadataExt` via a `size()` function, similar to the corresponding Unix
function.
This adds API documentation support for `std::os::wasi` modeled after
how `std::os::unix` works, so that WASI can be documented [here] along
with the other platforms.

[here]: https://doc.rust-lang.org/stable/std/os/index.html

Two changes of particular interest:

 - This changes the `AsRawFd` for `io::Stdin` for WASI to return
   `libc::STDIN_FILENO` instead of `sys::stdio::Stdin.as_raw_fd()` (and
   similar for `Stdout` and `Stderr`), which matches how the `unix`
   version works. `STDIN_FILENO` etc. may not always be explicitly
   reserved at the WASI level, but as long as we have Rust's `std` and
   `libc`, I think it's reasonable to guarantee that we'll always use
   `libc::STDIN_FILENO` for stdin.

 - This duplicates the `osstr2str` utility function, rather than
   trying to share it across all the configurations that need it.
Fixes rust-lang#82438

This map is not guarnateed to have an entry for a closure.
Co-authored-by: Nathan Nguyen <43092380+nhwn@users.noreply.github.com>
WASI's `RawFd` is a `u32`, while `libc` uses `c_int`.
This ensures that these names resolve to the right place even when
building the WASI support on other platforms for generating the
documentation.
As suggested by GuillaumeGomez
Make rustdoc lints a tool lint instead of built-in

- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` (and similar for other rustdoc lints; I don't expect any others to be used frequently, though).
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests
- Move lint machinery into a separate file
- Add `declare_rustdoc_lint!` macro

Unblocks rust-lang#80300, rust-lang#79816, rust-lang#80965. Makes the strangeness in rust-lang#77364 more apparent to the end user (note that `missing_docs` is *not* moved to rustdoc in this PR).

## Current status

This is waiting on FCP: rust-lang#80527 (comment)
…sue, r=camelid

update tracking issue for `relaxed_struct_unsize`

forgot to do this before rust-lang#80726 got merged. The tracking issue is rust-lang#81793
…leywiser

Replace const_cstr with cstr crate

This PR replaces the `const_cstr` macro inside `rustc_data_structures` with `cstr` macro from [cstr](https://crates.io/crates/cstr) crate.

The two macros basically serve the same purpose, which is to generate `&'static CStr` from a string literal. `cstr` is better because it validates the literal at compile time, while the existing `const_cstr` does it at runtime when `debug_assertions` is enabled. In addition, the value `cstr` generates can be used in constant context (which is seemingly not needed anywhere currently, though).
…onymous-lifetime, r=estebank

Improve anonymous lifetime note to indicate the target span

Improvement for  rust-lang#81650
Cc rust-lang#81995

Message after this improvement:
(Improve note in the middle)

```
error[E0311]: the parameter type `T` may not live long enough
  --> src/main.rs:25:11
   |
24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) {
   |              -- help: consider adding an explicit lifetime bound...: `T: 'a +`
25 |     scope.spawn(move |_| {
   |           ^^^^^
   |
note: the parameter type `T` must be valid for the anonymous lifetime defined on the function body at 24:40...
  --> src/main.rs:24:40
   |
24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) {
   |                                        ^^^^^
note: ...so that the type `[closure@src/main.rs:25:17: 27:6]` will meet its required lifetime bounds
  --> src/main.rs:25:11
   |
25 |     scope.spawn(move |_| {
   |           ^^^^^
```

r? `````@estebank`````
Add Future trait for doc_spotlight feature doc
…mps, r=petrochenkov

Test hexagon-enum only when llvm target is present

See rust-lang#82379 (comment)

r? `````@petrochenkov`````

`````@bors````` rollup
expand: Preserve order of inert attributes during expansion

Fixes rust-lang#67839
Fixes rust-lang#81871
r? ````@Aaron1011````
Enable API documentation for `std::os::wasi`.

This adds API documentation support for `std::os::wasi` modeled after
how `std::os::unix` works, so that WASI can be documented [here] along
with the other platforms.

[here]: https://doc.rust-lang.org/stable/std/os/index.html

Two changes of particular interest:

 - This changes the `AsRawFd` for `io::Stdin` for WASI to return
   `libc::STDIN_FILENO` instead of `sys::stdio::Stdin.as_raw_fd()` (and
   similar for `Stdout` and `Stderr`), which matches how the `unix`
   version works. `STDIN_FILENO` etc. may not always be explicitly
   reserved at the WASI level, but as long as we have Rust's `std` and
   `libc`, I think it's reasonable to guarantee that we'll always use
   `libc::STDIN_FILENO` for stdin.

 - This duplicates the `osstr2str` utility function, rather than
   trying to share it across all the configurations that need it.

r? ``@alexcrichton``
…lexcrichton

Add a `size()` function to WASI's `MetadataExt`.

WASI's `filestat` type includes a size field, so expose it in
`MetadataExt` via a `size()` function, similar to the corresponding Unix
function.

r? `````@alexcrichton`````
…matthewjasper

Skip emitting closure diagnostic when closure_kind_origins has no entry

Fixes rust-lang#82438

This map is not guarnateed to have an entry for a closure.
@rustbot rustbot added the rollup A PR which is a rollup label Feb 27, 2021
@Dylan-DPC-zz
Copy link
Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Feb 27, 2021

📌 Commit cd7737e has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 27, 2021
@bors
Copy link
Collaborator

bors commented Feb 27, 2021

⌛ Testing commit cd7737e with merge 9f95dd24a2ceb0f9897a4a037a7089fb73198961...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-aux failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test test::test_workspaces_cwd ... ok

failures:

---- doc::doc_message_format stdout ----
running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/cargo doc --message-format=json`
thread 'doc::doc_message_format' panicked at '
Expected: execs
    but: exited with Some(0)
--- stdout
{"reason":"compiler-message","package_id":"foo 0.0.1 (path+file:///checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo)","target":{"kind":["lib"],"crate_types":["lib"],"name":"foo","src_path":"/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo/src/lib.rs","edition":"2015","doc":true,"doctest":true,"test":true},"message":{"rendered":"warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`\n --> src/lib.rs:2:9\n  |\n2 | #![deny(broken_intra_doc_links)]\n  |         ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links`\n  |\n  = note: `#[warn(renamed_and_removed_lints)]` on by default\n\n","children":[{"children":[],"code":null,"level":"note","message":"`#[warn(renamed_and_removed_lints)]` on by default","rendered":null,"spans":[]},{"children":[],"code":null,"level":"help","message":"use the new name","rendered":null,"spans":[{"byte_end":31,"byte_start":9,"column_end":31,"column_start":9,"expansion":null,"file_name":"src/lib.rs","is_primary":true,"label":null,"line_end":2,"line_start":2,"suggested_replacement":"rustdoc::broken_intra_doc_links","suggestion_applicability":"MachineApplicable","text":[{"highlight_end":31,"highlight_start":9,"text":"#![deny(broken_intra_doc_links)]"}]}]}],"code":{"code":"renamed_and_removed_lints","explanation":null},"level":"warning","message":"lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`","spans":[{"byte_end":31,"byte_start":9,"column_end":31,"column_start":9,"expansion":null,"file_name":"src/lib.rs","is_primary":true,"label":null,"line_end":2,"line_start":2,"suggested_replacement":null,"suggestion_applicability":null,"text":[{"highlight_end":31,"highlight_start":9,"text":"#![deny(broken_intra_doc_links)]"}]}]}}
{"reason":"compiler-message","package_id":"foo 0.0.1 (path+file:///checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo)","target":{"kind":["lib"],"crate_types":["lib"],"name":"foo","src_path":"/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo/src/lib.rs","edition":"2015","doc":true,"doctest":true,"test":true},"message":{"rendered":"warning: unresolved link to `bad_link`\n --> src/lib.rs:4:6\n  |\n4 | /// [bad_link]\n  |      ^^^^^^^^ no item named `bad_link` in scope\n  |\n  = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default\n  = help: to escape `[` and `]` characters, add '\\' before them like `\\[` or `\\]`\n\n","children":[{"children":[],"code":null,"level":"note","message":"`#[warn(rustdoc::broken_intra_doc_links)]` on by default","rendered":null,"spans":[]},{"children":[],"code":null,"level":"help","message":"to escape `[` and `]` characters, add '\\' before them like `\\[` or `\\]`","rendered":null,"spans":[]}],"code":{"code":"rustdoc::broken_intra_doc_links","explanation":null},"level":"warning","message":"unresolved link to `bad_link`","spans":[{"byte_end":48,"byte_start":40,"column_end":14,"column_start":6,"expansion":null,"file_name":"src/lib.rs","is_primary":true,"label":"no item named `bad_link` in scope","line_end":4,"line_start":4,"suggested_replacement":null,"suggestion_applicability":null,"text":[{"highlight_end":14,"highlight_start":6,"text":"/// [bad_link]"}]}]}}
{"reason":"compiler-message","package_id":"foo 0.0.1 (path+file:///checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo)","target":{"kind":["lib"],"crate_types":["lib"],"name":"foo","src_path":"/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo/src/lib.rs","edition":"2015","doc":true,"doctest":true,"test":true},"message":{"rendered":"warning: 2 warnings emitted\n\n","children":[],"code":null,"level":"warning","message":"2 warnings emitted","spans":[]}}
{"reason":"compiler-artifact","package_id":"foo 0.0.1 (path+file:///checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo)","target":{"kind":["lib"],"crate_types":["lib"],"name":"foo","src_path":"/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo/src/lib.rs","edition":"2015","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo/target/doc/foo/index.html"],"executable":null,"fresh":false}
{"reason":"build-finished","success":true}
--- stderr
 Documenting foo v0.0.1 (/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t685/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 1.12s
', src/tools/cargo/crates/cargo-test-support/src/lib.rs:739:13
', src/tools/cargo/crates/cargo-test-support/src/lib.rs:739:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- doc::short_message_format stdout ----
running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/cargo doc --message-format=short`
thread 'doc::short_message_format' panicked at '
Expected: execs
    but: exited with Some(0)

--- stderr
 Documenting foo v0.0.1 (/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t715/foo)
 Documenting foo v0.0.1 (/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t715/foo)
src/lib.rs:2:9: warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`
src/lib.rs:4:6: warning: unresolved link to `bad_link`
    Finished dev [unoptimized + debuginfo] target(s) in 1.17s
', src/tools/cargo/crates/cargo-test-support/src/lib.rs:739:13


---


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --stage 2 src/tools/cargo src/tools/cargotest
Build completed unsuccessfully in 0:23:39
make: *** [check-aux] Error 1
Makefile:44: recipe for target 'check-aux' failed

@bors
Copy link
Collaborator

bors commented Feb 27, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 27, 2021
@Dylan-DPC-zz Dylan-DPC-zz deleted the rollup-zxmnl3k branch February 27, 2021 01:37
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.