-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 5 pull requests #128169
Rollup of 5 pull requests #128169
Conversation
``` error: bare CR not allowed in doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 | LL | /// doc comment with bare CR: '␍' | ^ ```
No longer track "zero-width" chars in `SourceMap`, read directly from the line when calculating the `display_col` of a `BytePos`. Move `char_width` to `rustc_span` and use it from the emitter. This change allows the following to properly align in terminals (depending on the font, the replaced control codepoints are rendered as 1 or 2 width, on my terminal they are rendered as 1, on VSCode text they are rendered as 2): ``` error: this file contains an unclosed delimiter --> $DIR/issue-68629.rs:5:17 | LL | ␜␟ts␀![{i | -- unclosed delimiter | | | unclosed delimiter LL | ␀␀ fn rݻoa>rݻm | ^ ```
We already point these out quite aggressively, telling people not to use them, but would normally be rendered as nothing. Having them visible will make it easier for people to actually deal with them. ``` error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:26:22 | LL | println!("{:?}", '�'); | ^-^ | || | |'\u{202e}' | this literal contains an invisible unicode text flow control codepoint | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | LL | println!("{:?}", '\u{202e}'); | ~~~~~~~~ ``` vs the previous ``` error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:26:22 | LL | println!("{:?}", ''); | ^- | || | |'\u{202e}' | this literal contains an invisible unicode text flow control codepoint | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | LL | println!("{:?}", '\u{202e}'); | ~~~~~~~~ ```
We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might": ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate ```
…fmease Reorder trait bound modifiers *after* `for<...>` binder in trait bounds This PR suggests changing the grammar of trait bounds from: ``` [CONSTNESS] [ASYNCNESS] [?] [BINDER] [TRAIT_PATH] const async ? for<'a> Sized ``` to ``` ([BINDER] [CONSTNESS] [ASYNCNESS] | [?]) [TRAIT_PATH] ``` i.e., either ``` ? Sized ``` or ``` for<'a> const async Sized ``` (but not both) ### Why? I think it's strange that the binder applies "more tightly" than the `?` trait polarity. This becomes even weirder when considering that we (or at least, I) want to have `async` trait bounds expressed like: ``` where T: for<'a> async Fn(&'a ()) -> i32, ``` and not: ``` where T: async for<'a> Fn(&'a ()) -> i32, ``` ### Fallout No crates on crater use this syntax, presumably because it's literally useless. This will require modifying the reference grammar, though. ### Alternatives If this is not desirable, then we can alternatively keep parsing `for<'a>` after the `?` but deprecate it with either an FCW (or an immediate hard error), and begin parsing `for<'a>` *before* the `?`.
…i-obk Replace ASCII control chars with Unicode Control Pictures Replace ASCII control chars like `CR` with Unicode Control Pictures like `␍`: ``` error: bare CR not allowed in doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 | LL | /// doc comment with bare CR: '␍' | ^ ``` Centralize the checking of unicode char width for the purposes of CLI display in one place. Account for the new replacements. Remove unneeded tracking of "zero-width" unicode chars, as we calculate these in the `SourceMap` as needed now.
…jieyouxu Migrate `pointer-auth-link-with-c`, `c-dynamic-rlib` and `c-dynamic-dylib` `run-make` tests to rmake Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Please try: try-job: x86_64-msvc try-job: i686-mingw try-job: aarch64-apple
Do not use question as label We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might": ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate ```
Don't ICE when auto trait has assoc ty in old solver Kinda a pointless change to make, but it's observable w/o the feature gate, so let's just fix it. I reintroduced this ICE when I removed the "auto impl" kind from `ImplSource` in rust-lang#112687. Fixes rust-lang#117829 Fixes rust-lang#127746
@bors r+ rollup=never p=5 |
☀️ Test successful - checks-actions |
📌 Perf builds for each rolled up PR:
previous master: e7d66eac5e In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
Finished benchmarking commit (004e155): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults (primary 1.6%, secondary 8.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.
Binary sizeResults (secondary -0.0%)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.
Bootstrap: 771.74s -> 771.005s (-0.10%) |
isn't that PR only for diagnostics? ie indicating that the benchmarks produce warnings, but are not real slowdowns of the compiler? |
Is is possible, although the regression was bad enough that I think a revert and a follow-up investigation of the perf result is mostly warranted. On a related note, it would be good to know the size of the diagnostics outputted by our current benchmarks, it's quite probable that it is excessive. I will try to take a look at it later. |
With all the new lints, and changes to existing ones, it wouldn't be surprising that there are enough that diagnostics changes "impact benchmarks but not performance". That ties to the topic of doing something about this measurement behavior, which was discussed on zulip a while back. |
I'm catching up on this. I am surprised that the benchmarks are affected because in my mental model they were not affected by slowdowns on the diagnostics machinery itself. I can see this been an actual regression on the time it takes to render diagnostics, because now we are unconditionally calculating the character width for underlines, whereas before that was kept in an unconditionally pre-calculated table. The new behavior is more correct, but we'd have to see how/if we can mitigate the regression. I noticed that syn is one of the most significantly impacted, which in my head points at TokenString rendering, maybe. I would love some help actually understanding what actually regressed, because looking at the perf summaries I'm seeing Edit: Is it the case that the syn perf tests are emitting lint warnings to stderr when they get compiled? If that is the case, then I can see where the perf regression might be coming from. They would be representative of the new cost of diagnostic rendering, but it is not representative of the cost of compiling syn as part of a dependency tree (because of the implicit cap-lints we have for dependencies). If so, then I don't think it is reasonable to completely block any regressions on the rendering speed when this change is both a QoL improvement and a correctness fix. After the revert lands I will try to split the change into more granular changes to see where the regression is introduced exactly, but it feels "wrong" to have the same rigor for compile changes in the happy path (code that is "perfect") and for the "unhappy" path (code with diagnostics), particularly because for the latter the unofficial policy is "as long as it doesn't affect the happy path, we're ok with doing more work in the unhappy path". If I can confirm that there's not some "hidden"/unconditional place where |
In the benchmark results, when you click on one there's a graph to help you see if the change could be noise, and a command at the bottom to run a cachegrind diff locally, which helps see where the slowdowns come from. For example for the syn incr-unchanged one, cachegrind shows the following for me:
As you expected: more string searching, slower whitespace normalization, more memory allocations, etc. And since I similarly was confused by the results, yes,
That IMHO makes this not really a regression, nor needing a revert. #128200 gains some perf back, it's still doing more work than prior to #127528 and that is perfectly fine for diagnostics. |
Thanks a lot for the analysis! I agree that especially with #128200, the revert is not needed. |
|
Successful merges:
for<...>
binder in trait bounds #127054 (Reorder trait bound modifiers afterfor<...>
binder in trait bounds)pointer-auth-link-with-c
,c-dynamic-rlib
andc-dynamic-dylib
run-make
tests to rmake #127872 (Migratepointer-auth-link-with-c
,c-dynamic-rlib
andc-dynamic-dylib
run-make
tests to rmake)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup