Skip to content

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Dec 28, 2024

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

compiler-errors and others added 12 commits December 26, 2024 17:35
Signed-off-by: chloefeal <[email protected]>
Fix typos

This PR focuses on correcting typos and improving clarity in documentation files. Thank you.
Some random region tweaks

Remove a redundant function and add an assertion that I think is useful
…r-errors

Skip parenthesis if `.` makes statement boundary unambiguous

There is a rule in the parser that statements and match-arms never end in front of a `.` or `?` token (except when the `.` is really `..` or `..=` or `...`). So some of the leading subexpressions that need parentheses inserted when followed by some other operator like `-` or `+`, do not need parentheses when followed by `.` or `?`.

Example:

```rust
fn main() {
    loop {}.to_string() + "";
    match () {
        _ => loop {}.to_string() + "",
    };
}
```

`-Zunpretty=expanded` before:

```console
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
fn main() {
    (loop {}).to_string() + "";
    match () { _ => (loop {}).to_string() + "", };
}
```

After:

```console
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
fn main() {
    loop {}.to_string() + "";
    match () { _ => loop {}.to_string() + "", };
}
```
…rors

Skip parenthesis around tuple struct field calls

The pretty-printer previously did not distinguish between named vs unnamed fields when printing a function call containing a struct field. It would print the call as `(self.fun)()` for a named field which is correct, and `(self.0)()` for an unnamed field which is redundant.

This PR changes function calls of tuple struct fields to print without parens.

**Before:**

```rust
struct Tuple(fn());

fn main() {
    let tuple = Tuple(|| {});
    (tuple.0)();
}
```

**After:**

```rust
struct Tuple(fn());

fn main() {
    let tuple = Tuple(|| {});
    tuple.0();
}
```
@rustbot rustbot added 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. rollup A PR which is a rollup labels Dec 28, 2024
@dtolnay
Copy link
Member Author

dtolnay commented Dec 28, 2024

Replicate of #134837 but with updated revision of #134823.

@bors r+ rollup=never p=4

@bors
Copy link
Collaborator

bors commented Dec 28, 2024

📌 Commit 0a09252 has been approved by dtolnay

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 28, 2024
@bors
Copy link
Collaborator

bors commented Dec 28, 2024

⌛ Testing commit 0a09252 with merge 2b0ceb8...

@bors
Copy link
Collaborator

bors commented Dec 28, 2024

☀️ Test successful - checks-actions
Approved by: dtolnay
Pushing 2b0ceb8 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 28, 2024
@bors bors merged commit 2b0ceb8 into rust-lang:master Dec 28, 2024
7 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 28, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#134823 Fix typos 58894733fd783dd23f011413bcfae2d1197886a0 (link)
#134827 Some random region tweaks 98c1a176b1288bdaaf1391315337abb464d6c1a6 (link)
#134833 Skip parenthesis if . makes statement boundary unambiguous 4a8c035ddda1e56a3f1992f2963f8c5bb00cf65f (link)
#134834 Skip parenthesis around tuple struct field calls 5716bb83b3e381e940f3cbc1186f677b1cfd0a0d (link)

previous master: ecc189922d

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2b0ceb8): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary -0.2%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.7% [1.7%, 1.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 761.661s -> 762.197s (0.07%)
Artifact size: 325.61 MiB -> 325.56 MiB (-0.02%)

@dtolnay dtolnay deleted the rollup-1jm11rl branch December 28, 2024 11:02
poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request Dec 28, 2024
Rollup of 4 pull requests

Successful merges:

 - rust-lang#134823 (Fix typos)
 - rust-lang#134827 (Some random region tweaks)
 - rust-lang#134833 (Skip parenthesis if `.` makes statement boundary unambiguous)
 - rust-lang#134834 (Skip parenthesis around tuple struct field calls)

r? `@ghost`
`@rustbot` modify labels: rollup
@dtolnay dtolnay removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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. labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants