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 #130732

Merged
merged 21 commits into from
Sep 23, 2024
Merged

Rollup of 10 pull requests #130732

merged 21 commits into from
Sep 23, 2024

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

kornelski and others added 21 commits September 19, 2024 16:25
…st; Rename 'const_char_make_ascii' feature gate to 'const_make_ascii';
This is a redo of (this PR)[rust-lang#104095].

Add test for available_parallelism

Add test for available_parallelism

Add test for

Add test for
…,dtolnay

Add str.as_str() for easy Deref to string slices

Working with `Box<str>` is cumbersome, because in places like `iter.filter()` it can end up being `&Box<str>` or even `&&Box<str>`, and such type doesn't always get auto-dereferenced as expected.

Dereferencing such box to `&str` requires ugly syntax like `&**boxed_str` or `&***boxed_str`, with the exact amount of `*`s.

`Box<str>` is [not easily comparable with other string types](rust-lang#129852) via `PartialEq`. `Box<str>` won't work for lookups in types like `HashSet<String>`, because `Borrow<String>` won't take types like `&Box<str>`. OTOH `set.contains(s.as_str())` works nicely regardless of levels of indirection.

`String` has a simple solution for this: the `as_str()` method, and `Box<str>` should too.
Handle unsized consts with type `str`  in v0 symbol mangling

This PR fixes rust-lang#116303 by handling consts with type `str` in v0 symbol mangling as partial support for unsized consts.

This PR is related to `#![feature(adt_const_params)]` (rust-lang#95174) and `#![feature(unsized_const_params)]` (rust-lang#128028).

r? ``@BoxyUwU``
…, r=dtolnay

Support `char::encode_utf16` in const scenarios.

Relevant tracking issue: rust-lang#130660

The method `char::encode_utf16` should be marked "const" to allow compile-time conversions.

This PR additionally rewrites the `encode_utf16_raw` function for better readability whilst also reducing the amount of unsafe code.

try-job: x86_64-msvc
…ckh726

No longer mark RTN as incomplete

The RFC is accepted and the feature is basically fully implemented. This doesn't mean it's necesarily *ready* for stabiliation; there's probably some diagnostic improvements to be made, and as always, users uncover the most creative bugs.

But marking this feature as incomplete no longer serves any purpose, so let's fix that.
…eporting, r=BoxyUwU

Don't call `ty::Const::normalize` in error reporting

We do this to ensure that trait refs with unevaluated consts have those consts simplified to their evaluated forms. Instead, use `try_normalize_erasing_regions`.

**NOTE:** This has the side-effect of erasing regions from all of our trait refs. If this is too much to review or you think it's too opinionated of a diagnostics change, then I could split out the effective change (i.e. erasing regions from this impl suggestion) into another PR and have someone else review it.
…r=Noratrieb

Mark `u8::make_ascii_uppercase` and `u8::make_ascii_lowercase` as const.

Relevant tracking issue: rust-lang#130698

This PR extends rust-lang#130697 by also marking the `make_ascii_uppercase` and `make_ascii_lowercase` methods in `u8` as const.

The `const_char_make_ascii` feature gate is additionally renamed to `const_make_ascii`.
…esolve-const, r=BoxyUwU

Introduce `structurally_normalize_const`, use it in `rustc_hir_typeck`

Introduces `structurally_normalize_const` to typecking to separate the "eval a const" step from the "try to turn a valtree into a target usize" in HIR typeck, where we may still have infer vars and stuff around.

I also changed `check_expr_repeat` to move a double evaluation of a const into a single one. I'll leave inline comments.

r? ```@BoxyUwU```

I hesitated to really test this on the new solver where it probably matters for unevaluated consts. If you're worried about the side-effects, I'd be happy to craft some more tests 😄
…al, r=BoxyUwU

Replace calls to `ty::Const::{try_}eval` in mir build/pattern analysis

We normalize consts in writeback: rust-lang#130645. This means that consts are gonna be as normalized as they're ever gonna get in MIR building and pattern analysis. Therefore we can just use `try_to_target_usize` rather than calling `eval_target_usize`.

Regarding the `.expect` calls, I'm not totally certain whether they're correct given rigid unevaluated consts. But this PR shouldn't make *more* ICEs occur; we may have to squash these ICEs when mGCE comes around, tho 😺
Add test for `available_parallelism()`

This is a redo of [this PR](rust-lang#104095).

I changed the location of the test as per comments in the original thread. Otherwise the test is practically the same.

try-job: test-various
…is-test, r=BoxyUwU

tests: Remove spuriously failing vec-tryinto-array codegen test

This has failed more than a couple of times now. It costs real time, money, and energy to deal with this, far more than this test is saving us.
@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 Sep 23, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=10

@bors
Copy link
Contributor

bors commented Sep 23, 2024

📌 Commit 693269b has been approved by matthiaskrgr

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 Sep 23, 2024
@bors
Copy link
Contributor

bors commented Sep 23, 2024

⌛ Testing commit 693269b with merge 702987f...

@bors
Copy link
Contributor

bors commented Sep 23, 2024

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 702987f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 23, 2024
@bors bors merged commit 702987f into rust-lang:master Sep 23, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 23, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#129550 Add str.as_str() for easy Deref to string slices 901757dd3df744147197bf60e943c4ae918c20f5 (link)
#130344 Handle unsized consts with type str in v0 symbol mangling 16d0ee72af59eb4c838268d971cca4a0245d12f9 (link)
#130659 Support char::encode_utf16 in const scenarios. 13e4ec1225d171da5c226a944e8a85914c1c6131 (link)
#130705 No longer mark RTN as incomplete 5b3c39dbd7ee9bd80fde110edc776d2fd4204307 (link)
#130712 Don't call ty::Const::normalize in error reporting d7d9d05a7b07264a2d77ed14140c8f65b31c5e37 (link)
#130713 Mark u8::make_ascii_uppercase and `u8::make_ascii_lowerca… 7bab40e405327a2dcdba819298f0db4ac5167c4d (link)
#130714 Introduce structurally_normalize_const, use it in `rustc_… 08253c989f01ea19d26c91722c5b1a89aacb74ae (link)
#130715 Replace calls to ty::Const::{try_}eval in mir build/patte… 4026f2581c09e6cfccfd699e323bd16dc9254841 (link)
#130723 Add test for available_parallelism() ec3e9902c2f551c7939026dcf94c882c84a68602 (link)
#130726 tests: Remove spuriously failing vec-tryinto-array codegen … 387722cae3aa4ad7863dbe1a3646a8edda0f1f1a (link)

previous master: 66b0b29e65

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 (702987f): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

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

Max RSS (memory usage)

Results (primary -0.3%, secondary -1.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.5% [0.4%, 0.5%] 3
Regressions ❌
(secondary)
2.1% [2.1%, 2.1%] 1
Improvements ✅
(primary)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
-2.9% [-4.7%, -1.0%] 2
All ❌✅ (primary) -0.3% [-2.5%, 0.5%] 4

Cycles

Results (primary 0.5%, secondary 9.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.5% [0.5%, 0.6%] 3
Regressions ❌
(secondary)
9.2% [9.2%, 9.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.6%] 3

Binary size

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

Bootstrap: 770.556s -> 768.601s (-0.25%)
Artifact size: 341.54 MiB -> 341.54 MiB (0.00%)

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-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants