306566 Commits

Author SHA1 Message Date
Iris Shi
e37f0fed05
Add regression test 2025-09-22 17:39:31 +08:00
Petros Angelatos
e9b2c4f395 avoid violating slice::from_raw_parts safety contract in Vec::extract_if
The implementation of the `Vec::extract_if` iterator violates the safety
contract adverized by `slice::from_raw_parts` by always constructing a
mutable slice for the entire length of the vector even though that span
of memory can contain holes from items already drained. The safety
contract of `slice::from_raw_parts` requires that all elements must be
properly initialized.

As an example we can look at the following code:

```rust
let mut v = vec![Box::new(0u64), Box::new(1u64)];
for item in v.extract_if(.., |x| **x == 0) {
    drop(item);
}
```

In the second iteration a `&mut [Box<u64>]` slice of length 2 will be
constructed. The first slot of the slice contains the bitpattern of an
already deallocated box, which is invalid.

This fixes the issue by only creating references to valid items and
using pointer manipulation for the rest. I have also taken the liberty
to remove the big `unsafe` blocks in place of targetted ones with a
SAFETY comment. The approach closely mirrors the implementation of
`Vec::retain_mut`.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2025-09-22 10:59:52 +03:00
Ralf Jung
7d0012914e assert_unsafe_precondition: fix some incorrect check_language_ub 2025-09-22 09:28:38 +02:00
The rustc-josh-sync Cronjob Bot
c3d30743a4 Merge ref '9f32ccf35fb8' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 9f32ccf35fb877270bc44a86a126440f04d676d0
Filtered ref: 87b13773969f65eec6762cfe4194954e7513f59b
Upstream diff: 2f3f27bf79...9f32ccf35f

This merge was created using https://github.com/rust-lang/josh-sync.
2025-09-22 04:19:52 +00:00
The rustc-josh-sync Cronjob Bot
5658b39397 Prepare for merging from rust-lang/rust
This updates the rust-version file to 9f32ccf35fb877270bc44a86a126440f04d676d0.
2025-09-22 04:13:50 +00:00
Iris Shi
52e6998a18
Move test file 2025-09-22 11:47:12 +08:00
Iris Shi
8f1a1f8533
Update tests/rustdoc/private-mod-override-re-export.rs
Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
2025-09-22 05:45:23 +02:00
ltdk
055e05a338 Mark float intrinsics with no preconditions as safe 2025-09-21 20:37:51 -04:00
Yotam Ofek
20671600a2 Introduce "wrapper" helpers to rustdoc 2025-09-22 00:28:34 +03:00
Yotam Ofek
cdf96614cf Re-use some existing util fns 2025-09-21 23:54:57 +03:00
Yotam Ofek
c54a953402 Early return in visibility_print_with_space 2025-09-21 23:54:57 +03:00
bors
9f32ccf35f Auto merge of #146862 - matthiaskrgr:rollup-1zqootr, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#143857 (Port #[macro_export] to the new attribute parsing infrastructure)
 - rust-lang/rust#146486 (Improve `core::sync::atomic` coverage)
 - rust-lang/rust#146606 (ci: x86_64-gnu-tools: Add `--test-args` regression test)
 - rust-lang/rust#146639 (std: merge definitions of `StdioPipes`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-21 20:33:36 +00:00
Matthias Krüger
adfc111fff
Rollup merge of #146639 - joboet:shared-stdiopipes, r=Mark-Simulacrum
std: merge definitions of `StdioPipes`

All platforms define this structure the same way, so we can just put it in the `process` module directly.
2025-09-21 22:20:27 +02:00
Matthias Krüger
af315d3027
Rollup merge of #146606 - Enselic:test-test-args, r=Mark-Simulacrum
ci: x86_64-gnu-tools: Add `--test-args` regression test

See https://github.com/rust-lang/rust/pull/146601#issuecomment-3293179561

r? ``@Mark-Simulacrum``
2025-09-21 22:20:26 +02:00
Matthias Krüger
c0f5eefa27
Rollup merge of #146486 - ferrocene:pvdrz/improve-atomic-coverage, r=ibraheemdev
Improve `core::sync::atomic` coverage

This PR improves the `core::sync::atomic` coverage by adding new tests to `coretests`.

r? libs
2025-09-21 22:20:26 +02:00
Matthias Krüger
7148a4f543
Rollup merge of #143857 - Periodic1911:macro-export, r=jdonszelmann
Port #[macro_export] to the new attribute parsing infrastructure

Ports macro_export to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? ``@oli-obk``

cc ``@JonathanBrouwer`` ``@jdonszelmann``
2025-09-21 22:20:25 +02:00
U. Lasiotus
0138bbd495 Add x86_64-unknown-motor (Motor OS) tier 3 target
Add the initial no-std Motor OS compiler target.

Motor OS has been developed for several years in the open:
https://github.com/moturus/motor-os.

It has a more or less full implementation of Rust std library,
as well as tokio/mio ports.

Build instructions can be found here:
https://github.com/moturus/motor-os/blob/main/docs/build.md.

Signed-off-by: U. Lasiotus <lasiotus@motor-os.org>
2025-09-21 12:43:13 -07:00
Folkert de Vries
3565b0699d
emit attribute for readonly non-pure inline assembly 2025-09-21 21:16:06 +02:00
Jens Reidel
b3c2435688
Make mips64el-unknown-linux-muslabi64 link dynamically
I missed this target when I changed all the other tier 3 targets. Only
realized that this one was still statically linked when I looked at the
list of targets in the test later.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-09-21 21:13:15 +02:00
The 8472
5f0a68eb22 regression test for https://github.com/rust-lang/rust/issues/117763 2025-09-21 19:54:43 +02:00
joboet
87a00f67ba
std: merge definitions of StdioPipes
All platforms define this structure the same way, so we can just put it in the `process` module directly.
2025-09-21 19:45:46 +02:00
Tshepang Mbambo
a11333a996
Merge pull request #2594 from cammeresi/spelling-20250921
Correct a misspelling of RUSTC_LOG
2025-09-21 19:39:05 +02:00
Ben Kimock
aef02fb864 Explain tests and setting cfgs 2025-09-21 13:28:01 -04:00
Ben Kimock
df58fd8cf7 Change the cfg to a dash 2025-09-21 13:12:20 -04:00
Ben Kimock
888679013d Add panic=immediate-abort 2025-09-21 13:12:18 -04:00
Sidney Cammeresi
d887c570a0
Correct a misspelling of RUSTC_LOG 2025-09-21 09:31:26 -07:00
bors
7e4b8d702f Auto merge of #146659 - cjgillot:impossible-taint, r=oli-obk
Consider errors in MIR as impossible predicates to empty the body.

The ICEs come from elaborating drops or performing state transform in MIR bodies that fail typeck or borrowck.

If the body is tainted, replace it with `unreachable`.

Fixes https://github.com/rust-lang/rust/issues/122630
Fixes https://github.com/rust-lang/rust/issues/122904
Fixes https://github.com/rust-lang/rust/issues/125185
Fixes https://github.com/rust-lang/rust/issues/139556
2025-09-21 16:28:12 +00:00
bit-aloo
33e262e8cc
remove prepare_test_specific_dir and update tests accordingly 2025-09-21 20:58:18 +05:30
bit-aloo
a48cd767f6
add explicit config assignment when running the test, as the src is assigned to CARGO_MANIFEST_DIR, so the config actually use the <src>/bootstrap.toml and the /tmp/bootstrap.toml 2025-09-21 20:58:17 +05:30
bit-aloo
afe380dd58
initialize out with CARGO_TARGET_DIR and then go for manifest and then for current 2025-09-21 20:58:15 +05:30
bit-aloo
671aabd4eb
add dry_run flag in config builder and remove runtime test hacks 2025-09-21 20:56:13 +05:30
bit-aloo
9189bf79d4
remove create_config_without_ci_llvm_override duplication 2025-09-21 20:56:12 +05:30
bit-aloo
0c68c82957
rename config_toml to with_default_toml_config 2025-09-21 20:56:12 +05:30
bit-aloo
a29474d3ff
this is dicy, whether we have a method to explicitly enable_llvm_override 2025-09-21 20:56:12 +05:30
bit-aloo
05131bd5f1
move most of the test to new testCtx 2025-09-21 20:56:11 +05:30
bit-aloo
24ed1a0455
allow symlinking during test 2025-09-21 20:56:11 +05:30
bit-aloo
ce4604e34e
remove using default toml config for test in get_toml, we handle it via using the temp directory created via the testCtx 2025-09-21 20:56:10 +05:30
bit-aloo
d488d33fd6
let verify method run in test settings 2025-09-21 20:56:10 +05:30
bit-aloo
6c79f547f9
add an API in ConfigBuilder to point to config file for toml parsing 2025-09-21 20:56:09 +05:30
bit-aloo
a12969e0d1
walk up the ancestors 2025-09-21 20:56:09 +05:30
bit-aloo
1bc19932e6
make cargo test work for bootstrap self test 2025-09-21 20:56:09 +05:30
Jonathan Brouwer
f7fa83ec62
Changes to uitests for macro_export port
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-21 10:42:47 -04:00
Jonathan Brouwer
6abcadc235
Port #[macro_export] to the new attribute parsing infrastructure
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-21 10:42:47 -04:00
bors
6710835ae7 Auto merge of #146592 - Kobzol:tidy-diag, r=jieyouxu
Implement a simple diagnostic system for tidy

In https://github.com/rust-lang/rust/pull/146316 and https://github.com/rust-lang/rust/pull/146580, contributors independently wanted to reduce the verbose output of tidy. But before, the output was quite ad-hoc, so it was not easy to control it.

In this PR, I implemented a simple diagnostic system for tidy, which allows us to:
1) Only print certain information in verbose mode (`-v`)
2) Associate each (error) output to a specific check, so that it is easier to find out what exactly has failed and which check you might want to examine (not fully done, there are some random `println`s left, but most output should be scoped to a specific check)
3) Print output with colors, based on the message level (message, warning, error)
4) Show the start/end execution of each check in verbose mode, for better progress indication

Failure output:
<img width="1134" height="157" alt="image" src="https://github.com/user-attachments/assets/578a9302-e1c2-47e5-9370-a3556c49d9fc" />

Success output:
<img width="388" height="113" alt="image" src="https://github.com/user-attachments/assets/cf27faf8-3d8b-49e3-88d0-fac27a9c36a8" />

Verbose output (shortened):
<img width="380" height="158" alt="image" src="https://github.com/user-attachments/assets/ce7102b8-c2f3-42a8-a2ec-ca30389be91e" />

CC `@nnethercote` `@RalfJung` `@GuillaumeGomez`

The first two commits and the last commit are interesting, the rest is just mechanical port of the code from `bad: &mut bool` to `DiagCtx` and `RunningCheck`.

The `extra_checks` check could be further split, but I'd leave that for another PR.

r? `@jieyouxu`
2025-09-21 13:21:30 +00:00
Jakub Beránek
4c208f5c64
Implement output of colored messages with optional check context 2025-09-21 15:15:31 +02:00
Jakub Beránek
352fa3960a
Migrate the remaining tidy checks to diagnostics 2025-09-21 15:15:31 +02:00
Jakub Beránek
c36faff900
Add CheckId, migrate the alphabetical check to diagnostics 2025-09-21 15:13:01 +02:00
Jakub Beránek
b0010dd5ae
Add diagnostics context and migrate the style check to it 2025-09-21 15:13:01 +02:00
Marijn Schouten
2dfcd0948e btree InternalNode::new safety comments 2025-09-21 12:05:09 +00:00
Zalathar
b17fb70d04 Add self-profile events for target-machine creation
These code paths are surprisingly hot in the `large-workspace` benchmark; it
would be handy to see some detailed timings and execution counts.
2025-09-21 21:37:15 +10:00