Commit Graph

264476 Commits

Author SHA1 Message Date
bors 695a4f918a Auto merge of #3832 - RalfJung:epoll-test, r=oli-obk
epoll test: avoid some subtly dangling pointers

Turns out `let data = MaybeUninit::<u64>::uninit().as_ptr();` is a dangling pointer, the memory gets freed at the end of that line. For these cases we don't care as we don't actually access the pointer, but let's not do such subtle things.
2024-08-22 08:54:26 +00:00
bors 8269be147b Auto merge of #129398 - matthiaskrgr:rollup-50l01ry, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #128432 (WASI: forbid `unsafe_op_in_unsafe_fn` for `std::{os, sys}`)
 - #129373 (Add missing module flags for CFI and KCFI sanitizers)
 - #129374 (Use `assert_unsafe_precondition!` in `AsciiChar::digit_unchecked`)
 - #129376 (Change `assert_unsafe_precondition` docs to refer to `check_language_ub`)
 - #129382 (Add `const_cell_into_inner` to `OnceCell`)
 - #129387 (Advise against removing the remaining Python scripts from `tests/run-make`)
 - #129388 (Do not rely on names to find lifetimes.)
 - #129395 (Pretty-print own args of existential projections (dyn-Trait w/ GAT constraints))

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-22 08:20:49 +00:00
apiraino 87e4b6789c
Update RELEASES.md
Co-authored-by: Josh Stone <cuviper@gmail.com>
2024-08-22 09:19:22 +02:00
Amjad Alsharafi 57b164a9d2
Update `compiler_builtins` to `0.1.120`
Signed-off-by: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com>
2024-08-22 14:26:31 +08:00
Ralf Jung ebfa3e3f62 stabilize const_fn_floating_point_arithmetic 2024-08-22 08:25:54 +02:00
Matthias Krüger 9d39b59862
Rollup merge of #129395 - fmease:pp-dyn-w-gat, r=compiler-errors
Pretty-print own args of existential projections (dyn-Trait w/ GAT constraints)

Previously we would just drop them. This bug isn't that significant as it can only be triggered by user code that constrains GATs inside trait object types which is currently gated under the interim feature `generic_associated_types_extended` (whose future is questionable) or on stable if the GATs are 'disabled' in dyn-Trait via `where Self: Sized` (in which case the assoc type bindings get ignored anyway (and trigger the warn-by-default lint `unused_associated_type_bounds`)), so yeah.

Affects diagnostic output and output of `std::any::type_name{_of_val}`.
2024-08-22 08:17:23 +02:00
Matthias Krüger 8b3ca7918c
Rollup merge of #129388 - cjgillot:region-def-id, r=compiler-errors
Do not rely on names to find lifetimes.

For some reason, we were trying to find the lifetime parameter from its name, instead of using the def_id we have.

This PR uses it instead. This changes some ui tests, I think to be more sensible.
2024-08-22 08:17:23 +02:00
Matthias Krüger d24e6b7e61
Rollup merge of #129387 - Zalathar:python-apologia, r=jieyouxu
Advise against removing the remaining Python scripts from `tests/run-make`

After some recent PRs (e.g. #129185), there are only two Python scripts left in `tests/run-make`.

Having come so far, it's tempting to try to get rid of the remaining ones. But after trying that myself, I've come to the conclusion that it's not worth the extra hassle, especially if it means pulling in an XML-parsing crate just for one test.

This PR therefore leaves behind a few signpost comments to explain why getting rid of these particular scripts has low value.
2024-08-22 08:17:22 +02:00
Matthias Krüger 28d4b8248e
Rollup merge of #129382 - tgross35:once-cell-const-into-inner, r=Noratrieb
Add `const_cell_into_inner` to `OnceCell`

`Cell` and `RefCell` have their `into_inner` methods const unstable. `OnceCell` has the same logic, so add it under the same gate.

Tracking issue: https://github.com/rust-lang/rust/issues/78729
2024-08-22 08:17:22 +02:00
Matthias Krüger ae58bbfbce
Rollup merge of #129376 - ChaiTRex:assert_unsafe_precondition_check_language_ub, r=workingjubilee,the8472
Change `assert_unsafe_precondition` docs to refer to `check_language_ub`
2024-08-22 08:17:21 +02:00
Matthias Krüger e7df7ba1e4
Rollup merge of #129374 - ChaiTRex:digit_unchecked_assert_unsafe_precondition, r=scottmcm
Use `assert_unsafe_precondition!` in `AsciiChar::digit_unchecked`
2024-08-22 08:17:20 +02:00
Matthias Krüger 8f2c4d18e1
Rollup merge of #129373 - samitolvanen:cfi-module-flags, r=compiler-errors
Add missing module flags for CFI and KCFI sanitizers

Set the cfi-normalize-integers and kcfi-offset module flags when Control-Flow Integrity sanitizers are used, so functions generated by the LLVM backend use the same CFI/KCFI options as rustc.

cfi-normalize-integers tells LLVM to also use integer normalization for generated functions when -Zsanitizer-cfi-normalize-integers is used.

kcfi-offset specifies the number of prefix nops between the KCFI type hash and the function entry when -Z patchable-function-entry is used. Note that LLVM assumes all indirectly callable functions use the same number of prefix NOPs with -Zsanitizer=kcfi.
2024-08-22 08:17:20 +02:00
Matthias Krüger a8d5c6d151
Rollup merge of #128432 - g0djan:godjan/wasi_prohibit_implicit_unsafe, r=tgross35
WASI: forbid `unsafe_op_in_unsafe_fn` for `std::{os, sys}`

Part of https://github.com/rust-lang/rust/issues/127747 for WASI

try-job: test-various
2024-08-22 08:17:19 +02:00
Weihang Lo 89e7246875
Update cargo 2024-08-22 13:33:13 +08:00
onur-ozkan 0ce7705356 document `miri` and `cargo-miri` in `build.tools`
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-22 08:32:39 +03:00
onur-ozkan 0a8343c146 do not build `cargo-miri` by default on stable channel
miri skipped for stable channel by default, do the same for `cargo-miri`.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-22 08:32:31 +03:00
bors 739b1fdb15 Auto merge of #129365 - matthiaskrgr:rollup-ebwx6ya, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #127279 (use old ctx if has same expand environment during decode span)
 - #127945 (Implement `debug_more_non_exhaustive`)
 - #128941 ( Improve diagnostic-related lints: `untranslatable_diagnostic` & `diagnostic_outside_of_impl`)
 - #129070 (Point at explicit `'static` obligations on a trait)
 - #129187 (bootstrap: fix clean's remove_dir_all implementation)
 - #129231 (improve submodule updates)
 - #129264 (Update `library/Cargo.toml` in weekly job)
 - #129284 (rustdoc: animate the `:target` highlight)
 - #129302 (compiletest: use `std::fs::remove_dir_all` now that it is available)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-22 05:17:27 +00:00
León Orell Valerian Liehr 080c2ca2dc
Pretty-print own args of existential projections 2024-08-22 06:22:36 +02:00
Camille GILLOT ca7c55f050 Do not rely on names to find lifetimes. 2024-08-22 02:20:05 +00:00
Zalathar 34cdfc9b49 Advise against removing `run-make/libtest-junit/validate_junit.py`
Trying to get rid of this Python script looks tempting, because it's currently
the only Python script in the whole `run-make` suite that we actually run.

But getting rid of it would require pulling in a Rust crate to parse XML
instead, and that's probably not worth the extra hassle for a relatively-minor
test.
2024-08-22 12:13:25 +10:00
Zalathar 5fc562c5b1 Rename `foo.py` to `my_gdb_script.py`
This makes it easier for maintainers to see what the Python script is for.
2024-08-22 11:52:21 +10:00
Zalathar 7232a07f5a Explain the `run-make/debugger-visualizer-dep-info` Python script 2024-08-22 11:51:02 +10:00
Camille GILLOT c51f2d24d1 Use a LocalDefId in ResolvedArg. 2024-08-22 01:17:01 +00:00
Connor Horman 2cf48eaebc fix(core): Use correct operations/values in `unbounded_shr` doctests 2024-08-22 00:08:03 +00:00
Connor Horman 27b63b85ec chore: `x fmt` 2024-08-21 23:38:04 +00:00
Connor Horman 9907f617ab fix(core): Add `#![feature(unbounded_shifts)]` to doctests for `unbounded_shr`/`unbounded_shl` 2024-08-21 23:22:07 +00:00
Trevor Gross 81c00dde2b Add `const_cell_into_inner` to `OnceCell`
`Cell` and `RefCell` have their `into_inner` methods const unstable.
`OnceCell` has the same logic, so add it under the same gate.

Tracking issue: https://github.com/rust-lang/rust/issues/78729
2024-08-21 17:36:05 -05:00
Connor Horman 79cbb878c7 chore: `x fmt` and hopefully fix the tidy issue 2024-08-21 21:37:50 +00:00
Chai T. Rex c836739529 Change `assert_unsafe_precondition` docs to refer to `check_language_ub` 2024-08-21 17:35:54 -04:00
bors a32d4a0e82 Auto merge of #129370 - matthiaskrgr:rollup-g9117ee, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #128727 (bump conflicting_repr_hints lint to be shown in dependencies)
 - #129232 (Fix `thread::sleep` Duration-handling for ESP-IDF)
 - #129321 (Change neutral element of <fNN as iter::Sum> to neg_zero)
 - #129353 (llvm-wrapper: adapt for LLVM 20 API changes)
 - #129363 (Force `LC_ALL=C` for all run-make tests)
 - #129364 (safe transmute: gracefully bubble-up layout errors)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-21 21:33:31 +00:00
Connor Horman 38b5a2a67e chore: Also format the control flow 2024-08-21 21:23:25 +00:00
Connor Horman c89bae0ea8 Manually format functions and use `rhs` instead of `v` from my CE testing 2024-08-21 21:16:18 +00:00
Connor Horman 9b5a004bf8 feat(core): Add implementations for `unbounded_shl`/`unbounded_shr` 2024-08-21 20:57:50 +00:00
Chai T. Rex 191862d701 Use `assert_unsafe_precondition!` in `AsciiChar::digit_unchecked` 2024-08-21 16:26:35 -04:00
Sami Tolvanen 40f1d9d154 Add missing module flags for CFI and KCFI sanitizers
Set the cfi-normalize-integers and kcfi-offset module flags when
Control-Flow Integrity sanitizers are used, so functions generated by
the LLVM backend use the same CFI/KCFI options as rustc.

cfi-normalize-integers tells LLVM to also use integer normalization
for generated functions when -Zsanitizer-cfi-normalize-integers is
used.

kcfi-offset specifies the number of prefix nops between the KCFI
type hash and the function entry when -Z patchable-function-entry is
used. Note that LLVM assumes all indirectly callable functions use the
same number of prefix NOPs with -Zsanitizer=kcfi.
2024-08-21 20:23:56 +00:00
Matthias Krüger 00e109f3d4
Rollup merge of #129364 - jswrenn:transmute-layout-errs, r=compiler-errors
safe transmute: gracefully bubble-up layout errors

Changes `.unwrap()`s to `?` to avoid ICEs. Adds ui tests.

Fixes #129327

Tracking Issue: https://github.com/rust-lang/rust/issues/99571

r​? `@compiler-errors`
2024-08-21 21:58:29 +02:00
Matthias Krüger 92f0b7edeb
Rollup merge of #129363 - Urgau:run-make-lc_all-c, r=jieyouxu
Force `LC_ALL=C` for all run-make tests

This PR adds `LC_ALL=C` for all run-make tests so that they become locale independent.

Fixes #129362
r? `@jieyouxu`
2024-08-21 21:58:29 +02:00
Matthias Krüger cdec9a0417
Rollup merge of #129353 - krasimirgg:llvm20key, r=nikic
llvm-wrapper: adapt for LLVM 20 API changes

No functional changes intended.

Adapts llvm-wrapper for the LLVM commits 0f22d47a7a and d6d8243dcd.

`@rustbot` label: +llvm-main
r? `@nikic`
2024-08-21 21:58:28 +02:00
Matthias Krüger 3fb8faa653
Rollup merge of #129321 - krtab:float_sum, r=workingjubilee
Change neutral element of <fNN as iter::Sum> to neg_zero

The neutral element used to be positive zero, but +0 + -0 = +0 so -0 seems better indicated.
2024-08-21 21:58:28 +02:00
Matthias Krüger 94b3953853
Rollup merge of #129232 - ivmarkov:master, r=workingjubilee
Fix `thread::sleep` Duration-handling for ESP-IDF

Addresses the ESP-IDF specific aspect of https://github.com/rust-lang/rust/issues/129212

#### A short summary of the problems addressed by this PR:
================================================

1. **Problem 1** - the current implementation of `std:🧵:sleep` does not properly round up the passed `Duration`

As per the documentation of `std:🧵:sleep`, the implementation should sleep _at least_ for the provided duration, but not less. Since the minimum supported resolution of the `usleep` syscall which is used with ESP-IDF is one microsecond, this means that we need to round-up any sub-microsecond nanos to one microsecond. Moreover, in the edge case where the user had passed a duration of < 1000 nanos (i.e. less than one microsecond), the current implementation will _not_ sleep _at all_.

This is addressed by this PR.

2. **Problem 2** - the implementation of `usleep` on the ESP-IDF can overflow if the passed number of microseconds is >= `u32::MAX - 1_000_000`

This is also addressed by this PR.

Extra details for Problem 2:

`u32::MAX - 1_000_000` is chosen to accommodate for the longest possible systick on the ESP IDF which is 1000ms.

The systick duration is selected when compiling the ESP IDF FreeRTOS task scheduler itself, so we can't know it from within `STD`. The default systick duration is 10ms, and might be lowered down to 1ms. (Making it longer I have never seen, but in theory it can go up to a 1000ms max, even if obviously a one second systick is unrealistic - but we are paranoid in the PR.)

While the overflow is reported upstream in the ESP IDF repo[^1], I still believe we should workaround it in the Rust wrappers as well, because it might take time until it is fixed, and they might not fix it for all released ESP IDF versions.

For big durations, rather than calling `usleep` repeatedly on the ESP-IDF in chunks of `u32::MAX - 1_000_000`us, it might make sense to call instead with 1_000_000us (one second) as this is the max period that seems to be agreed upon as a safe max period in the `usleep` POSIX spec. On the other hand, that might introduce less precision (as we need to call more times `usleep` in a loop) and, we would be fighting a theoretical problem only, as I have big doubts the ESP IDF will stop supporting durations higher than 1_000_000us - ever - because of backwards compatibility with code which already calls `usleep` on the ESP IDF with bigger durations.

[^1]: https://github.com/espressif/esp-idf/issues/14390
2024-08-21 21:58:28 +02:00
Matthias Krüger 5a93c74a02
Rollup merge of #128727 - RalfJung:conflicting-repr-future-incompat, r=lcnr
bump conflicting_repr_hints lint to be shown in dependencies

This has been a future compatibility lint for years, let's bump it up to be shown in dependencies (so that hopefully we can then make it a hard error fairly soon).

Cc https://github.com/rust-lang/rust/issues/68585
2024-08-21 21:58:27 +02:00
Jason Newcomb 9450b4af48 Replace more uses of `snippet_opt`. 2024-08-21 14:41:18 -04:00
Ralf Jung fbdc191fdc epoll test: avoid some subtly dangling pointers 2024-08-21 20:19:46 +02:00
Jack Wrenn e2328ebd7f safe transmute: gracefully bubble-up layout errors
Changes `.unwrap()`s to `?` to avoid ICEs. Adds ui tests.

Fixes #129327
2024-08-21 18:06:02 +00:00
Matthias Krüger 33dc313625
Rollup merge of #129302 - jieyouxu:compiletest-RAGEY, r=compiler-errors
compiletest: use `std::fs::remove_dir_all` now that it is available

It turns out `aggressive_rm_rf` is not sufficiently aggressive (RAGEY) on Windows and obviously handles Windows symlinks incorrectly. Instead of rolling our own version, let's use `std::fs::remove_dir_all` now that it's available (well, it's been available for a good while, but probably wasn't available when this helper was written).

cc #129187 since basically this is failing due to similar problems.

Blocker for #128562.
Fixes #129155.
Fixes #126334.
2024-08-21 19:35:14 +02:00
Matthias Krüger ade33251f1
Rollup merge of #129284 - notriddle:notriddle/animate-target=light, r=GuillaumeGomez
rustdoc: animate the `:target` highlight

This approach is, roughly, based on how Discourse does it. It came up while discussing [some other possible sidebar changes](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Moving.20deprecated.20items.20out.20of.20the.20way), as a design that made rapid scanning easier while avoiding the inherent trade-offs in summarizing.

https://github.com/user-attachments/assets/f7a8fec3-70a5-40a1-92ea-bfdffbd61c22
2024-08-21 19:35:14 +02:00
Matthias Krüger a3f644ef20
Rollup merge of #129264 - tgross35:dependencies-ci-library, r=Kobzol
Update `library/Cargo.toml` in weekly job

Before the workspace split, the library was covered by the weekly `cargo update` cron job. Now that the library has its own workspace, it doesn't get these updates.

Add `library/Cargo.toml` to the job so updates happen again.
2024-08-21 19:35:13 +02:00
Matthias Krüger a08a2ef1b7
Rollup merge of #129231 - onur-ozkan:improve-submodule-updates, r=Mark-Simulacrum
improve submodule updates

During config parsing, some bootstrap logic (e.g., `download-ci-llvm`) checks certain sources (for `download-ci-llvm`, it's `src/llvm-project`) and acts based on their state. This means that if path is a git submodule, bootstrap needs to update it before checking its state. Otherwise it may make incorrect assumptions by relying on outdated sources. To enable submodule updates during config parsing, we need to move the `update_submodule` function from the `Build` to `Config`, so we can access to it during the parsing process.

Closes #122787
2024-08-21 19:35:13 +02:00
Matthias Krüger 9fd8a2c3af
Rollup merge of #129187 - jieyouxu:squeaky-clean-windows-symlinks, r=Kobzol
bootstrap: fix clean's remove_dir_all implementation

It turns out bootstrap's `clean.rs`'s hand-rolled `rm_rf` (which probably comes before `std::fs::remove_dir_all` was stable) is very broken on native Windows around both read-only files/directories and especially symbolic links. So instead of rolling our own, just use `std::fs::remove_dir_all`.

This is a blocker for compiletest's own `rm_rf` implementation #129155 which happens to be also buggy, which in turn is a blocker for the rmake.rs test port #128562 that heavily exercises symlinks (I was reviewing #128562 and testing it on native Windows which is how I found out).

I also left a FIXME for `detect_src_and_out` due to a failing assertion on native Windows (opened #129188):

```
---- core::config::tests::detect_src_and_out stdout ----
thread 'core::config::tests::detect_src_and_out' panicked at src\core\config\tests.rs:72:13:
assertion `left == right` failed
  left: "E:\\tmp"
 right: "C:\\tmp"
```

Fixes #112544 (because now we handle Windows symlinks properly).

try-job: x86_64-msvc
try-job: i686-mingw
try-job: test-various
try-job: armhf-gnu
try-job: aarch64-apple
try-job: aarch64-gnu
2024-08-21 19:35:12 +02:00
Matthias Krüger ffdbd9d6c8
Rollup merge of #129070 - estebank:static-trait, r=davidtwco
Point at explicit `'static` obligations on a trait

Given `trait Any: 'static` and a `struct` with a `Box<dyn Any + 'a>` field, point at the `'static` bound in `Any` to explain why `'a: 'static`.

```
error[E0478]: lifetime bound not satisfied
   --> f202.rs:2:12
    |
2   |     value: Box<dyn std::any::Any + 'a>,
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: lifetime parameter instantiated with the lifetime `'a` as defined here
   --> f202.rs:1:14
    |
1   | struct Hello<'a> {
    |              ^^
note: but lifetime parameter must outlive the static lifetime
   --> /home/gh-estebank/rust/library/core/src/any.rs:113:16
    |
113 | pub trait Any: 'static {
    |                ^^^^^^^
```

Partially address #33652.
2024-08-21 19:35:12 +02:00