Commit Graph

268940 Commits

Author SHA1 Message Date
bors
1350eead10 Auto merge of #131887 - jieyouxu:rollup-ftik4ni, r=jieyouxu
Rollup of 9 pull requests

Successful merges:

 - #130136 (Partially stabilize const_pin)
 - #131755 (Regression test for AVR `rjmp` offset)
 - #131774 (Add getentropy for RTEMS)
 - #131802 (Dont ICE when computing coverage of synthetic async closure body)
 - #131809 (Fix predicate signatures in retain_mut docs)
 - #131858 (Remove outdated documentation for `repeat_n`)
 - #131866 (Avoid use imports in `thread_local_inner!`)
 - #131874 (Default to the medium code model on OpenHarmony LoongArch target)
 - #131877 (checktools.sh: add link to issue for more context about disabled Miri tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-18 11:11:43 +00:00
许杰友 Jieyou Xu (Joe)
80a8f7b041
Rollup merge of #131877 - RalfJung:checktools-comment, r=ChrisDenton
checktools.sh: add link to issue for more context about disabled Miri tests

Adds some context for the changes made in https://github.com/rust-lang/rust/pull/130072.
2024-10-18 12:00:54 +01:00
许杰友 Jieyou Xu (Joe)
9a664a0a96
Rollup merge of #131874 - heiher:loong-ohos-medium, r=jieyouxu
Default to the medium code model on OpenHarmony LoongArch target

The context for this is #130266: setting the medium code model for the `loongarch64-linux-ohos` target.

r? ```@jieyouxu```
2024-10-18 12:00:54 +01:00
许杰友 Jieyou Xu (Joe)
af85d5280a
Rollup merge of #131866 - jieyouxu:thread_local, r=jhpratt
Avoid use imports in `thread_local_inner!`

Previously, the use imports in `thread_local_inner!` can shadow user-provided types or type aliases of the names `Storage`, `EagerStorage`, `LocalStorage` and `LocalKey`. This PR fixes that by dropping the use imports and instead refer to the std-internal types via fully qualified paths. A basic test is added to ensure `thread_local!`s with static decls with type names that match the aforementioned std-internal type names can successfully compile.

Fixes #131863.
2024-10-18 12:00:53 +01:00
许杰友 Jieyou Xu (Joe)
64bf99b476
Rollup merge of #131858 - AnthonyMikh:AnthonyMikh/repeat_n-is-not-that-special-anymore, r=jhpratt
Remove outdated documentation for `repeat_n`

After #106943, which made `Take<Repeat<I>>` implement `ExactSizeIterator`, part of documentation about difference from `repeat(x).take(n)` is no longer valid.

````@rustbot```` labels: +A-docs, +A-iterators
2024-10-18 12:00:52 +01:00
许杰友 Jieyou Xu (Joe)
759820e631
Rollup merge of #131809 - collinoc:fix-retain-mut-docs, r=jhpratt
Fix predicate signatures in retain_mut docs

This is my first PR here so let me know if I'm doing anything wrong.

The docs for `retain_mut` in `LinkedList` and `VecDeque` say the predicate takes `&e`, but it should be `&mut e` to match the actual signature. `Vec` [has it documented](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.retain_mut) correctly already.
2024-10-18 12:00:52 +01:00
许杰友 Jieyou Xu (Joe)
aae4730c78
Rollup merge of #131802 - compiler-errors:fnonce-coverage, r=Zalathar
Dont ICE when computing coverage of synthetic async closure body

I'm not totally certain if this is *right*, but at least it doesn't ICE.

The issue is that we end up generating two MIR bodies for each async closure, since the `FnOnce` and `Fn`/`FnMut` implementations have different borrowing behavior of their captured variables. They should ideally both contribute to the coverage, since those MIR bodies are (*to the user*) the same code and should have no behavioral differences.

This PR at least suppresses the ICEs, and then I guess worst case we can fix this the right way later.

r? Zalathar or re-roll

Fixes #131190
2024-10-18 12:00:51 +01:00
许杰友 Jieyou Xu (Joe)
951c0cd6f3
Rollup merge of #131774 - thesummer:rtems-add-getentropy, r=joboet
Add getentropy for RTEMS

RTEMS provides the `getentropy` function.
Use this for providing random data.

This PR enables the `getentropy` function for the RTEMS operating system to get random data.
It is exposed via libc  (see https://github.com/rust-lang/libc/pull/3975).
2024-10-18 12:00:51 +01:00
许杰友 Jieyou Xu (Joe)
ebff167966
Rollup merge of #131755 - jfrimmel:avr-rjmp-offset-regression-test, r=jieyouxu
Regression test for AVR `rjmp` offset

This adds a regression test for #129301 by minimizing the code in the linked issue and putting it into a `#![no_core]`-compatible format, so that it can easily be used within an `rmake`-test. This needs to be a `rmake` test (opposed to a `tests/assembly` one), since the linked issue describes, that the problem only occurs if the code is directly compiled. Note, that `lld` is used instead of `avr-gcc`; see the [comments](https://github.com/rust-lang/rust/pull/131755#issuecomment-2416469675) [below](https://github.com/rust-lang/rust/pull/131755#issuecomment-2417160045).
Closes #129301.

To show, that the test actually catches the wrong behavior, this can be tested with a faulty rustc:
```bash
$ rustup install nightly-2024-08-19
$ rustc +nightly-2024-08-19 -C opt-level=s -C panic=abort --target avr-unknown-gnu-atmega328 -Clinker=build/x86_64-unknown-linux-gnu/ci-llvm/bin/lld -Clink-arg='--entry=main' -o compiled tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs
$ llvm-objdump -d compiled | grep '<main>' -A 6
000110b4 <main>:
   110b4: 81 e0         ldi     r24, 0x1
   110b6: 92 e0         ldi     r25, 0x2
   110b8: 85 b9         out     0x5, r24
   110ba: 95 b9         out     0x5, r25
   110bc: fe cf         rjmp    .-4
```
One can see, that the wrong label offset (`4` instead of `6`) is produced, which would trigger an assertion in the test case.

This would be a good candidate for using the `minicore` proposed in #130693. Since this is not yet merged, there is a FIXME.

r? Patryk27
I think, you are the yet-to-be official target maintainer, hence I'll assign to you.

`@rustbot` label +O-AVR
2024-10-18 12:00:50 +01:00
许杰友 Jieyou Xu (Joe)
dae3076fa2
Rollup merge of #130136 - GKFX:stabilize-const-pin, r=dtolnay
Partially stabilize const_pin

Tracking issue #76654.

Eight of these methods can be made const-stable. The remainder are blocked on #73255.
2024-10-18 12:00:50 +01:00
Michael Goulet
cdbf28af76 Dont ICE when computing coverage of synthetic async closure body 2024-10-18 20:14:02 +11:00
Ralf Jung
4277160f61 checktools.sh: add link to issue for more context about disabled Miri tests 2024-10-18 10:47:33 +02:00
Jan Sommer
e20636a786 Add entropy source for RTEMS 2024-10-18 10:26:59 +02:00
bors
acfdb8dd1f Auto merge of #131362 - Kobzol:ci-free-runners-linux-4c, r=Mark-Simulacrum
CI: use free runners for 4-core Linux jobs

It looks like the [free runners](https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories) already have the same spec as the `4c` custom "large" runner (4 cores, 16 GiB of memory, Ubuntu 20.04).

try-job: arm-android
try-job: armhf-gnu
try-job: dist-aarch64-linux
try-job: dist-android
try-job: dist-arm-linux
try-job: dist-armhf-linux
try-job: dist-armv7-linux
try-job: dist-i586-gnu-i586-i686-musl
try-job: dist-i686-linux
try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
try-job: dist-ohos
try-job: dist-powerpc-linux
try-job: dist-powerpc64-linux
try-job: dist-powerpc64le-linux
try-job: dist-riscv64-linux
try-job: dist-s390x-linux
try-job: dist-various-1
try-job: dist-various-2
try-job: dist-x86_64-freebsd
try-job: dist-x86_64-illumos
try-job: dist-x86_64-netbsd
try-job: mingw-check
try-job: test-various
try-job: x86_64-gnu
try-job: x86_64-gnu-stable
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-debug
try-job: x86_64-gnu-nopt
2024-10-18 08:24:09 +00:00
WANG Rui
275ec06900 Default to the medium code model on OpenHarmony LoongArch target
The context for this is #130266: setting the medium code model for the
'loongarch64-linux-ohos' target.
2024-10-18 14:16:51 +08:00
bors
db8043bb19 Auto merge of #131869 - matthiaskrgr:rollup-xrkz174, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #131654 (Various fixes for Xous)
 - #131743 (rustc_metadata: minor tidying)
 - #131823 (Bump libc to 0.2.161)
 - #131850 (Missing parenthesis)
 - #131857 (Allow dropping dyn principal)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-18 06:03:23 +00:00
Zalathar
554097678a Rename stamp to stamp_file_path 2024-10-18 16:11:15 +11:00
Zalathar
3f8d87beda Rename found_paths to found_path_stems 2024-10-18 16:05:57 +11:00
Zalathar
c4c62a5591 Rename inputs to common_inputs_stamp
The new name makes it clearer that this is a timestamp, and is collected from
input files considered common to all tests.
2024-10-18 16:05:57 +11:00
Zalathar
932e9f01b1 Store test collection context/state in two structs 2024-10-18 16:05:57 +11:00
Matthias Krüger
13b398401f
Rollup merge of #131857 - WaffleLapkin:dyn-drop-principal-3, r=compiler-errors
Allow dropping dyn principal

Revival of #126660, which was a revival of #114679. Fixes #126313.

Allows dropping principal when coercing trait objects, e.g. `dyn Debug + Send` -> `dyn Send`.

cc `@compiler-errors` `@Jules-Bertholet`
r? `@lcnr`
2024-10-18 06:59:07 +02:00
Matthias Krüger
b25d266bef
Rollup merge of #131850 - lexeyOK:master, r=compiler-errors
Missing parenthesis

the line was missing closing parenthesis
2024-10-18 06:59:07 +02:00
Matthias Krüger
4e9901faa9
Rollup merge of #131823 - thesummer:bump-libc-0.2.160, r=workingjubilee
Bump libc to 0.2.161

Bumps libc to the latest release version 0.2.161 which
- includes libc support for the tier 3 RTEMS target
- fixes segfaults on 32-bit FreeBSD targets
- gets musl's `posix_spawn_file_actions_addchdir_np` for some spawn opts
2024-10-18 06:59:06 +02:00
Matthias Krüger
02cc3a6da5
Rollup merge of #131743 - tamird:find_commandline_library-tidy, r=lcnr
rustc_metadata: minor tidying

Cleaned up some code while investigating #131720.

See individual commits.
2024-10-18 06:59:05 +02:00
Matthias Krüger
994bdbb23f
Rollup merge of #131654 - betrusted-io:xous-various-fixes, r=thomcc
Various fixes for Xous

This patchset includes several fixes for Xous that have crept in over the last few months:

* The `adjust_process()` syscall was incorrect
* Warnings have started appearing in `alloc` -- adopt the same approach as wasm, until wasm figures out a workaround
* Dead code warnings have appeared in the networking code. Add `allow(dead_code)` as these structs are used as IPC values
* Add support for `args` and `env`, which have been useful for running tests
* Update `unwinding` to `0.2.3` which fixes the recent regression due to changes in `asm!()` code
2024-10-18 06:59:05 +02:00
Zalathar
21a020881d Consolidate test collection state in one place 2024-10-18 15:46:01 +11:00
Ruihan Li
781bff0499 Never emit vptr for empty/auto traits 2024-10-18 12:34:56 +08:00
许杰友 Jieyou Xu (Joe)
7b2320c3df Avoid shadowing user provided types or type aliases in thread_local!
By using qualified imports, i.e. `$crate::...::LocalKey`.
2024-10-18 10:27:41 +08:00
AnthonyMikh
cdacdae01f
remove outdated documentation for repeat_n
After rust/#106943 the part about `ExactSizeIterator` is no longer valid
2024-10-18 02:47:24 +04:00
Jules Bertholet
c4bce0b8b1 Add more tests 2024-10-18 00:33:50 +02:00
bors
d9c4b8d475 Auto merge of #131572 - cuviper:ub-index_range, r=thomcc
Avoid superfluous UB checks in `IndexRange`

`IndexRange::len` is justified as an overall invariant, and
`take_prefix` and `take_suffix` are justified by local branch
conditions. A few more UB-checked calls remain in cases that are only
supported locally by `debug_assert!`, which won't do anything in
distributed builds, so those UB checks may still be useful.

We generally expect core's `#![rustc_preserve_ub_checks]` to optimize
away in user's release builds, but the mere presence of that extra code
can sometimes inhibit optimization, as seen in #131563.
2024-10-17 22:18:24 +00:00
Jan Sommer
a09c54d4d3 Bump libc to 0.2.161 2024-10-17 23:11:45 +02:00
David Carlier
e569c5c92f
std::unix::stack_overflow::drop_handler addressing todo through libc update 2024-10-17 21:34:51 +01:00
lexx
4ab307f9e8
Missing parenthesis
the line was missing closing parenthesis
2024-10-18 01:04:01 +05:00
bors
3ed6e3cc69 Auto merge of #131848 - matthiaskrgr:rollup-l29a75j, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #129620 (Provide a more convinient way of developing rustc on NixOS)
 - #131805 (rustc_llvm: Fix flattened CLI args)
 - #131818 (Enable XRay instrumentation for LoongArch Linux targets)
 - #131825 (SolverDelegate add assoc type for Infcx)
 - #131833 (Add `must_use` to `CommandExt::exec`)
 - #131835 (Do not run test where it cannot run)
 - #131844 (Add mailmap entry for kobzol)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-17 19:33:39 +00:00
Paul Menage
cf7ff15a0d Abstract the state type for futexes
In the same way that we expose SmallAtomic and SmallPrimitive to allow
Windows to use a value other than an AtomicU32 for its futex state, this
patch switches the primary futex state type from AtomicU32 to
futex::Atomic.  The futex::Atomic type should be usable as an atomic
value with underlying primitive type equal to futex::Primitive.

This allows supporting the futex API on systems where the underlying
kernel futex implementation requires more state than simply an
AtomicU32.

All in-tree futex implementations simply define {Atomic,Primitive}
directly as {AtomicU32,u32}.
2024-10-17 12:21:53 -07:00
Matthias Krüger
c9f3a7de1e
Rollup merge of #131844 - Kobzol:mailmap-kobzol, r=jieyouxu
Add mailmap entry for kobzol

Hopefully I got this right.
2024-10-17 20:47:32 +02:00
Matthias Krüger
e46d52ccda
Rollup merge of #131835 - ferrocene:amanjeev/add-missing-attribute-unwind, r=Noratrieb
Do not run test where it cannot run

This was seen on Ferrocene, where we have a custom test target that does not have unwind support
2024-10-17 20:47:32 +02:00
Matthias Krüger
372e8c11c2
Rollup merge of #131833 - c-ryan747:patch-1, r=Noratrieb
Add `must_use` to `CommandExt::exec`

[CommandExt::exec](https://fburl.com/0qhpo7nu) returns a `std::io::Error` in the case exec fails, but its not currently marked as `must_use` making it easy to accidentally ignore it.

This PR adds the `must_use` attributed here as i think it fits the definition in the guide of [When to add #[must_use]](https://std-dev-guide.rust-lang.org/policy/must-use.html#when-to-add-must_use)
2024-10-17 20:47:31 +02:00
Matthias Krüger
405eb4178e
Rollup merge of #131825 - lcnr:probe-no-more-leak-2, r=compiler-errors
SolverDelegate add assoc type for Infcx

makes writing trait bounds on it a lot nicer going forward.

r? `@compiler-errors`
2024-10-17 20:47:31 +02:00
Matthias Krüger
7dbd92fadd
Rollup merge of #131818 - heiher:loong-instrument-xray, r=jieyouxu
Enable XRay instrumentation for LoongArch Linux targets

Enable XRay instrumentation for `loongarch64-unknown-linux-{gnu, musl, ohos}` targets.
2024-10-17 20:47:30 +02:00
Matthias Krüger
db4cc00ed0
Rollup merge of #131805 - aeubanks:flat, r=durin42
rustc_llvm: Fix flattened CLI args

Fixes string manipulation errors introduced in #130446.
2024-10-17 20:47:30 +02:00
Matthias Krüger
7a7c313312
Rollup merge of #129620 - WaffleLapkin:flake, r=Noratrieb
Provide a more convinient way of developing rustc on NixOS

This PR adds envrc files which, once symlinked as  `.envrc` will activates a dev shell from `src/tools/nix-dev-shell/flake.nix` or `src/tools/nix-dev-shell/shell.nix`.

This is based on
- [Current rustc dev guide recommendation for NixOS](https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=nix#using-nix-shell)
- https://github.com/oxalica/rust-overlay?tab=readme-ov-file#use-in-devshell-for-nix-develop
- [Nora's `x` nix package](26ea68e1a0/custom-pkgs/x)
- https://github.com/rust-lang/rustup/pull/2891
- [Direnv: use flake/nix according to availability](https://discourse.nixos.org/t/direnv-use-flake-nix-according-to-availability/29825)

This is something that I plan to use personally, but I thought it might be worth upstreaming :)

r? Noratrieb
2024-10-17 20:47:29 +02:00
Michael Goulet
e3800a1a04 Allow dropping dyn principal 2024-10-17 20:43:31 +02:00
Jakub Beránek
ab9dd3cf17 Add mailmap entry for kobzol 2024-10-17 19:43:13 +02:00
bors
86bd45979a Auto merge of #130223 - LaihoE:faster_str_replace, r=thomcc
optimize str.replace

Adds a fast path for str.replace for the ascii to ascii case. This allows for autovectorizing the code. Also should this instead be done with specialization? This way we could remove one branch. I think it is the kind of branch that is easy to predict though.

Benchmark for the fast path (replace all "a" with "b" in the rust wikipedia article, using criterion) :
| N        | Speedup | Time New (ns) | Time Old (ns) |
|----------|---------|---------------|---------------|
| 2        | 2.03    | 13.567        | 27.576        |
| 8        | 1.73    | 17.478        | 30.259        |
| 11       | 2.46    | 18.296        | 45.055        |
| 16       | 2.71    | 17.181        | 46.526        |
| 37       | 4.43    | 18.526        | 81.997        |
| 64       | 8.54    | 18.670        | 159.470       |
| 200      | 9.82    | 29.634        | 291.010       |
| 2000     | 24.34   | 81.114        | 1974.300      |
| 20000    | 30.61   | 598.520       | 18318.000     |
| 1000000  | 29.31   | 33458.000     | 980540.000    |
2024-10-17 16:20:02 +00:00
Tamir Duberstein
94a2be998d
rustc_metadata: reduce repetition 2024-10-17 11:13:28 -04:00
WANG Rui
67ed9fac55 Enable XRay instrumentation for LoongArch Linux targets 2024-10-17 22:35:51 +08:00
bors
3a85d3fa78 Auto merge of #131832 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-10-17 13:51:48 +00:00
Amanjeev Sethi
f999ab86e0 Do not run test where it cannot run
This was seen on Ferrocene, where we have a custom test target that does not have unwind support
2024-10-17 09:33:39 -04:00