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 10 pull requests #80305

Closed
wants to merge 32 commits into from

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

poliorcetics and others added 30 commits December 15, 2020 19:22
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.
Edit punctuation in doc comment for rustc_middle::lint::LintSource::CommandLine.
Expand abbreviations for "incremental compliation".

Also added the word "to" to the description of CacheEncoder.
Each label needs to be separated by a comma (see the ICE issue template
for an example of correct usage).
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
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
…=Amanieu

Deprecate atomic compare_and_swap method

Finish implementing [RFC 1443](https://github.com/rust-lang/rfcs/blob/master/text/1443-extended-compare-and-swap.md) (rust-lang/rfcs#1443).

It was decided to deprecate `compare_and_swap` [back in Rust 1.12 already](rust-lang#31767 (comment)). I can't find any info about that decision being reverted. My understanding is just that it has been forgotten. If there has been a decision on keeping `compare_and_swap` then it's hard to find, and even if this PR does not go through it can act as a place where people can find out about the decision being reverted.

Atomic operations are hard to understand, very hard. And it does not help that there are multiple similar methods to do compare and swap with. They are so similar that for a reader it might be hard to understand the difference. This PR aims to make that simpler by finally deprecating `compare_and_swap` which is essentially just a more limited version of `compare_exchange`. The documentation is also updated (according to the RFC text) to explain the differences a bit better.

Even if we decide to not deprecate `compare_and_swap`. I still think the documentation for the atomic operations should be improved to better describe their differences and similarities. And the documentation can be written nicer than the PR currently proposes, but I wanted to start somewhere. Most of it is just copied from the RFC.

The documentation for `compare_exchange` and `compare_exchange_weak` indeed describe how they work! The problem is that they are more complex and harder to understand than `compare_and_swap`. So for someone who does not fully grasp this they might fall back to using `compare_and_swap`. Making the documentation outline the similarities and differences might build a bridge for people so they can cross over to the more powerful and sometimes more efficient operations.

The conversions I do to avoid the `std` internal deprecation errors are very straight forward `compare_and_swap -> compare_exchange` changes where the orderings are just using the mapping in the new documentation. Only in one place did I use `compare_exchange_weak`. This can probably be improved further. But the goal here was not for those operations to be perfect. Just to not get worse and to allow the deprecation to happen.
…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
…mulacrum

Add test for issue rust-lang#74824

It was fixed a while ago, but doesn't have a test.

Closes rust-lang#74824
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 😄
… r=oli-obk

Edit rustc_middle::lint::LintSource docs

Edit punctuation in doc comment for [rustc_middle::lint::LintSource::CommandLine](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/lint/enum.LintSource.html#variant.CommandLine).
…k, r=varkor

docs: Edit rustc_middle::ty::query::on_disk_cache

Expand abbreviations for "incremental compliation".

Also added the word "to" to the description of CacheEncoder.
…ls, r=m-ou-se

Fix labels for 'Library Tracking Issue' template

Each label needs to be separated by a comma (see the ICE issue template
for an example of correct usage).

r? ````@m-ou-se````
…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
…_specifier_hard_error, r=Mark-Simulacrum

Revert missing fragment specifier hard error

Closes rust-lang#76605

Reopens rust-lang#40107

r? `@Mark-Simulacrum`
@rustbot rustbot added the rollup A PR which is a rollup label Dec 22, 2020
@Dylan-DPC-zz Dylan-DPC-zz deleted the rollup-0w2j9gi branch December 23, 2020 01:52
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet