Commit Graph

267034 Commits

Author SHA1 Message Date
Mara Bos
c0c569f99d
Update compiler/rustc_middle/src/hir/map/mod.rs
Co-authored-by: Michael Goulet <michael@errs.io>
2024-09-23 09:36:17 +00:00
bors
fc58c94f3e Auto merge of #18170 - rust-lang:revert-18169-disable-gh-releases, r=lnicola
minor: Revert "internal: Disable GitHub releases for now"

Turns out, this wasn't needed for long.
2024-09-23 08:52:30 +00:00
Laurențiu Nicola
63ff4d609b
Revert "internal: Disable GitHub releases for now" 2024-09-23 11:47:37 +03:00
joboet
3ff09a05c8
update miri test 2024-09-23 10:36:17 +02:00
joboet
e94dd9b712
random: add tracking issue, address other comments 2024-09-23 10:36:16 +02:00
joboet
a21ff017f4
miri: shim CCRandomGenerateBytes 2024-09-23 10:36:16 +02:00
joboet
b9d47cfa9b
std: switch to faster random sources on macOS and most BSDs 2024-09-23 10:36:16 +02:00
joboet
5c1c725724
std: implement the random feature
Implements the ACP https://github.com/rust-lang/libs-team/issues/393.
2024-09-23 10:29:51 +02:00
GnomedDev
6b34c8df2c
Avoid looking regex crate up multiple times 2024-09-23 09:05:33 +01:00
Jakub Beránek
f7735f99cf
Add rustfmt 2024 reformatting to git blame ignore 2024-09-23 10:02:04 +02:00
Urgau
2423e9e244 Update rustdoc doctest non_local_defs impl test 2024-09-23 10:01:59 +02:00
Urgau
9195d65725 Remove with/without trait and bounds consideration 2024-09-23 10:01:59 +02:00
Urgau
0f665e2bf3 Point to every relevant types in the main diag 2024-09-23 10:00:42 +02:00
Urgau
00a6ebfbf5 Rework non_local_definitions lint to only be a syntactic heuristic 2024-09-23 09:59:31 +02:00
GnomedDev
d099ceddad
Split def_path_res into two parts 2024-09-23 08:58:32 +01:00
Luv-Ray
16093faea8 fix ices on vfe about principal trait 2024-09-23 15:25:52 +08:00
Urgau
cb58668748 Revert "Switch back non_local_definitions lint to allow-by-default"
This reverts commit 0c0dfb88ee.
2024-09-23 09:23:04 +02:00
bors
a772336fb3 Auto merge of #129047 - DianQK:early_otherwise_branch_scalar, r=cjgillot
Apply `EarlyOtherwiseBranch` to scalar value

In the future, I'm thinking of hoisting discriminant via GVN so that we only need to write very little code here.

r? `@cjgillot`
2024-09-23 07:22:29 +00:00
bors
e00ba67dfb Auto merge of #18169 - lnicola:disable-gh-releases, r=lnicola
internal: Disable GitHub releases for now

These are currently throwing `Error: HttpError: Resource not accessible by integration` because of the organization change, let's disable them for today's release.
2024-09-23 05:58:48 +00:00
Laurențiu Nicola
a1eb50e527 Disable GitHub releases for now 2024-09-23 08:56:27 +03:00
bors
702987f75b Auto merge of #130732 - matthiaskrgr:rollup-ke1j314, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #129550 (Add str.as_str() for easy Deref to string slices)
 - #130344 (Handle unsized consts with type `str`  in v0 symbol mangling)
 - #130659 (Support `char::encode_utf16` in const scenarios.)
 - #130705 (No longer mark RTN as incomplete)
 - #130712 (Don't call `ty::Const::normalize` in error reporting)
 - #130713 (Mark `u8::make_ascii_uppercase` and `u8::make_ascii_lowercase` as const.)
 - #130714 (Introduce `structurally_normalize_const`, use it in `rustc_hir_typeck`)
 - #130715 (Replace calls to `ty::Const::{try_}eval` in mir build/pattern analysis)
 - #130723 (Add test for `available_parallelism()`)
 - #130726 (tests: Remove spuriously failing vec-tryinto-array codegen test)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-23 04:56:10 +00:00
Matthias Krüger
693269b2be
Rollup merge of #130726 - workingjubilee:put-the-spurs-to-this-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.
2024-09-23 06:45:37 +02:00
Matthias Krüger
004213b77d
Rollup merge of #130723 - D0liphin:master, r=workingjubilee
Add test for `available_parallelism()`

This is a redo of [this PR](https://github.com/rust-lang/rust/pull/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
2024-09-23 06:45:37 +02:00
Matthias Krüger
0e08d7002b
Rollup merge of #130715 - compiler-errors:mir-build-const-eval, r=BoxyUwU
Replace calls to `ty::Const::{try_}eval` in mir build/pattern analysis

We normalize consts in writeback: #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 😺
2024-09-23 06:45:36 +02:00
Matthias Krüger
2bca5c4fc1
Rollup merge of #130714 - compiler-errors:try-structurally-resolve-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 😄
2024-09-23 06:45:36 +02:00
Matthias Krüger
8bb69b1861
Rollup merge of #130713 - bjoernager:const-char-make-ascii, r=Noratrieb
Mark `u8::make_ascii_uppercase` and `u8::make_ascii_lowercase` as const.

Relevant tracking issue: #130698

This PR extends #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`.
2024-09-23 06:45:35 +02:00
Matthias Krüger
82060368e6
Rollup merge of #130712 - compiler-errors:const-eval-error-reporting, 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.
2024-09-23 06:45:34 +02:00
Matthias Krüger
9f5cbfb455
Rollup merge of #130705 - compiler-errors:rtn-complete, r=jackh726
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.
2024-09-23 06:45:34 +02:00
Matthias Krüger
c1ccdb7d0c
Rollup merge of #130659 - bjoernager:const-char-encode-utf16, r=dtolnay
Support `char::encode_utf16` in const scenarios.

Relevant tracking issue: #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
2024-09-23 06:45:33 +02:00
Matthias Krüger
23393de793
Rollup merge of #130344 - Jaic1:fix-116306, r=BoxyUwU
Handle unsized consts with type `str`  in v0 symbol mangling

This PR fixes #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)]` (#95174) and `#![feature(unsized_const_params)]` (#128028).

r? ``@BoxyUwU``
2024-09-23 06:45:33 +02:00
Matthias Krüger
510fc3432e
Rollup merge of #129550 - kornelski:boxasstr, r=joshtriplett,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](https://github.com/rust-lang/rust/pull/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.
2024-09-23 06:45:32 +02:00
bors
66b0b29e65 Auto merge of #130724 - compiler-errors:bump, r=Mark-Simulacrum
Bump stage0 to beta-2024-09-22 and rustfmt to nightly-2024-09-22

I'm doing this to apply the changes to version sorting (https://github.com/rust-lang/rustfmt/pull/6284) that have occurred since rustfmt last upgraded (and a few other miscellaneous changes, like changes to expression overflowing: https://github.com/rust-lang/rustfmt/pull/6260). Eagerly updating rustfmt and formatting-the-world will ideally move some of the pressure off of the beta bump which will happen at the beginning of the next release cycle.

You can verify this is correct by checking out the changes, reverting the last commit, reapplying them, and diffing the changes:

```
git fetch git@github.com:compiler-errors/rust.git bump
git checkout -b bump FETCH_HEAD
git reset --hard HEAD~5
./x.py fmt --all
git diff FETCH_HEAD
# ignore the changes to stage0, and rustfmt.toml,
# and test file changes in rustdoc-js-std, run-make.
```

Or just take my word for it? Up to the reviewer.

r? release
2024-09-23 02:02:22 +00:00
Michael Goulet
9132770c8f Fix hard-coded stderr in run-make test 2024-09-22 21:56:38 -04:00
Michael Goulet
3be34a8b53 Bless rustdoc-js-std test 2024-09-22 20:35:10 -04:00
Jubilee Young
ff3a9f4e2a tests: Remove spuriously failing vec-tryinto-array codegen test 2024-09-22 16:46:10 -07:00
Nicholas Nethercote
73cc575177 Fix break_last_token.
It currently doesn't handle the three-char tokens `>>=` and `<<=`
correctly. These can be broken twice, resulting in three individual
tokens. This is a latent bug that currently doesn't cause any problems,
but does cause problems for #124141, because that PR increases the usage
of lazy token streams.
2024-09-23 09:14:30 +10:00
bors
d14c1c75ab Auto merge of #130680 - saethlin:module-name-to-str, r=jieyouxu
Call module_name_to_str instead of just unwrapping

This makes the ICE message in https://github.com/rust-lang/rust/issues/130678 more clear. It looks like not calling this function was just an oversight in https://github.com/rust-lang/rust/pull/76859, but clearly not a major one because it's taken us 4 years to notice.

try-job: i686-msvc
2024-09-22 23:14:12 +00:00
Michael Goulet
02b0f3b5ab Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
Michael Goulet
c682aa162b Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
Michael Goulet
1173204b36 Use style_edition over version 2024-09-22 19:11:28 -04:00
Michael Goulet
624bc65665 Bump stage0 2024-09-22 19:04:19 -04:00
Chayim Refael Friedman
b14cd717dc Fix a bug in span map merge, and add explanations of how span maps are stored
Because it took me hours to figure out that contrary to common sense, the offset stored is the *end* of the node, and we search by the *start*. Which is why we need a convoluted `partition_point()` instead of a simple `binary_search()`. And this was not documented at all. Which made me make mistakes with my implementation of `SpanMap::merge()`.

The other bug fixed about span map merging is correctly keeping track of the current offset in presence of multiple sibling macro invocations. Unrelated, but because of the previous issue it took me hours to debug, so I figured out I'll put them together for posterity.
2024-09-23 01:54:40 +03:00
Oli Iliffe
e9b0bc9432 Add test for available_parallelism()
This is a redo of (this PR)[https://github.com/rust-lang/rust/pull/104095].

Add test for available_parallelism

Add test for available_parallelism

Add test for

Add test for
2024-09-22 23:46:08 +01:00
Pavel Grigorenko
8d2809957e Add more test cases for block-no-opening-brace 2024-09-22 23:29:25 +03:00
bors
6c6d210089 Auto merge of #130710 - GuillaumeGomez:rollup-mfuha68, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #130658 (Fix docs of compare_bytes)
 - #130670 (delay uncapping the max_read_size in File::read_to_end)
 - #130690 (interpret: remove outdated FIXME)
 - #130692 (make unstable Result::flatten a const fn)
 - #130702 (Add some missing unstable book tracking issue links)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-22 19:41:01 +00:00
Samuel Tardieu
acff511871 Lint comparison to empty slice using PartialEq methods 2024-09-22 21:29:32 +02:00
Samuel Tardieu
cc2f447f07 Check that #[deny(allow_attributes)] do not issue spurious messages 2024-09-22 21:10:16 +02:00
bors
43e3384581 Auto merge of #13440 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-09-22 18:59:34 +00:00
Philipp Krones
009134d079
Bump nightly version -> 2024-09-22 2024-09-22 20:52:58 +02:00
Philipp Krones
3ab1da8bab
Formatting 2024-09-22 20:52:15 +02:00