about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-09-23Add fast path for ascii to ascii in str::replaceLaiho-2/+63
2024-09-23Auto merge of #129047 - DianQK:early_otherwise_branch_scalar, r=cjgillotbors-85/+422
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-23Auto merge of #130732 - matthiaskrgr:rollup-ke1j314, r=matthiaskrgrbors-800/+522
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-23Rollup merge of #130726 - workingjubilee:put-the-spurs-to-this-test, r=BoxyUwUMatthias Krüger-22/+0
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-23Rollup merge of #130723 - D0liphin:master, r=workingjubileeMatthias Krüger-0/+18
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-23Rollup merge of #130715 - compiler-errors:mir-build-const-eval, r=BoxyUwUMatthias Krüger-7/+17
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-23Rollup merge of #130714 - compiler-errors:try-structurally-resolve-const, ↵Matthias Krüger-39/+122
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-23Rollup merge of #130713 - bjoernager:const-char-make-ascii, r=NoratriebMatthias Krüger-4/+6
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-23Rollup merge of #130712 - compiler-errors:const-eval-error-reporting, r=BoxyUwUMatthias Krüger-179/+178
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-23Rollup merge of #130705 - compiler-errors:rtn-complete, r=jackh726Matthias Krüger-430/+77
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-23Rollup merge of #130659 - bjoernager:const-char-encode-utf16, r=dtolnayMatthias Krüger-25/+36
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-23Rollup merge of #130344 - Jaic1:fix-116306, r=BoxyUwUMatthias Krüger-32/+51
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-23Rollup merge of #129550 - kornelski:boxasstr, r=joshtriplett,dtolnayMatthias Krüger-62/+17
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-23Auto merge of #130724 - compiler-errors:bump, r=Mark-Simulacrumbors-8848/+7616
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-22Fix hard-coded stderr in run-make testMichael Goulet-6/+6
2024-09-22Bless rustdoc-js-std testMichael Goulet-5/+5
2024-09-22tests: Remove spuriously failing vec-tryinto-array codegen testJubilee Young-22/+0
2024-09-22Auto merge of #130680 - saethlin:module-name-to-str, r=jieyouxubors-1/+1
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-22Reformat using the new identifier sorting from rustfmtMichael Goulet-8386/+7154
2024-09-22Use style_edition over versionMichael Goulet-1/+1
2024-09-22Bump stage0Michael Goulet-450/+450
2024-09-22Add test for `available_parallelism()`Oli Iliffe-0/+18
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-22Auto merge of #130710 - GuillaumeGomez:rollup-mfuha68, r=GuillaumeGomezbors-7/+34
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-22Replace calls to Const::eval in mir buildMichael Goulet-7/+17
2024-09-22Don't call try_eval_target_usize in error reportingMichael Goulet-1/+1
2024-09-22Don't call const normalize in error reportingMichael Goulet-178/+177
2024-09-22Mark 'make_ascii_uppercase' and 'make_ascii_lowercase' in 'u8' as const; ↵Gabriel Bjørnager Jensen-4/+6
Rename 'const_char_make_ascii' feature gate to 'const_make_ascii';
2024-09-22Introduce structurally_normalize_const, use it in hir_typeckMichael Goulet-39/+122
2024-09-22Rollup merge of #130702 - clubby789:unstable-book-docs, r=ehussGuillaume Gomez-0/+12
Add some missing unstable book tracking issue links
2024-09-22Rollup merge of #130692 - RalfJung:result-flatten, r=NoratriebGuillaume Gomez-2/+8
make unstable Result::flatten a const fn This method is still unstable (tracked at https://github.com/rust-lang/rust/issues/70142), but there's no reason I can see for it not to be const -- after all, `Option::flatten` is const. So let's make the `Result` one `const` as well, under the same feature gate. Cc https://github.com/rust-lang/rust/issues/70142
2024-09-22Rollup merge of #130690 - RalfJung:interpret-abi-compat-fixme, r=jieyouxuGuillaume Gomez-1/+0
interpret: remove outdated FIXME The rule about `repr(C)` types with compatible fields got removed from the ABI compat docs before they landed, so this FIXME here is no longer correct. (So this is basically a follow-up to https://github.com/rust-lang/rust/pull/130185, doing some more cleanup around deciding not to guarantee ABI compatibility for structurally compatible `repr(C)` types.)
2024-09-22Rollup merge of #130670 - the8472:read-to-end-heuristics, r=ChrisDentonGuillaume Gomez-3/+13
delay uncapping the max_read_size in File::read_to_end In https://github.com/rust-lang/rust/issues/130600#issuecomment-2365136985 I realized that we're likely still passing too-large buffers to the OS, at least once at the end. Previous issues and PRs: * #110650 * #110655 * #118222 r? ChrisDenton
2024-09-22Rollup merge of #130658 - EqualMa:patch-1, r=scottmcmGuillaume Gomez-1/+1
Fix docs of compare_bytes The docs of `compare_bytes`. The return value is positive if <del>`right`</del> `left` is greater
2024-09-22Auto merge of #130709 - RalfJung:miri-sync, r=RalfJungbors-2149/+2200
Miri subtree update r? `@ghost`
2024-09-22Auto merge of #3852 - tiif:rwrefactor, r=RalfJungbors-153/+249
Refactor fd read/write This PR passed the responsibility of reading to user supplied buffer and dest place to each implementation of ``FileDescription::read/write/pread/pwrite``. This is part of #3665.
2024-09-22simplify eventfd handling a bitRalf Jung-49/+30
2024-09-22remove some unnecessary to_ownedRalf Jung-9/+9
2024-09-22read, write: move cast-to-usize logic up and deduplicate itRalf Jung-4/+6
2024-09-22further tweak FileDescription commentsRalf Jung-17/+12
2024-09-22Pass pointer and len to FileDescription::write and change the type of len in ↵tiif-47/+60
read to usize
2024-09-22Use &[u8] instead of Vec<u8> and improve docstiif-13/+25
2024-09-22No longer mark RTN as incompleteMichael Goulet-430/+77
2024-09-22Add some missing tracking issue linksclubby789-0/+12
2024-09-22Auto merge of #130697 - bjoernager:const-char-make-ascii, r=dtolnaybors-2/+4
Mark `char::make_ascii_uppercase` and `char::make_ascii_lowercase` as const. Relevant tracking issue: #130698 The `make_ascii_uppercase` and `make_ascii_lowercase` methods in `char` should be marked "const." With the stabilisation of [`const_mut_refs`](https://github.com/rust-lang/rust/issues/57349/), this simply requires adding the `const` specifier to the function signatures.
2024-09-22Mark 'make_ascii_uppercase' and 'make_ascii_lowercase' in 'char' as const;Gabriel Bjørnager Jensen-2/+4
2024-09-22Auto merge of #3903 - RalfJung:auto-prs, r=RalfJungbors-0/+3
try to give the CI job permission to create PRs See the discussion [here](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/did.20github.20token.20permissions.20change.3F). `@rust-lang/infra` just a heads-up that we are doing this -- I have no idea if this could cause any issues elsewhere, or if it is important that we limit the permissions here somehow, or so.
2024-09-22try to give the CI job permission to create PRsRalf Jung-0/+3
2024-09-22Auto merge of #130689 - RalfJung:rustc_nonnull_optimization_guaranteed, ↵bors-4/+8
r=jieyouxu fix rustc_nonnull_optimization_guaranteed docs As far as I can tell, even back when this was [added](https://github.com/rust-lang/rust/pull/60300) it never *enabled* any optimizations. It just indicates that the FFI compat lint should accept those types for NPO.
2024-09-22fix rustc_nonnull_optimization_guaranteed docsRalf Jung-4/+8
2024-09-22Auto merge of #130688 - workingjubilee:rollup-ovre6p7, r=workingjubileebors-44/+247
Rollup of 5 pull requests Successful merges: - #130648 (move enzyme flags from general cargo to rustc-specific cargo) - #130650 (Fixup Apple target's description strings) - #130664 (Generate line numbers for non-rust code examples as well) - #130665 (Prevent Deduplication of `LongRunningWarn`) - #130669 (tests: Test that `extern "C" fn` ptrs lint on slices) r? `@ghost` `@rustbot` modify labels: rollup