Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Rollup of 14 pull requests #80343

Closed
wants to merge 40 commits into from

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Polkaverse and others added 30 commits December 1, 2020 10:24
Also handle Tuple and Array separately, which was not explicitly checked.

Fixes rust-lang#79799.
This will make rustdoc behave properly when -Dwarnings is given
This uses the `SourceMap::doctest_offset_line` method to re-map line
numbers from doctests. Remapping columns is not yet done.

Part of issue rust-lang#79417.
Ran the tidy check

Following the diagnostic guide better

Diagnostic generation is now relegated to its own function in the diagnostics module.
Added tests

Fixed the ui test
Rename rustc_middle::lint::LintSource to rustc_middle::lint::LintLevelSource.
This is to clarify the difference between `LevelSource`
and `LintLevelSource`.

Appease x.py fmt.
- Don't make rustc_resolve::Res public; use a new type alias instead
This does *not* currently work for associated items that are
auto-implemented by the compiler (e.g. `never::eq`), because they aren't
present in the source code. I plan to fix this in a follow-up PR.
This caught several bugs where people expected `slice` to link to the
primitive, but it linked to the module instead.

This also uses `cfg_attr(bootstrap)` since the ambiguity only occurs
when compiling with stage 1.
`foreign_module` and `wasm_import_module` are not needed for linking,
and hence can be removed from CodegenResults.
Also updated the mir-opt test output files.
…idtwco

Added better error message for shared borrow treated as unique for purposes of lifetimes

Part of Issue rust-lang#76630

r? `@jyn514`
…davidtwco

path trimming: ignore type aliases

Continuation of rust-lang#73996.
…es-out-of-html, r=Nemo157

Move tooltips messages out of html

First thing first: nothing in the output has changed. You still have the "i" on the left of code blocks examples when they have `ignore`, `compile_fail`, `should_panic` and `edition`. The behavior also remains the same: when you hover the "i", you have the corresponding message showing up.

So now, why this PR then? I realized recently that we were actually generating those messages into the HTML every time whereas all messages are the same (except for the edition ones, I'll come back to it later). So instead of generating more content, I simply moved it inside the CSS thanks to pseudo elements (`::before` and `::after`). The message is now inside `::after` and we use the `::before` to have the small triangle on the left of the message. So now, we have less HTML generated which is seems pretty nice.

So now, back to the `edition` change: the message is globally the same, but the "edition" itself can be different (2015 or 2018 currently, I expect 2021 to arrive not too far in the future). So the only difference for it is that I added a new attribute on the tooltip called `edition` which contains this information. Then, the `::after` uses it inside its `content` (you can get the content of an element's attribute by using `attr` and concat different strings by simply having them after the other).

Don't hesitate if a part of my explanations isn't clear.

r? `@jyn514`
…Swatinem

Remap instrument-coverage line numbers in doctests

This uses the `SourceMap::doctest_offset_line` method to re-map line
numbers from doctests. Remapping columns is not yet done, and rustdoc
still does not output the correct filename when running doctests in a
workspace.

Part of rust-lang#79417 although I dont consider that fixed until both filenames
and columns are mapped correctly.

r? `@richkadel`

I might jump on zulip the comming days. Still need to figure out how to properly write tests for this, and deal with other doctest issues in the meantime.
…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
Refactored verbose print into a function

Also handle Tuple and Array separately, which was not explicitly checked.

Fixes rust-lang#79799.
Implemented a compiler diagnostic for move async mistake

Fixes rust-lang#79694

First time contributing, so I hope I'm doing everything right.
(If not, please correct me!)

This code performs a check when a move capture clause is parsed. The check is to detect if the user has reversed the async move keywords and to provide a diagnostic with a suggestion to fix it.

Checked code:
```rust
fn main() {
    move async { };
}
```

Previous output:
```txt
PS C:\Repos\move_async_test> cargo build
   Compiling move_async_test v0.1.0 (C:\Repos\move_async_test)
error: expected one of `|` or `||`, found keyword `async`
 --> src\main.rs:2:10
  |
2 |     move async { };
  |          ^^^^^ expected one of `|` or `||`

error: aborting due to previous error

error: could not compile `move_async_test`
```

New output:
```txt
PS C:\Repos\move_async_test> cargo +dev build
   Compiling move_async_test v0.1.0 (C:\Repos\move_async_test)
error: the order of `move` and `async` is incorrect
 --> src\main.rs:2:13
  |
2 |     let _ = move async { };
  |             ^^^^^^^^^^
  |
help: try switching the order
  |
2 |     let _ = async move { };
  |             ^^^^^^^^^^

error: aborting due to previous error

error: could not compile `move_async_test`
```

Is there a file/module where these kind of things are tested?
Would love some feedback 😄
…shearth

Fix intra-doc links for non-path primitives

This does *not* currently work for associated items that are
auto-implemented by the compiler (e.g. `never::eq`), because they aren't
present in the source code. I plan to fix this in a follow-up PR.

Fixes rust-lang#63351 using the approach mentioned in rust-lang#63351 (comment).

r? `@Manishearth`

cc `@petrochenkov` - this makes `rustc_resolve::Res` public, is that ok? I'd just add an identical type alias in rustdoc if not, which seems a waste.
Exclude unnecessary info from CodegenResults

`foreign_module` and `wasm_import_module` are not needed for linking, and hence can be removed from CodegenResults.

Fixes rust-lang#77857
…ark-Simulacrum

update rustfmt to v1.4.30

Contains fixes for a few reported bugs on current nightly (1.4.29)

Notes in: https://github.com/rust-lang/rustfmt/releases/tag/v1.4.30
…enkov

Rename rustc_middle::lint::LintSource

Rename [`rustc_middle::lint::LintSource`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/lint/enum.LintSource.html) to `rustc_middle::lint::LintLevelSource`.

This enum represents the source of a *lint level*, not a lint. This should improve code readability.

Update: Also documents `rustc_middle::lint::LevelSource` to clarify.
Add installation commands to `x` tool README
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
@Dylan-DPC-zz
Copy link
Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Dec 23, 2020

📌 Commit b48e221 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 Dec 23, 2020
@bors
Copy link
Contributor

bors commented Dec 24, 2020

⌛ Testing commit b48e221 with merge 22a066cfc233a58abb752af41d7c971e5a5a19a7...

@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)

warning: unused bitwise operation that must be used
  --> /tmp/ctfe-stress-4.rs:64:30
   |
64 | expensive_static!(OPS: i32 = ((((10 >> 1) + 3) * 7) / 2 - 12) << 4; [4 16 16 16 16]);

warning: 3 warnings emitted

+ cp -pri ../src/tools/cargo /tmp/cargo
---
[RUSTC-TIMING] rustc_middle test:false 155.051
   Compiling rustc_driver v0.0.0 (/checkout/compiler/rustc_driver)
[RUSTC-TIMING] rustc_driver test:false 25.258
   Compiling rustc-main v0.0.0 (/checkout/compiler/rustc)
warning: rustc_main.9jntyg83-cgu.1: No profile data available for function _ZN3std2rt10lang_start17hdf33ff13e4ec54cfE Hash = 12884901887

warning: rustc_main.9jntyg83-cgu.2: No profile data available for function _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hcddb088708a8c900E Hash = 281487861612543

warning: rustc_main.9jntyg83-cgu.1: No profile data available for function _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h01083035550ef7f3E Hash = 12884901887

warning: rustc_main.9jntyg83-cgu.1: No profile data available for function _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h24487d1575d92685E Hash = 12884901887

warning: rustc_main.9jntyg83-cgu.1: No profile data available for function _ZN4core3ptr13drop_in_place17hb0ed202a8bbc3590E Hash = 12884901887

warning: rustc_main.9jntyg83-cgu.0: No profile data available for function _ZN10rustc_main4main17hd58bc9a0215fadfdE Hash = 12884901887

warning: rustc_main.9jntyg83-cgu.0: No profile data available for function main Hash = 12884901887
warning: 7 warnings emitted

[RUSTC-TIMING] rustc_main test:false 0.465
    Finished release [optimized] target(s) in 3m 19s
---
 Documenting rustc_target v0.0.0 (/checkout/compiler/rustc_target)
 Documenting rustc_feature v0.0.0 (/checkout/compiler/rustc_feature)
[RUSTC-TIMING] rustc_parse_format test:false 0.192
[RUSTC-TIMING] rustc_feature test:false 0.383
error: unresolved link to `repr(transparent)`
   --> compiler/rustc_feature/src/active.rs:46:19
    |
46  |                   $(#[doc = $doc])*
...
...
95  | / declare_features! (
96  | |     // -------------------------------------------------------------------------
97  | |     // feature-group-start: internal feature gates
98  | |     // -------------------------------------------------------------------------
628 | |     // -------------------------------------------------------------------------
629 | | );
    | |__- in this macro invocation
    |
    |
    = note: `-D broken-intra-doc-links` implied by `-D warnings`
    = note: the link appears in this line:
            
            Allows #[repr(transparent)] on unions (RFC 2645).
                     ^^^^^^^^^^^^^^^^^
    = note: no item named `repr(transparent)` in scope
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: unresolved link to `repr(transparent)`
   --> compiler/rustc_feature/src/active.rs:46:19
    |
46  |                   $(#[doc = $doc])*
...
...
95  | / declare_features! (
96  | |     // -------------------------------------------------------------------------
97  | |     // feature-group-start: internal feature gates
98  | |     // -------------------------------------------------------------------------
628 | |     // -------------------------------------------------------------------------
629 | | );
    | |__- in this macro invocation
    |
    |
    = note: the link appears in this line:
            
            Allows #[repr(transparent)] on unions (RFC 2645).
                     ^^^^^^^^^^^^^^^^^
    = note: no item named `repr(transparent)` in scope
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors

error: could not document `rustc_feature`


Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2018 --crate-type lib --crate-name rustc_feature compiler/rustc_feature/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_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_span=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-3f54fec704da7e59.rmeta -Dwarnings -Winvalid_codeblock_attributes --crate-version '1.50.0-nightly
  (22a066cfc
  2020-12-24)' --document-private-items --enable-index-page -Zunstable-options -Znormalize-docs` (exit code: 1)
[RUSTC-TIMING] serde test:false 2.752
[RUSTC-TIMING] rustc_target test:false 2.870
[RUSTC-TIMING] rustc_ast test:false 3.839
error: build failed
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_parse" "-p" "rustc_attr" "-p" "rustc_trait_selection" "-p" "rustc_ast_passes" "-p" "rustc_ast" "-p" "rustc_middle" "-p" "rustc_hir" "-p" "rustc_index" "-p" "rustc_fs_util" "-p" "rustc_traits" "-p" "rustc_data_structures" "-p" "rustc_lexer" "-p" "rustc_symbol_mangling" "-p" "rustc_driver" "-p" "rustc_llvm" "-p" "rustc_query_system" "-p" "rustc_interface" "-p" "rustc_privacy" "-p" "rustc_codegen_llvm" "-p" "rustc_incremental" "-p" "rustc_save_analysis" "-p" "coverage_test_macros" "-p" "rustc_graphviz" "-p" "rustc_lint" "-p" "rustc_arena" "-p" "rustc_target" "-p" "rustc_builtin_macros" "-p" "rustc_lint_defs" "-p" "rustc_plugin_impl" "-p" "rustc_error_codes" "-p" "rustc_serialize" "-p" "rustc_parse_format" "-p" "rustc_mir_build" "-p" "rustc_infer" "-p" "rustc_hir_pretty" "-p" "rustc_span" "-p" "rustc_typeck" "-p" "rustc_session" "-p" "rustc_errors" "-p" "rustc_codegen_ssa" "-p" "rustc_resolve" "-p" "rustc_ast_pretty" "-p" "rustc_type_ir" "-p" "rustc_ast_lowering" "-p" "rustc_macros" "-p" "rustc_apfloat" "-p" "rustc_metadata" "-p" "rustc_expand" "-p" "rustc_passes" "-p" "rustc_feature" "-p" "rustc_ty_utils" "-p" "rustc_mir"


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 --rust-profile-use=/tmp/rustc-pgo.profdata
Build completed unsuccessfully in 0:06:15

@bors
Copy link
Contributor

bors commented Dec 24, 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 24, 2020
@Dylan-DPC-zz Dylan-DPC-zz deleted the rollup-0i0t8m7 branch December 24, 2020 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.