Skip to content

Rollup of 4 pull requests #80329

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

Conversation

GuillaumeGomez
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

poliorcetics and others added 9 commits December 15, 2020 19:22
This will make rustdoc behave properly when -Dwarnings is given
…, accounting for code block edition modifiers

This is a squash of these commits:
- Highlight edition-specific keywords correctly in code blocks,
accounting for code block edition modifiers
- Fix unit tests
- Revert changes to rustc_span::symbol to prepare for merge of rust-lang#80272
- Use new Symbol::is_reserved API from rust-lang#80272
…r=jyn514

Declare a new lint to properly deny warnings in rustdoc

This declares a new lint: `INVALID_RUST_CODEBLOCK` that is used by `rustdoc` to properly follow `-D warnings` instead of unconditionally emitting a warning.

## Todo List

- [x] Declare lint.
- [x] Document lint (file: `src/doc/rustdoc/src/lints.md`).
- [x] Use lint in `rustdoc` (file: `src/librustdoc/passes/check_code_block_syntax.rs`, maybe others).
- [x] Write tests.
  - [x] Note: one for the behaviour of the new lint when the error is in a dependency, not the crate being tested (rust-lang#79816 (comment))
- [x] Refactor things.

## Questions

- How/where are lints tested ?
- Where are lints for `rustdoc` tested ?

Fix rust-lang#79792.

`@rustbot` label T-rustdoc A-lint
…yn514,petrochenkov

Highlight edition-specific keywords correctly in code blocks, accounting for code block edition modifiers

Previously, edition-specific keywords (such as `async` and `await`) were not highlighted in code blocks, regardless of what edition was set. With this PR, this issue is fixed.

Now, the following behavior happens:
- When a code block is explicitly set to edition X, keywords from edition X are highlighted
- When a code block is explicitly set to a version that does not contain those keywords from edition X (e.g. edition Y), keywords from edition X are **not** highlighted
- When a code block has no explicit edition, keywords from the edition passed via `--edition` to rustdoc are highlighted

For example, a project set with `edition = "2015"` in its `Cargo.toml` would not highlight `async`/`await` unless the code block was set to `edition2018`. Additionally, a project set with `edition = "2018"` in its `Cargo.toml` *would* highlight `async`/`await` unless the code block was set to a version that did not contain those keywords (e.g. `edition2015`).

This PR fixes rust-lang#80004.

r? `@jyn514`
Include rustdoc in the compiler docs index.

This should help ensure that the index page at https://doc.rust-lang.org/nightly/nightly-rustc/ includes a link to the rustdoc docs as well.

Fixes rust-lang#80307
…=GuillaumeGomez

Updated the match with the matches macro

r?`@GuillaumeGomez`
@rustbot rustbot added the rollup A PR which is a rollup label Dec 23, 2020
@GuillaumeGomez
Copy link
Member Author

@bors: r+ p=4

@bors
Copy link
Collaborator

bors commented Dec 23, 2020

📌 Commit 9dec86d has been approved by GuillaumeGomez

@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 Dec 23, 2020
@bors
Copy link
Collaborator

bors commented Dec 23, 2020

⌛ Testing commit 9dec86d with merge 495c0afd0897816392771bae8fa745f94e1e1342...

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
355 | |     ///       Place(base: hir_id_p, projections: [], ...) -> (hir_id_L4, ByRef(ImmutBorrow))
356 | |     /// ```
    | |___________^
    |
    = note: `-D invalid-rust-codeblock` implied by `-D warnings`
help: mark blocks that do not contain Rust code as text
    |
350 |     /// ```text
    |         ^^^^^^^
---

error: could not document `rustc_typeck`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2018 --crate-type lib --crate-name rustc_typeck compiler/rustc_typeck/src/lib.rs --target x86_64-unknown-linux-gnu -o /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/release/deps --extern rustc_arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_arena-e2f417d3f6c44169.rmeta --extern rustc_ast=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_ast-af8907c51d0619b2.rmeta --extern rustc_attr=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_attr-2f11728d63006441.rmeta --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-900d11de835d34e6.rmeta --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-1aabeb89ce38e926.rmeta --extern rustc_hir=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir-782d95bf352570dd.rmeta --extern rustc_hir_pretty=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir_pretty-603bc548b3c45258.rmeta --extern rustc_index=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_index-984047fbd60b0386.rmeta --extern rustc_infer=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_infer-01d356349ffa8afd.rmeta --extern rustc_macros=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/release/deps/librustc_macros-5f0ec4a119c6ac86.so --extern rustc_middle=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_middle-fc5655365d5ee0f8.rmeta --extern rustc_session=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_session-b88d46fe3041e688.rmeta --extern rustc_span=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-3f54fec704da7e59.rmeta --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-a7d4facd2979b981.rmeta --extern rustc_trait_selection=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_trait_selection-d813db1c1fb0c7e8.rmeta --extern smallvec=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libsmallvec-e1ca8c1925105298.rmeta --extern tracing=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libtracing-166f52f5b1e92350.rmeta -Dwarnings -Winvalid_codeblock_attributes --crate-version '1.50.0-nightly
  (495c0afd0
  2020-12-23)' --document-private-items --enable-index-page -Zunstable-options -Znormalize-docs` (exit code: 1)
error: could not parse code block as Rust code
    --> compiler/rustc_mir/src/borrow_check/region_infer/mod.rs:1244:9
     |
1244 |       /// ```ignore (internal compiler representation so lifetime syntax is invalid)
1244 |       /// ```ignore (internal compiler representation so lifetime syntax is invalid)
     |  _________^
1245 | |     /// <T as Foo<'0>>::Item: '1
1246 | |     /// ```
     | |___________^
     |
     = note: `-D invalid-rust-codeblock` implied by `-D warnings`
     = note: error from rustc: lifetimes cannot start with a number

error: aborting due to previous error


[RUSTC-TIMING] rustc_typeck test:false 9.286
[RUSTC-TIMING] rustc_mir test:false 15.172
error: build failed


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "doc" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--features" "jemalloc llvm max_level_info" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "--no-deps" "-p" "rustc_type_ir" "-p" "rustc_index" "-p" "rustc_parse_format" "-p" "rustc_attr" "-p" "rustc_expand" "-p" "rustc_macros" "-p" "rustc_infer" "-p" "rustc_incremental" "-p" "rustc_span" "-p" "rustc_target" "-p" "rustc_privacy" "-p" "rustc_driver" "-p" "rustc_metadata" "-p" "rustc_ast" "-p" "rustc_ty_utils" "-p" "rustc_errors" "-p" "rustc_codegen_ssa" "-p" "rustc_mir_build" "-p" "rustc_lexer" "-p" "rustc_llvm" "-p" "rustc_arena" "-p" "rustc_resolve" "-p" "coverage_test_macros" "-p" "rustc_codegen_llvm" "-p" "rustc_builtin_macros" "-p" "rustc_hir" "-p" "rustc_feature" "-p" "rustc_mir" "-p" "rustc_ast_passes" "-p" "rustc_trait_selection" "-p" "rustc_serialize" "-p" "rustc_parse" "-p" "rustc_interface" "-p" "rustc_lint_defs" "-p" "rustc_query_system" "-p" "rustc_plugin_impl" "-p" "rustc_passes" "-p" "rustc_save_analysis" "-p" "rustc_typeck" "-p" "rustc_traits" "-p" "rustc_session" "-p" "rustc_ast_lowering" "-p" "rustc_graphviz" "-p" "rustc_ast_pretty" "-p" "rustc_hir_pretty" "-p" "rustc_data_structures" "-p" "rustc_apfloat" "-p" "rustc_middle" "-p" "rustc_lint" "-p" "rustc_error_codes" "-p" "rustc_symbol_mangling" "-p" "rustc_fs_util"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap dist --host x86_64-unknown-linux-gnu --target x86_64-unknown-linux-gnu --include-default-paths src/tools/build-manifest
Build completed unsuccessfully in 0:23:26

@bors
Copy link
Collaborator

bors commented Dec 23, 2020

💔 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 Dec 23, 2020
@GuillaumeGomez GuillaumeGomez deleted the rollup-6jnzt1x branch December 23, 2020 12:56
# 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.

8 participants