y21
c7390279ca
add comment and .clone() test case
2025-03-30 14:04:56 +02:00
bors
45b40a7596
Auto merge of #139130 - Kobzol:revert-129827, r=petrochenkov
...
Revert "Auto merge of #129827 - bvanjoi:less-decoding, r=petrochenkov"
Reverting https://github.com/rust-lang/rust/pull/129827 because of a performance regression.
This reverts commit d4812c8638 , reversing changes made to 5cc60728e7 .
r? `@petrochenkov`
2025-03-30 11:41:40 +00:00
y21
d5d2189c71
rename lint to char_indices_as_byte_indices
2025-03-30 13:40:03 +02:00
y21
32cf88450b
add a note for str::bytes
2025-03-30 13:39:01 +02:00
y21
fb32aaf9ac
new lint: chars_enumerate_for_byte_indices
2025-03-30 13:39:01 +02:00
许杰友 Jieyou Xu (Joe)
a27ec8521d
Merge pull request #2310 from rust-lang/add-rustfmt-file
...
add rustfmt settings file
2025-03-30 19:36:25 +08:00
Urgau
a20d2ef0d9
Improve explicitness of the impl of the useless_ptr_null_checks lint
2025-03-30 12:14:02 +02:00
Urgau
db576c1360
Expose peel_casts method as an util method inside rustc_lint
2025-03-30 12:14:02 +02:00
Mara Bos
d035ca7db3
Improve hir_pretty for struct expressions.
...
Before:
let a =
StructWithSomeFields{
field_1: 1,
field_2: 2,
field_3: 3,
field_4: 4,
field_5: 5,
field_6: 6,};
let a = StructWithSomeFields{ field_1: 1, field_2: 2, ..a};
After:
let a =
StructWithSomeFields {
field_1: 1,
field_2: 2,
field_3: 3,
field_4: 4,
field_5: 5,
field_6: 6 };
let a = StructWithSomeFields { field_1: 1, field_2: 2, ..a };
2025-03-30 11:21:51 +02:00
Jakub Beránek
31face9f60
Revert "Auto merge of #129827 - bvanjoi:less-decoding, r=petrochenkov"
...
Reverting because of a performance regression.
This reverts commit d4812c8638 , reversing
changes made to 5cc60728e7 .
2025-03-30 11:14:33 +02:00
Mara Bos
cc5ee70b1a
Simplify expansion for format_args!().
...
Instead of calling new(), we can just use a struct expression directly.
Before:
Placeholder::new(…, …, …, …)
After:
Placeholder {
position: …,
flags: …,
width: …,
precision: …,
}
2025-03-30 10:42:00 +02:00
bors
b9ea82b84a
Auto merge of #137836 - madsmtm:openwrt-target-vendor, r=jieyouxu
...
Set `target_vendor = "openwrt"` on `mips64-openwrt-linux-musl`
OpenWRT is a Linux distribution for embedded network devices. The target name contains `openwrt`, so we should set `cfg(target_vendor = "openwrt")`.
This is similar to what other Linux distributions do (the only one in-tree is `x86_64-unikraft-linux-musl`, but that sets `target_vendor = "unikraft"`).
Motivation: To make correctly [parsing target names](https://github.com/rust-lang/cc-rs/pull/1413 ) simpler.
Fixes https://github.com/rust-lang/rust/issues/131165 .
CC target maintainer `@Itus-Shield`
2025-03-30 08:33:29 +00:00
Michael Goulet
18c787f48f
Fix up partial res of segment in primitive resolution hack
2025-03-30 04:22:14 +00:00
Michael Goulet
4f2baaa9c6
Do not mix normalized and unnormalized caller bounds when constructing param-env for receiver_is_dispatchable
2025-03-30 02:39:19 +00:00
bors
85f518ec8e
Auto merge of #138742 - taiki-e:riscv-vector, r=Amanieu
...
rustc_target: Add more RISC-V vector-related features and use zvl*b target features in vector ABI check
Currently, we have only unstable `v` target feature, but RISC-V have more vector-related extensions. The first commit of this PR adds them to unstable `riscv_target_feature`.
- `unaligned-vector-mem`: Has reasonably performant unaligned vector
- [LLVM definition](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L1379 )
- Similar to currently unstable `unaligned-scalar-mem` target feature, but for vector instructions.
- `zvfh`: Vector Extension for Half-Precision Floating-Point
- [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/v-st-ext.adoc#zvfh-vector-extension-for-half-precision-floating-point )
- [LLVM definition](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L668 )
- This implies `zvfhmin` and `zfhmin`
- `zvfhmin`: Vector Extension for Minimal Half-Precision Floating-Point
- [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/v-st-ext.adoc#zvfhmin-vector-extension-for-minimal-half-precision-floating-point )
- [LLVM definition](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L662 )
- This implies `zve32f`
- `zve32x`, `zve32f`, `zve64x`, `zve64f`, `zve64d`: Vector Extensions for Embedded Processors
- [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/v-st-ext.adoc#zve-vector-extensions-for-embedded-processors )
- [LLVM definitions](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L612-L641 )
- `zve32x` implies `zvl32b`
- `zve32f` implies `zve32x` and `f`
- `zve64x` implies `zve32x` and `zvl64b`
- `zve64f` implies `zve32f` and `zve64x`
- `zve64d` implies `zve64f` and `d`
- `v` implies `zve64d`
- `zvl*b`: Minimum Vector Length Standard Extensions
- [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/v-st-ext.adoc#zvl-minimum-vector-length-standard-extensions )
- [LLVM definitions](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L600-L610 )
- `zvl{N}b` implies `zvl{N>>1}b`
- `v` implies `zvl128b`
- Vector Cryptography and Bit-manipulation Extensions
- [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/vector-crypto.adoc )
- [LLVM definitions](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L679-L807 )
- `zvkb`: Vector Bit-manipulation used in Cryptography
- This implies `zve32x`
- `zvbb`: Vector basic bit-manipulation instructions
- This implies `zvkb`
- `zvbc`: Vector Carryless Multiplication
- This implies `zve64x`
- `zvkg`: Vector GCM instructions for Cryptography
- This implies `zve32x`
- `zvkned`: Vector AES Encryption & Decryption (Single Round)
- This implies `zve32x`
- `zvknha`: Vector SHA-2 (SHA-256 only))
- This implies `zve32x`
- `zvknhb`: Vector SHA-2 (SHA-256 and SHA-512)
- This implies `zve64x`
- This is superset of `zvknha`, but doesn't imply that feature at least in LLVM
- `zvksed`: SM4 Block Cipher Instructions
- This implies `zve32x`
- `zvksh`: SM3 Hash Function Instructions
- This implies `zve32x`
- `zvkt`: Vector Data-Independent Execution Latency
- Similar to already stabilized scalar cryptography extension `zkt`.
- `zvkn`: Shorthand for 'Zvkned', 'Zvknhb', 'Zvkb', and 'Zvkt'
- Similar to already stabilized scalar cryptography extension `zkn`.
- `zvknc`: Shorthand for 'Zvkn' and 'Zvbc'
- `zvkng`: shorthand for 'Zvkn' and 'Zvkg'
- `zvks`: shorthand for 'Zvksed', 'Zvksh', 'Zvkb', and 'Zvkt'
- Similar to already stabilized scalar cryptography extension `zks`.
- `zvksc`: shorthand for 'Zvks' and 'Zvbc'
- `zvksg`: shorthand for 'Zvks' and 'Zvkg'
Also, our vector ABI check wants `zvl*b` target features, the second commit of this PR updates vector ABI check to use them.
4e2b096ed6/compiler/rustc_target/src/target_features.rs (L707-L708)
---
r? `@Amanieu`
`@rustbot` label +O-riscv +A-target-feature
2025-03-30 02:21:56 +00:00
y21
8f3a0db64f
don't hardcode repository owner in changelog CI
2025-03-30 00:51:13 +01:00
jyn
41fdd280ff
rustc_resolve: Test the order that preludes are resolved
2025-03-29 19:18:39 -04:00
bors
2196affd01
Auto merge of #139119 - matthiaskrgr:rollup-7l2ri0f, r=matthiaskrgr
...
Rollup of 7 pull requests
Successful merges:
- #137928 (stabilize const_cell)
- #138431 (Fix `uclibc` LLVM target triples)
- #138832 (Start using `with_native_path` in `std::sys::fs`)
- #139081 (std: deduplicate `errno` accesses)
- #139100 (compiletest: Support matching diagnostics on lines below)
- #139105 (`BackendRepr::is_signed`: comment why this may panics)
- #139106 (Mark .pp files as Rust)
r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-29 23:12:40 +00:00
Vadim Petrochenkov
2dfd2a2a24
Remove attribute #[rustc_error]
2025-03-30 01:32:21 +03:00
Tshepang Mbambo
9302f4d94f
add rustfmt settings file
2025-03-30 00:31:44 +02:00
Tshepang Mbambo
69f51ea190
Merge pull request #2309 from rust-lang/restore-static
...
example assumes a static exists
2025-03-30 00:18:06 +02:00
Tshepang Mbambo
471a2a8b87
example assumes a static exists
...
This was removed, likely by mistake, during a refactor.
2025-03-30 00:16:39 +02:00
Tshepang Mbambo
904fedf65e
Merge pull request #2308 from rust-lang/update-examples
...
update rustc-{driver,interface} examples
2025-03-29 23:53:51 +02:00
Tshepang Mbambo
1faf7ff9a4
update rustc-{driver,interface} examples
2025-03-29 23:52:57 +02:00
Tshepang Mbambo
9448b79201
Merge pull request #2289 from y1lan/fix_compiler_err_of_examples
...
Fix compile errors of all the examples
2025-03-29 23:10:13 +02:00
Matthias Krüger
ed1f776e5c
Rollup merge of #139106 - ShE3py:pp-highlighting, r=compiler-errors
...
Mark .pp files as Rust
Pretty-printing tests generate `.pp` files, but GitHub classify and highlight them as Pascal:
[https://github.com/search?q=repo:rust-lang/rust+path:*.pp&type=code ](https://github.com/search?q=repo%3Arust-lang%2Frust+path%3A*.pp&type=code )
``@rustbot`` label +A-meta +A-testsuite
2025-03-29 21:08:14 +01:00
Matthias Krüger
713c58e37d
Rollup merge of #139105 - ShE3py:BackendRepr-is_signed, r=compiler-errors
...
`BackendRepr::is_signed`: comment why this may panics
Was wondering why this method could panics while the others couldn't, so quote PR #70189 .
2025-03-29 21:08:14 +01:00
Matthias Krüger
a584cc7c70
Rollup merge of #139100 - petrochenkov:errbelow, r=jieyouxu
...
compiletest: Support matching diagnostics on lines below
Using `//~vvv ERROR`.
This is not needed often, but it's easy to support, and it allows to eliminate a class of `error-pattern`s that cannot be eliminated in any other way.
See the diff for the examples of such patterns coming from parser.
Some of them can be matched by `//~ ERROR` or `//~^ ERROR` as well (when the final newline is allowed), but it changes the shape of reported spans, so I chose to keep the spans by using `//~v ERROR`.
2025-03-29 21:08:13 +01:00
Matthias Krüger
821e0fe0a2
Rollup merge of #139081 - joboet:errno_dedup, r=Noratrieb
...
std: deduplicate `errno` accesses
By marking `__errno_location` as `#[ffi_const]` and `std::sys::os::errno` as `#[inline]`, this PR allows merging multiple calls to `io::Error::last_os_error()` into one.
2025-03-29 21:08:12 +01:00
Matthias Krüger
fb6d10e13b
Rollup merge of #138832 - ChrisDenton:with_native_path, r=joboet
...
Start using `with_native_path` in `std::sys::fs`
Ideally, each platform should use their own native path type internally. This will, for example, allow passing a `CStr` directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated C string.
However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this PR does some minimal refactoring which should help progress towards that goal. The changes are Unix-only and even then I avoided functions that require more changes so that this PR is just moving things around.
r? joboet
2025-03-29 21:08:12 +01:00
Matthias Krüger
2b0c2f7904
Rollup merge of #138431 - madsmtm:uclibc-llvm-target, r=jieyouxu
...
Fix `uclibc` LLVM target triples
`uclibc` is not an environment understood by LLVM, it is only a concept in Clang that can be selected with `-muclibc` (it affects which dynamic linker is passed to the static linker's `-dynamic-linker` flag).
In fact, using `uclibcgnueabi`/`uclibc` is actively harmful, as it prevents LLVM from seeing that the target is gnu-like; we should use `gnueabi`/`gnu` directly instead.
Motivation: To make it easier to verify that [`cc-rs`' conversion from `rustc` to Clang/LLVM triples](https://github.com/rust-lang/cc-rs/issues/1431 ) is correct.
**There are no target maintainers for these targets.** So I'll CC ``@lancethepants`` and ``@skrap`` who maintain the related `armv7-unknown-linux-uclibceabi` and `armv7-unknown-linux-uclibceabihf` (both of which already pass `-gnu` instead of `-uclibc`) in case they have any insights.
r? jieyouxu
2025-03-29 21:08:11 +01:00
Matthias Krüger
7ef7034caf
Rollup merge of #137928 - RalfJung:const_cell, r=m-ou-se
...
stabilize const_cell
``@rust-lang/libs-api`` ``@rust-lang/wg-const-eval`` I see no reason to wait any longer, so I propose we stabilize the use of `Cell` in `const fn` -- specifically the APIs listed here:
```rust
// core::cell
impl<T> Cell<T> {
pub const fn replace(&self, val: T) -> T;
}
impl<T: Copy> Cell<T> {
pub const fn get(&self) -> T;
}
impl<T: ?Sized> Cell<T> {
pub const fn get_mut(&mut self) -> &mut T;
pub const fn from_mut(t: &mut T) -> &Cell<T>;
}
impl<T> Cell<[T]> {
pub const fn as_slice_of_cells(&self) -> &[Cell<T>];
}
```
Unfortunately, `set` cannot be made `const fn` yet as it drops the old contents.
Fixes https://github.com/rust-lang/rust/issues/131283
2025-03-29 21:08:10 +01:00
bors
1799887bb2
Auto merge of #133572 - frank-king:feature/unique_arc, r=Amanieu
...
Implement `alloc::sync::UniqueArc`
This implements the `alloc::sync::UniqueArc` part of #112566 .
2025-03-29 20:05:06 +00:00
许杰友 Jieyou Xu (Joe)
70cbe19fe0
Merge pull request #2288 from rust-lang/tshepang-known-bug-takes-args
...
mention that known-bug test directive takes arguments
2025-03-30 02:31:33 +08:00
Tshepang Mbambo
865a5a7e16
mention that know-bug test directive takes arguments
2025-03-29 20:02:01 +02:00
y21
ffaecd008d
manually fulfill lint expectations for all unsafe blocks with metavars
2025-03-29 17:55:30 +01:00
bors
d4812c8638
Auto merge of #129827 - bvanjoi:less-decoding, r=petrochenkov
...
perform less decoding if it has the same syntax context
Following this [comment](https://github.com/rust-lang/rust/pull/127279#issuecomment-2210376603 )
r? `@petrochenkov`
2025-03-29 16:50:04 +00:00
Maja Kądziołka
02899f86f5
Properly document FakeReads
2025-03-29 17:27:33 +01:00
Chris Denton
89c9c21b06
Start using with_native_path in std::sys::fs
2025-03-29 14:43:41 +00:00
Laurențiu Nicola
a2083a54e5
Merge pull request #19475 from inflation/push-xrwpqzsqxtuy
...
Fix debug sourceFileMap when using cppvsdbg
2025-03-29 13:48:59 +00:00
bors
5cc60728e7
Auto merge of #139101 - matthiaskrgr:rollup-zhu7hf6, r=matthiaskrgr
...
Rollup of 7 pull requests
Successful merges:
- #138692 (Reject `{true,false}` as revision names)
- #138757 (wasm: increase default thread stack size to 1 MB)
- #138988 (Change the syntax of the internal `weak!` macro)
- #139056 (use `try_fold` instead of `fold`)
- #139057 (use `slice::contains` where applicable)
- #139086 (Various cleanup in ExprUseVisitor)
- #139097 (Add more tests for pin!().)
r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-29 13:41:27 +00:00
Inflation
814d7c37d4
Fix debug sourceFileMap when using cppvsdbg
...
- Fix #18782
2025-03-29 21:32:51 +08:00
Timo
4c610e32ad
fix: unnested_or_patterns suggests wrongly in let ( #14401 )
...
Closes #9952
changelog: [`unnested_or_patterns`] fix wrong suggestion in `let`
2025-03-29 13:04:15 +00:00
yanglsh
2df6bba5b0
fix: unnested_or_patterns suggests wrongly in let
2025-03-29 20:52:59 +08:00
dswij
bc28421a7a
Take advantage of match ergonomics in clippy_utils::hir_utils ( #14499 )
...
This is a style-only change in order to use match ergonomics by removing
unneeded `&` and `ref`.
changelog: none
2025-03-29 12:20:23 +00:00
joboet
3a4dd1b7b2
std: make cmath functions safe
2025-03-29 13:08:18 +01:00
Lieselotte
daeb449640
Mark .pp files as Rust
2025-03-29 12:39:06 +01:00
Lieselotte
439048e074
BackendRepr::is_signed: comment why this may panics
2025-03-29 12:21:51 +01:00
Samuel Tardieu
bc701925d8
Take advantage of match ergonomics in clippy_utils::hir_utils
...
This is a style-only change in order to use match ergonomics by removing
unneeded `&` and `ref`.
2025-03-29 12:04:23 +01:00
Matthias Krüger
8b7088ab5f
Rollup merge of #139097 - m-ou-se:pin-tests, r=WaffleLapkin
...
Add more tests for pin!().
This adds the tests suggested by `@danielhenrymantilla` in this comment: https://github.com/rust-lang/rust/pull/138717#discussion_r2005433640 by
2025-03-29 11:43:49 +01:00