| Age | Commit message (Collapse) | Author | Lines |
|
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
|
|
Rollup of 8 pull requests
Successful merges:
- #134655 (Stabilize `hash_extract_if`)
- #135933 (Explain how Vec::with_capacity is faithful)
- #136668 (Stabilize `core::str::from_utf8_mut` as `const`)
- #136775 (Update `String::from_raw_parts` safety requirements)
- #137109 (stabilize extract_if)
- #137349 (Implement `read_buf` for zkVM stdin)
- #137493 (configure.py: don't instruct user to run nonexistent program)
- #137516 (remove some unnecessary rustc_const_unstable)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Rollup of 11 pull requests
Successful merges:
- #136522 (Remove `feature(dyn_compatible_for_dispatch)` from the compiler)
- #137289 (Consolidate and improve error messaging for `CoerceUnsized` and `DispatchFromDyn`)
- #137321 (Correct doc about `temp_dir()` behavior on Android)
- #137417 (rustc_target: Add more RISC-V atomic-related features)
- #137489 (remove `#[rustc_intrinsic_must_be_overridde]`)
- #137530 (DWARF mixed versions with LTO on MIPS)
- #137543 (std: Fix another new symlink test on Windows)
- #137548 (Pass correct `TypingEnv` to `InlineAsmCtxt`)
- #137550 (Don't immediately panic if dropck fails without returning errors)
- #137552 (Update books)
- #137556 (rename simd_shuffle_generic → simd_shuffle_const_generic)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
rename simd_shuffle_generic → simd_shuffle_const_generic
I've been confused by this name one time too often. ;)
r? `@oli-obk`
|
|
Update books
## rust-lang/book
2 commits in d4d2c18cbd20876b2130a546e790446a8444cb32..4a01a9182496f807aaa5f72d93a25ce18bcbe105
2025-02-24 14:48:34 UTC to 2025-02-13 19:29:47 UTC
- Fix typos in chapter 17 (rust-lang/book#4238)
- NoStarch backports (rust-lang/book#4224)
## rust-lang/edition-guide
2 commits in 8dbdda7cae4fa030f09f8f5b63994d4d1dde74b9..daa4b763cd848f986813b5cf8069e1649f7147af
2025-02-22 14:58:51 UTC to 2025-02-21 02:30:17 UTC
- Remove precise capturing features (rust-lang/edition-guide#362)
- use same name as previous example (rust-lang/edition-guide#360)
## rust-lang/nomicon
1 commits in 336f75835a6c0514852cc65aba9a698b699b13c8..8f5c7322b65d079aa5b242eb10d89a98e12471e1
2025-02-19 13:16:47 UTC to 2025-02-19 13:16:47 UTC
- other-reprs: do not make it sound like we are making ABI promises for repr(int) enums (rust-lang/nomicon#461)
## rust-lang/reference
4 commits in 6195dbd70fc6f0980c314b4d23875ac570d8253a..615b4cec60c269cfc105d511c93287620032d5b0
2025-02-18 23:01:53 UTC to 2025-02-13 15:12:49 UTC
- Add rule identifiers to names chapters (rust-lang/reference#1737)
- Switch from AVX to SSE in the example (rust-lang/reference#1735)
- Remove attributes from struct field rest patterns (rust-lang/reference#1736)
- Update reference for target_feature_11. (rust-lang/reference#1720)
|
|
matthewjasper:panic-later-for-missing-dropck-error, r=compiler-errors
Don't immediately panic if dropck fails without returning errors
This span_bug was a little too optimistic. I've decided that matching on the ErrorGuaranteed is a little more sensible than a delay bug that will always be ignored.
closes #137329
r? `@compiler-errors`
|
|
Pass correct `TypingEnv` to `InlineAsmCtxt`
Fixes #137512
r? oli-obk
|
|
std: Fix another new symlink test on Windows
Checking for `got_symlink_permission` first is a standard procedure for such tests.
|
|
DWARF mixed versions with LTO on MIPS
On MIPS the DWARF version is stored in 2 bytes with the `.2byte` assembler directive.
|
|
RalfJung:no-more-rustc_intrinsic_must_be_overridden, r=oli-obk
remove `#[rustc_intrinsic_must_be_overridde]`
In https://github.com/rust-lang/rust/pull/135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it.
r? `@oli-obk`
There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
|
|
rustc_target: Add more RISC-V atomic-related features
This is a continuation of https://github.com/rust-lang/rust/pull/130877 and adds a few target features, including `zacas`, which was experimental in LLVM 19 and marked non-experimental in LLVM 20.
This adds the following target features to unstable riscv_target_feature:
- `za64rs` (Za64rs Extension 1.0): Reservation Set Size of at Most 64 Bytes
([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L227-L228), [available since LLVM 18](https://github.com/llvm/llvm-project/commit/8649328060b4e748502d1d859f9c9c1bd3c2bccc))
- `za128rs` (Za128rs Extension 1.0): Reservation Set Size of at Most 128 Bytes
([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L230-L231), [available since LLVM 18](https://github.com/llvm/llvm-project/commit/8649328060b4e748502d1d859f9c9c1bd3c2bccc))
- IIUC, `za*rs` can be referenced when implementing helpers to reduce contention in synchronization primitives, like [`crossbeam_utils::CachePadded`](https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html). (relevant discussion: https://github.com/riscv/riscv-profiles/issues/79)
- `zacas` (Zacas Extension 1.0): Atomic Compare-And-Swap Instructions (`amocas.{w,d,q}{,.aq,.rl,.aqrl}` and `amocas.{b,h}{,.aq,.rl,.aqrl}` when `zabha` is also enabled)
([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L240-L243), [available as non-experimental since LLVM 20](https://github.com/llvm/llvm-project/commit/614aeda93b2225c6eb42b00ba189ba7ca2585c60))
- This implies `zaamo`.
- This is used to optimize CAS in existing atomics and/or implement 64-bit/128-bit atomics on riscv32/riscv64 (e.g., https://github.com/taiki-e/portable-atomic/pull/173).
- Note that [LLVM does not automatically use this instruction for 64-bit/128-bit atomics on riscv32/riscv64 even if this feature is enabled, because doing it changes the ABI](https://github.com/llvm/llvm-project/blob/876174ffd7533dc220f94721173bb767b659fa7f/llvm/docs/RISCVUsage.rst#riscv-zacas-note). (If the ability to do that is provided by LLVM in the future, it should probably be controlled by another ABI feature similar to `forced-atomics`.)
- `zama16b` (Zama16b Extension 1.0): Atomic 16-byte misaligned loads, stores and AMOs
([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L255-L256), [available since LLVM 19](https://github.com/llvm/llvm-project/commit/b090569685699abe4a8031ad442a0f81e373146b))
- IIUC, unlike AArch64 FEAT_LSE2 which also makes 16-byte aligned ldp ({i,u}128 load) atomic, this extension only affects instructions that already considered atomic if they were naturally aligned. i.e., fld (f64 load) on riscv32 would not be atomic with or without this extension ([relevant QEMU code](https://github.com/qemu/qemu/blob/b69801dd6b1eb4d107f7c2f643adf0a4e3ec9124/target/riscv/insn_trans/trans_rvd.c.inc#L50-L62)).
- `zawrs` (Zawrs Extension 1.0): Wait on Reservation Set (`wrs.nto` and `wrs.sto`)
([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L258), [available as non-experimental since LLVM 17](https://github.com/llvm/llvm-project/commit/d41a73aa94cb8945dcd0f2906992c2fcea6ed001))
- This is used to optimize synchronization primitives (e.g., Linux uses this for spinlocks (https://github.com/torvalds/linux/commit/b8ddb0df30f9f6e70422f1e705b7416da115bd24)).
Btw, the question of whether `zaamo` is implied by `zabha` or not, which was discussed in https://github.com/rust-lang/rust/pull/130877, has been resolved in LLVM 20, since LLVM now treats `zaamo` as implied by `zabha`/`zacas` (https://github.com/llvm/llvm-project/pull/115694), just like GCC and rustc.
r? `@Amanieu`
`@rustbot` label +O-riscv +A-target-feature
|
|
Correct doc about `temp_dir()` behavior on Android
Since commit https://github.com/aosp-mirror/platform_frameworks_base/commit/d5ccb038f69193fb63b5169d7adc5da19859c9d8, `TMPDIR` will be set to application's cache dir when app starts.
|
|
Consolidate and improve error messaging for `CoerceUnsized` and `DispatchFromDyn`
Firstly, this PR consolidates and reworks the error diagnostics for `CoercePointee` and `DispatchFromDyn`. There was a ton of duplication for no reason -- this reworks both the errors and also the error codes, since they can be shared between both traits since they report the same thing.
Secondly, when encountering a struct with multiple fields that must be coerced, point out the field spans, rather than mentioning the fields by name. This makes the error message clearer, but also means that we don't mention the `__S` dummy parameter for `derive(CoercePointee)`.
Thirdly, emit a custom error message when we encounter a trait error that comes from the recursive field `CoerceUnsized`/`DispatchFromDyn` trait check. **Note:** This is the only one I'm not too satisfied with -- I think it could use some more refinement, but ideally it explains that the field must be an unsize-able pointer... Feedback welcome.
Finally, don't emit `DispatchFromDyn` validity errors if we detect `CoerceUnsized` validity errors from an impl of the same ADT.
This is best reviewed per commit.
r? `@oli-obk` perhaps?
cc `@dingxiangfei2009` -- sorry for making my own attempt at this PR, but I wanted to see if I could implement a fix for #136796 in a less complicated way, since communicating over github review comments can be a bit slow. I'll leave comments inline to explain my thinking about the diagnostics changes.
|
|
Remove `feature(dyn_compatible_for_dispatch)` from the compiler
This PR proposes the removal of `feature(dyn_compatible_for_dispatch)` from the compiler.
* As far as I can tell from the tracking issue, there's very little demand for this feature. I think that if this feature becomes useful in the future, then a fresh implementation from a fresh set of eyes, with renewed understanding of how this feature fits into the picture of Rust as it exists **today** would be great to have; however, in the absence of this demand, I don't see a particularly good reason to keep this implementation around.
* The RFC didn't receive very much discussion outside of the lang team, and while the discussion it received seemed to suggest that this feature was aiming to simplify the language and improve expressibility, I don't think this feature has really demonstrated either of those goals in practice. Furthermore, nobody seems to have owned this feature for quite some time or express desire to push for its stabilization.
* Relatedly, I find some of the RFC discussion like "when we make things impossible it's often presumptuous"[^1] and "I tend to want to take a 'we are all adults here' attitude toward unsafe code"[^2] to be particularly uncompelling. Of course this is no criticism to the authors of those comments since they're pretty old comments now, but type soundness is (IMO) the primary goal of the types team. This feature doesn't really do much other than further complicating the story of where we must validate object safety for soundness, along making dyn-incompatible trait object types *almost* seem useful, but very much remain UB to create and misleading to users who don't know better.
* Dyn compatibility's story has gotten more complicated since the feature was proposed in 2017, and now it needs to interact with things like associated consts, GATs, RPITITs, trait upcasting, `dyn*`, etc. While some of this is exercised in the codebase today, I'm not confident all of the corners of this feature have been hammered out. Reducing the "surface area" for what can go wrong in the compiler, especially around a side of the language (`dyn Trait`) that has been known to be particularly unsound in the past, seems good enough motivation to get rid of this for now.
[^1]: https://github.com/rust-lang/rfcs/pull/2027#issuecomment-307592857
[^2]: https://github.com/rust-lang/rfcs/pull/2027#issuecomment-307645838
cc `@rust-lang/types` `@rust-lang/lang`
Tracking:
- #43561
r? types
|
|
remove some unnecessary rustc_const_unstable
If the function is anyway unstable, it doesn't need to be `rustc_const_unstable`.
`copy_from_slice` turns out to not do anything const-unstable itself, we just haven't stably committed to it being available in const yet. See [here](https://rustc-dev-guide.rust-lang.org/stability.html?highlight=rustc_const_stable_indirect) for more details on the `rustc_const_stable_indirect` attribute.
|
|
configure.py: don't instruct user to run nonexistent program
```shell-session
$ ./configure
configure: processing command line
configure:
configure: build.configure-args := []
configure: profile := dist
configure:
configure: writing `config.toml` in current directory
configure:
configure: run `python /mnt/filling/store/nabijaczleweli/code/rust/x.py --help`
```
This is naturally not valid since I don't have a "python" executable (and this will hopefully become more and more true as Python 2 dies out).
./configure knows this since it does `try python3 "$``@"`,`` then `python2.7` &c.
After, this now says
```
configure: run `python3 /mnt/filling/store/nabijaczleweli/code/rust/x.py --help`
```
which is possible, and corresponds to the interpreter actually running.
|
|
Implement `read_buf` for zkVM stdin
For the zkVM, even when a guest buffer is uninitialized, from the host's perspective it is just a normal piece of memory which was initialized before letting the guest write into it. This makes `sys_read` safe to use with an uninitialized buffer. See https://github.com/risc0/risc0/issues/2853.
cc `@bobbobbio,` `@flaub`
r? `@Noratrieb`
Tracked in https://github.com/rust-lang/rust/issues/136756
|
|
stabilize extract_if
Tracking issue: #43244
Closes: #43244
FCP completed: https://github.com/rust-lang/rust/issues/43244#issuecomment-2523595704
|
|
Update `String::from_raw_parts` safety requirements
These have become out of sync with `Vec::from_raw_part`'s safety requirements, and are likely to diverge again. I think it's safest to just point at `Vec`'s requirements.
https://github.com/rust-lang/rust/issues/119206#issuecomment-2180116680
|
|
Stabilize `core::str::from_utf8_mut` as `const`
cc #91006 (tracking issue)
r? libs-api
|
|
Explain how Vec::with_capacity is faithful
This is a revival of https://github.com/rust-lang/rust/pull/99790 building on the prose of `@workingjubilee` and edits of `@jmaargh.` Closes https://github.com/rust-lang/rust/issues/99385.
|
|
Stabilize `hash_extract_if`
FCP complete: https://github.com/rust-lang/rust/issues/59618#issuecomment-2674880530
Tracking issue: #59618
Closes #59618
|
|
New attribute parsing infrastructure
Another step in the plan outlined in https://github.com/rust-lang/rust/issues/131229
introduces infrastructure for structured parsers for attributes, as well as converting a couple of complex attributes to have such structured parsers.
This PR may prove too large to review. I left some of my own comments to guide it a little. Some general notes:
- The first commit is basically standalone. It just preps some mostly unrelated sources for the rest of the PR to work. It might not have enormous merit on its own, but not negative merit either. Could be merged alone, but also doesn't make the review a whole lot easier. (but it's only +274 -209)
- The second commit is the one that introduces new infrastructure. It's the important one to review.
- The 3rd commit uses the new infrastructure showing how some of the more complex attributes can be parsed using it. Theoretically can be split up, though the parsers in this commit are the ones that really test the new infrastructure and show that it all works.
- The 4th commit fixes up rustdoc and clippy. In the previous 2 they didn't compile yet while the compiler does. Separated them out to separate concerns and make the rest more palatable.
- The 5th commit blesses some test outputs. Sometimes that's just because a diagnostic happens slightly earlier than before, which I'd say is acceptable. Sometimes a diagnostic is now only emitted once where it would've been twice before (yay! fixed some bugs). One test I actually moved from crashes to fixed, because it simply doesn't crash anymore. That's why this PR Closes #132391. I think most choices I made here are generally reasonable, but let me know if you disagree anywhere.
- The 6th commit adds a derive to pretty print attributes
- The 7th removes smir apis for attributes, for the time being. The api will at some point be replaced by one based on `rustc_ast_data_structures::AttributeKind`
In general, a lot of the additions here are comments. I've found it very important to document new things in the 2nd commit well so other people can start using it.
Closes #132391
Closes #136717
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Type lowering can give non-fatal errors that dropck then uses to suppress its own errors. Assume this is the cases when we can't find the error in borrowck.
|
|
|
|
macro
|
|
|
|
Subtree update of `rust-analyzer`
r? `@ghost`
|
|
regressions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
note: compiler compiles but librustdoc and clippy don't
|
|
fixup docs in parser
|
|
|
|
On MIPS the DWARF version is stored in 2 bytes with the `.2byte`
assembler directive.
|
|
Rollup of 10 pull requests
Successful merges:
- #136610 (Allow `IndexSlice` to be indexed by ranges.)
- #136991 ([rustdoc] Add new setting to wrap source code lines when too long)
- #137061 (Unstable `gen_future` Feature Tracking )
- #137393 (Stabilize `unbounded_shifts`)
- #137482 (Windows: use existing wrappers in `File::open_native`)
- #137484 (Fix documentation for unstable sort on slice)
- #137491 (Tighten `str-to-string-128690.rs``CHECK{,-NOT}`s to make it less likely to incorrectly fail with symbol name mangling)
- #137495 (Added into_value function to ControlFlow<T, T>)
- #137501 (Move `impl` blocks out of `rustc_middle/src/mir/syntax.rs`)
- #137505 (Add a span to `CompilerBuiltinsCannotCall`)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
|
|
minor: sync from downstream
|
|
|