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 9 pull requests #101128

Closed
wants to merge 45 commits into from
Closed

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

devnexen and others added 30 commits July 6, 2022 19:52
to be able to set a marker/id on the socket for network filtering
 (iptables/ipfw here) purpose.
I refactored the code:
- Removed handling of methods, as it felt entirely unnecessary
- Removed clippy utils (obviously...)
- Used some shiny compiler features
  (let-else is very handy for lints 👀)
- I also renamed the lint to `for_loop_over_fallibles` (note: no `s`).
  I'm not sure what's the naming convention here, so maybe I'm wrong.
if the iterator is used after the loop, we need to use `.by_ref()`
The loop could contain `break;` that won't work with an `if let`
Those are basically the same but the first one seems to fit better
The macro warn_ was named like that because it the
keyword warn is a built-in attribute and at the time
this macro was created the word 'warning' was also
taken.

However it is no longer the case and we can rename
warn_ to warning.
tmiasko and others added 13 commits August 26, 2022 14:27
… r=joshtriplett

Support parsing IP addresses from a byte string

Fixes rust-lang#94821

The goal is to be able to parse addresses from a byte string without requiring to do any utf8 validation. Since internally the parser already works on byte strings, this should be possible and I personally already needed this in the past too.

~~I used the proposed approach from the issue by implementing `TryFrom<&'a [u8]>` for all 6 address types (3 ip address types and 3 socket address types). I believe implementing stable traits for stable types is insta-stable so this will probably need an FCP?~~

Switched to an unstable inherent method approach called `parse_ascii` as requested.

cc ``@jyn514``
socket `set_mark` addition.

to be able to set a marker/id on the socket for network filtering
 (iptables/ipfw here) purpose.
Replace `Body::basic_blocks()` with field access

Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks
independently from other parts of MIR by accessing the `basic_blocks` field
directly.

Replace unnecessary `Body::basic_blocks()` method with a direct field access,
which has an additional benefit of borrowing the basic blocks only.
Uplift `clippy::for_loops_over_fallibles` lint into rustc

This PR, as the title suggests, uplifts [`clippy::for_loops_over_fallibles`] lint into rustc. This lint warns for code like this:
```rust
for _ in Some(1) {}
for _ in Ok::<_, ()>(1) {}
```
i.e. directly iterating over `Option` and `Result` using `for` loop.

There are a number of suggestions that this PR adds (on top of what clippy suggested):
1. If the argument (? is there a better name for that expression) of a `for` loop is a `.next()` call, then we can suggest removing it (or rather replacing with `.by_ref()` to allow iterator being used later)
   ```rust
    for _ in iter.next() {}
    // turns into
    for _ in iter.by_ref() {}
    ```
2. (otherwise) We can suggest using `while let`, this is useful for non-iterator, iterator-like things like [async] channels
   ```rust
   for _ in rx.recv() {}
   // turns into
   while let Some(_) = rx.recv() {}
   ```
3. If the argument type is `Result<impl IntoIterator, _>` and the body has a `Result<_, _>` type, we can suggest using `?`
   ```rust
   for _ in f() {}
   // turns into
   for _ in f()? {}
   ```
4. To preserve the original behavior and clear intent, we can suggest using `if let`
   ```rust
   for _ in f() {}
   // turns into
   if let Some(_) = f() {}
   ```
(P.S. `Some` and `Ok` are interchangeable depending on the type)

I still feel that the lint wording/look is somewhat off, so I'll be happy to hear suggestions (on how to improve suggestions :D)!

Resolves rust-lang#99272

[`clippy::for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles
…tch-err, r=oli-obk

Improve const mismatch `FulfillmentError`

Fixes rust-lang#100414
…, r=petrochenkov

Pretty printing give proper error message without panic

Fixes rust-lang#100770
…piler-errors

Migrate part of rustc_infer to session diagnostic
…name-attr-warning, r=davidtwco

translations: rename warn_ to warning

## Description

This MR renames the the macro `warn_` to `warning`.

To give a little bit of context, as [explained](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20diag.20translation/near/295074146) by ```@davidtwco``` in the Zulip channel, `warn_`  was named like that because the keyword `warn` is a built-in attribute and at the time this macro was created the word `warning` was also
taken.

However, it is no longer the case and we can rename `warn_` to `warning`.
…r=notriddle

[rustdoc] Remove Attrs type alias

When working on rust-lang#101006, I was quite confused because of this type alias as I'm used to having rustdoc types into `clean/types.rs`. Anyway, considering how few uses of it we have, I simply removed it.

r? `@notriddle`
@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Aug 28, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Aug 28, 2022

📌 Commit 0359304 has been approved by Dylan-DPC

It is now in the queue for this repository.

@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 Aug 28, 2022
@bors
Copy link
Contributor

bors commented Aug 28, 2022

⌛ Testing commit 0359304 with merge 1c41a72ee9d28b645c51ac930c48e6813ff1f368...

@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)
[RUSTC-TIMING] crates_io test:false 4.729
   Compiling git2-curl v0.15.0
[RUSTC-TIMING] git2_curl test:false 1.094
[RUSTC-TIMING] git2 test:false 9.935
warning: for loop over an `Option`. This is more readably written as an `if let` statement
    |
    |
398 |     for r in previous {
    |
    |
    = note: `#[warn(for_loop_over_fallibles)]` on by default
help: to check pattern in a loop use `while let`
    |
398 |     while let Some(r) = previous {
    |     ~~~~~~~~~~~~~~~ ~~~
help: consider using `if let` to clear intent
    |
398 |     if let Some(r) = previous {

[RUSTC-TIMING] toml_edit test:false 79.976
[RUSTC-TIMING] cargo test:false 99.038
warning: `cargo` (lib) generated 1 warning
---
[RUSTC-TIMING] cargo_util test:false 2.657
[RUSTC-TIMING] rustc_workspace_hack test:false 0.038
[RUSTC-TIMING] git2_curl test:false 1.094
[RUSTC-TIMING] crates_io test:false 4.729
warning: for loop over an `Option`. This is more readably written as an `if let` statement
    |
    |
398 |     for r in previous {
    |
    |
    = note: `#[warn(for_loop_over_fallibles)]` on by default
help: to check pattern in a loop use `while let`
    |
398 |     while let Some(r) = previous {
    |     ~~~~~~~~~~~~~~~ ~~~
help: consider using `if let` to clear intent
    |
398 |     if let Some(r) = previous {

[RUSTC-TIMING] cargo test:false 99.038
warning: `cargo` (lib) generated 1 warning
[RUSTC-TIMING] cargo test:false 11.737
---
warning: `cargo-test-support` (lib) generated 1 warning
   Compiling cargo v0.66.0 (/checkout/src/tools/cargo)
[RUSTC-TIMING] internal test:true 1.462
[RUSTC-TIMING] build_std test:true 2.214
error: for loop over an `Option`. This is more readably written as an `if let` statement
    |
    |
398 |     for r in previous {
    |
note: the lint level is defined here
   --> src/tools/cargo/src/cargo/lib.rs:4:24
    |
    |
4   | #![cfg_attr(test, deny(warnings))]
    |                        ^^^^^^^^
    = note: `#[deny(for_loop_over_fallibles)]` implied by `#[deny(warnings)]`
help: to check pattern in a loop use `while let`
    |
398 |     while let Some(r) = previous {
    |     ~~~~~~~~~~~~~~~ ~~~
help: consider using `if let` to clear intent
    |
398 |     if let Some(r) = previous {

[RUSTC-TIMING] cargo test:true 20.271
error: could not compile `cargo` due to previous error
warning: build failed, waiting for other jobs to finish...
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] testsuite test:true 52.061
Build completed unsuccessfully in 0:29:57
make: *** [check-aux] Error 1
Makefile:44: recipe for target 'check-aux' failed

@bors
Copy link
Contributor

bors commented Aug 28, 2022

💔 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 Aug 28, 2022
@davidtwco davidtwco removed the A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic label Oct 4, 2022
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.