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 8 pull requests #93498

Merged
merged 24 commits into from
Jan 31, 2022
Merged

Rollup of 8 pull requests #93498

merged 24 commits into from
Jan 31, 2022

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

pierwill and others added 24 commits November 6, 2021 20:59
New implementation takes into account contents of `self.buf` and rounds
lower bound up instead of down.
`self.buf` can contain a surrogate, but only a leading one.
There's no such CSS rule as `box-shadow-color`, so I instead copied the
whole `box-shadow` property to each rule to make it actually apply.
There are cases, when data in the buf might or might not be an error.
Previously the pretty printer would compute indentation always relative
to whatever column a block begins at, like this:

    fn demo(arg1: usize,
            arg2: usize);

This is never the thing to do in the dominant contemporary Rust style.
Rustfmt's default and the style used by the vast majority of Rust
codebases is block indentation:

    fn demo(
        arg1: usize,
        arg2: usize,
    );

where every indentation level is a multiple of 4 spaces and each level
is indented relative to the indentation of the previous line, not the
position that the block starts in.
The `print_expr` method already places an `ibox(INDENT_UNIT)` around
every expr that gets printed. Some exprs were then using `self.head`
inside of that, which does its own `cbox(INDENT_UNIT)`, resulting in two
levels of indentation:

    while true {
            stuff;
        }

This commit fixes those cases to produce the expected single level of
indentation within every expression containing a block.

    while true {
        stuff;
    }
… r=jackh726

Improve terminology around "after typeck"

Closes rust-lang#70258.
…lision, r=jackh726

Allow eliding GATs in expression position

Thoughts on whether this is worthwhile?

Fixes rust-lang#92836

r? ``@jackh726``
Switch pretty printer to block-based indentation

This PR backports dtolnay/prettyplease@401d60c from the `prettyplease` crate into `rustc_ast_pretty`.

A before and after:

```diff
- let res =
-     ((::alloc::fmt::format as
-          for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1
-                                                             as
-                                                             fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test"
-                                                                                                                                          as
-                                                                                                                                          &str)]
-                                                                                                                                        as
-                                                                                                                                        [&str; 1])
-                                                                                                                                      as
-                                                                                                                                      &[&str; 1]),
-                                                                                                                                  (&([]
-                                                                                                                                        as
-                                                                                                                                        [ArgumentV1; 0])
-                                                                                                                                      as
-                                                                                                                                      &[ArgumentV1; 0]))
-                                                            as
-                                                            Arguments))
-         as String);
+ let res =
+     ((::alloc::fmt::format as
+             for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1
+                 as
+                 fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test"
+                             as &str)] as [&str; 1]) as
+                 &[&str; 1]),
+             (&([] as [ArgumentV1; 0]) as &[ArgumentV1; 0])) as
+             Arguments)) as String);
```

Previously the pretty printer would compute indentation always relative to whatever column a block begins at, like this:

```rust
fn demo(arg1: usize,
        arg2: usize);
```

This is never the thing to do in the dominant contemporary Rust style. Rustfmt's default and the style used by the vast majority of Rust codebases is block indentation:

```rust
fn demo(
    arg1: usize,
    arg2: usize,
);
```

where every indentation level is a multiple of 4 spaces and each level is indented relative to the indentation of the previous line, not the position that the block starts in.

By itself this PR doesn't get perfect formatting in all cases, but it is the smallest possible step in clearly the right direction. More backports from `prettyplease` to tune the ibox/cbox indent levels around various AST node types are upcoming.
Respect doc(hidden) when suggesting available fields

Resolves rust-lang#93210
…16_size_hint, r=dtolnay

Make `char::DecodeUtf16::size_hist` more precise

New implementation takes into account contents of `self.buf` and rounds lower bound up instead of down.

Fixes rust-lang#88762
Revival of rust-lang#88763
Clarify documentation on char::MAX

As mentioned in rust-lang#91836 (comment), the documentation on `char::MAX` is not quite correct – USVs are not "only ones within a certain range", they are code points _outside_ a certain range. I have corrected this and given the actual numbers as there is no reason to hide them.
…laumeGomez,jsha

Fix some CSS warnings and errors from VS Code

There's no such CSS rule as `box-shadow-color`, so I instead copied the
whole `box-shadow` property to each rule to make it actually apply.

r? `@jsha`
@rustbot rustbot added T-compiler Relevant to the compiler 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 Jan 31, 2022
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=8

@bors
Copy link
Contributor

bors commented Jan 31, 2022

📌 Commit 2070b22 has been approved by matthiaskrgr

@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 Jan 31, 2022
@bors
Copy link
Contributor

bors commented Jan 31, 2022

⌛ Testing commit 2070b22 with merge eef0b547839e23216f08914b8845caf10b10cb1e...

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
-hello dup fd
-

The actual stdout differed from the expected stdout.
Actual stdout saved to /tmp/compiletestmaIGXa/fs.stage-id.stdout

-hello dup fd
+error: unsupported operation: can't call foreign function: readdir64
+   --> /checkout/library/std/src/sys/unix/fs.rs:482:33
---
+
 

The actual stderr differed from the expected stderr.
Actual stderr saved to /tmp/compiletestmaIGXa/fs.stage-id.stderr
To only update this specific test, also pass `--test-args fs.rs`

error: 2 errors occurred comparing output.
status: exit status: 1
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools-bin/miri" "tests/run-pass/fs.rs" "-L" "/tmp/compiletestmaIGXa" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/tmp/compiletestmaIGXa/fs.stage-id" "-A" "unused" "--edition" "2018" "-Astable-features" "--sysroot" "/home/user/.cache/miri/HOST" "-Zmiri-disable-isolation" "-L" "/tmp/compiletestmaIGXa/fs.stage-id.aux"
------------------------------------------

------------------------------------------
stderr:
---
.......... (50/59)
........  (59/59)


/checkout/src/test/rustdoc-gui/search-tab-selection-if-current-is-empty.goml search-tab-selection-if-current-is-empty... FAILED
[ERROR] (line 6) TimeoutError: waiting for selector "#titles" failed: timeout 30000ms exceeded: for command `wait-for: "#titles"`



command did not execute successfully: "/node-v14.4.0-linux-x64/bin/node" "/checkout/src/tools/rustdoc-gui/tester.js" "--jobs" "16" "--doc-folder" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc" "--tests-folder" "/checkout/src/test/rustdoc-gui"


Build completed unsuccessfully in 0:00:46

@bors
Copy link
Contributor

bors commented Jan 31, 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 Jan 31, 2022
@matthiaskrgr
Copy link
Member Author

@bors retry rustdoc test timeout

error: 2 errors occurred comparing output.
status: exit status: 1
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools-bin/miri" "tests/run-pass/fs.rs" "-L" "/tmp/compiletestmaIGXa" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/tmp/compiletestmaIGXa/fs.stage-id" "-A" "unused" "--edition" "2018" "-Astable-features" "--sysroot" "/home/user/.cache/miri/HOST" "-Zmiri-disable-isolation" "-L" "/tmp/compiletestmaIGXa/fs.stage-id.aux"
------------------------------------------

------------------------------------------
stderr:
---
.......... (50/59)
........  (59/59)


/checkout/src/test/rustdoc-gui/search-tab-selection-if-current-is-empty.goml search-tab-selection-if-current-is-empty... FAILED
[ERROR] (line 6) TimeoutError: waiting for selector "#titles" failed: timeout 30000ms exceeded: for command `wait-for: "#titles"`

@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 Jan 31, 2022
@bors
Copy link
Contributor

bors commented Jan 31, 2022

⌛ Testing commit 2070b22 with merge 86f5e17...

@bors
Copy link
Contributor

bors commented Jan 31, 2022

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 86f5e17 to master...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (86f5e17): comparison url.

Summary: This benchmark run did not return any relevant results.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@matthiaskrgr matthiaskrgr deleted the rollup-k5shwrc branch February 13, 2022 00:53
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 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-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.