1
Fork 0
Commit graph

285227 commits

Author SHA1 Message Date
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
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
Chris Denton
89c9c21b06
Start using with_native_path in std::sys::fs 2025-03-29 14:43:41 +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
Lieselotte
439048e074
BackendRepr::is_signed: comment why this may panics 2025-03-29 12:21:51 +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
Matthias Krüger
12165fce87
Rollup merge of #139086 - meithecatte:expr-use-visitor-cleanup, r=compiler-errors
Various cleanup in ExprUseVisitor

These are the non-behavior-changing commits from #138961.
2025-03-29 11:43:49 +01:00
Matthias Krüger
b5ad69bb93
Rollup merge of #139057 - yotamofek:pr/slice-contains, r=wesleywiser
use `slice::contains` where applicable

Applies the [`manual_contains`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains) clippy lint, plus some small drive-bys.
2025-03-29 11:43:48 +01:00
Matthias Krüger
0e722cce62
Rollup merge of #139056 - yotamofek:pr/smir/try_fold, r=scottmcm
use `try_fold` instead of `fold`

Small cleanup, applies the [`manual_try_fold`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold) clippy lint.
2025-03-29 11:43:47 +01:00
Matthias Krüger
111351fcc1
Rollup merge of #138988 - madsmtm:internal-weak-macro-syntax, r=ibraheemdev
Change the syntax of the internal `weak!` macro

Change the syntax to include parameter names and a trailing semicolon.

Motivation:
- Mirror the `syscall!` macro.
- Allow rustfmt to format it (when wrapped in parentheses, and when not inside `cfg_if!`).
- For better documentation (having the parameter names available in the source code is a bit nicer).
- Allow a future improvement to this macro where we can sometimes use the symbol directly when it's statically known to be available (and thus need the parameter names to be available), see https://github.com/rust-lang/rust/pull/136868.

r? libs
2025-03-29 11:43:46 +01:00
Matthias Krüger
c82b88b009
Rollup merge of #138757 - rust-wasi-web:wasi-thread-stack-size, r=alexcrichton
wasm: increase default thread stack size to 1 MB

The default stack size for the [main thread is 1 MB as specified by linker options](38cf49dde8/compiler/rustc_target/src/spec/base/wasm.rs (L14)).
However, the default stack size for threads was only 64 kB.

This is surprisingly small and thus we increase it to 1 MB to match the main thread.
2025-03-29 11:43:46 +01:00
Matthias Krüger
240a4da396
Rollup merge of #138692 - jieyouxu:reject-bool-lit-rev-names, r=wesleywiser
Reject `{true,false}` as revision names

Because they would imply `--cfg={true,false}` otherwise, and the test writer has to use `cfg(r#true)` and `cfg(r#false)` in the test.

Closes #138663.
2025-03-29 11:43:45 +01:00
bors
898916595c Auto merge of #139067 - m-ou-se:terminating-scopes-no-hashset, r=wesleywiser
Remove `terminating_scopes` hash set.

Instead of inserting and checking ids in a hashset, we can just pass a boolean as argument.

For example:

```diff
-    visitor.terminating_scopes.insert(arm.hir_id.local_id);
-    visitor.enter_node_scope_with_dtor(arm.hir_id.local_id);
+    visitor.enter_node_scope_with_dtor(arm.hir_id.local_id, true);
```
2025-03-29 10:31:47 +00:00
Vadim Petrochenkov
cf451f0830 compiletest: Support matching diagnostics on lines below 2025-03-29 13:30:20 +03:00
bohan
366095d6c7 less decoding if it has the same syntax context 2025-03-29 17:44:12 +08:00
Mara Bos
163ea4acd0 Add more tests for pin!().
Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2025-03-29 08:10:15 +01:00
bors
928468c47c Auto merge of #139074 - BoxyUwU:bump_1_88, r=BoxyUwU
Bump to 1.88

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-friday-the-week-before

r? ghost
2025-03-29 05:42:07 +00:00
bors
2848101ed5 Auto merge of #138784 - madsmtm:bootstrap-bump-cc-cmake, r=jieyouxu
Bump boostrap `cc` to 1.2.17 and `cmake` to 0.1.54

The `cc` version in `bootstrap` was reverted down to 1.1.22 in https://github.com/rust-lang/rust/pull/137460 (previously at 1.2.0). The offending issue has since then been resolved in https://github.com/rust-lang/cc-rs/pull/1413, and a new version of `cc` has been released in https://github.com/rust-lang/cc-rs/pull/1435, so let's try to update the version again.

See [the `cc-rs` changelog](d9dd20e376/CHANGELOG.md) and [the `cmake-rs` changelog](fd56c5a6b4/CHANGELOG.md) for details on what has changed here.

r? jieyouxu who tried this last in https://github.com/rust-lang/rust/pull/137022.
`@rustbot` label T-bootstrap
try-job: *apple*
2025-03-29 00:03:11 +00:00
Mara Bos
122d7e1dcd Remove terminating_scopes hash set. 2025-03-28 22:49:27 +01:00
bors
920d95eaf2 Auto merge of #139085 - matthiaskrgr:rollup-3q2peol, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #138976 (Explain one-past-the-end pointer in std library)
 - #139052 (Put pin!() tests in the right file.)
 - #139058 (Fix formatting nit in process.rs)
 - #139063 (Fix TAIT & ATPIT feature gating in the presence of anon consts)
 - #139065 (Miri subtree update)
 - #139069 (`io::Take`: avoid new `BorrowedBuf` creation in some case)
 - #139075 (Do not treat lifetimes from parent items as influencing child items)
 - #139079 (tracking autodiff files via triagebot.toml)

Failed merges:

 - #139044 (bootstrap: Avoid cloning `change-id` list)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-28 20:56:37 +00:00
Matthias Krüger
20f2655258
Rollup merge of #139079 - EnzymeAD:autodfff-triagebot, r=Noratrieb
tracking autodiff files via triagebot.toml

r? `@oli-obk`

Tracking:

- https://github.com/rust-lang/rust/issues/124509
2025-03-28 21:18:32 +01:00
Matthias Krüger
3e968c7e9f
Rollup merge of #139075 - oli-obk:resolver-item-lifetime, r=compiler-errors
Do not treat lifetimes from parent items as influencing child items

```rust
struct A;
impl Bar<'static> for A {
    const STATIC: &str = "";
    //            ^ no future incompat warning
}
```

has no future incompat warning, because there is no ambiguity. But

```rust
struct C;
impl Bar<'_> for C {
//       ^^ this lifeimte
    const STATIC: &'static str = {
        struct B;
        impl Bar<'static> for B {
            const STATIC: &str = "";
            // causes     ^ to emit a future incompat warning
        }
        ""
    };
}
```

had one before this PR, because the impl for `B` (which is just a copy of `A`) thought it was influenced by a lifetime on the impl for `C`.

I double checked all other `lifetime_ribs` iterations and all of them do check for `Item` boundaries. This feels very fragile tho, and ~~I think we should do not even be able to see ribs from parent items, but that's a different refactoring that I'd rather not do at the same time as a bugfix~~. EDIT: ah nevermind, this is needed for improving diagnostics like "use of undeclared lifetime" being "can't use generic parameters from outer item" instead.

r? `@compiler-errors`
2025-03-28 21:18:32 +01:00
Matthias Krüger
7c0a14f030
Rollup merge of #139069 - a1phyr:better_take, r=joboet
`io::Take`: avoid new `BorrowedBuf` creation in some case

If `self.limit == buf.capacity()`, doing the whole `BorrowedBuf` dance is not necessary.
2025-03-28 21:18:31 +01:00
Matthias Krüger
b6699318fa
Rollup merge of #139065 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2025-03-28 21:18:30 +01:00
Matthias Krüger
52aed95060
Rollup merge of #139063 - fmease:fix-tait-atpit-gating, r=oli-obk
Fix TAIT & ATPIT feature gating in the presence of anon consts

Fixes #139055 (https://github.com/rust-lang/rust/issues/119924#issuecomment-1928659690).

r? oli-obk or anybody else
2025-03-28 21:18:30 +01:00
Matthias Krüger
660e8633f3
Rollup merge of #139058 - barafael:patch-1, r=joboet
Fix formatting nit in process.rs

Minor formatting issue in `process.rs`.
2025-03-28 21:18:29 +01:00
Matthias Krüger
3060c77815
Rollup merge of #139052 - m-ou-se:pin-macro-tests, r=joboet
Put pin!() tests in the right file.

In #138717, these tests were put in `tests/pin.rs`, but they should go in `tests/pin_macro.rs`.

r? `@jdonszelmann`
2025-03-28 21:18:28 +01:00
Matthias Krüger
e82557e9ad
Rollup merge of #138976 - xizheyin:issue-138969, r=RalfJung
Explain one-past-the-end pointer in std library

Closing #138969

r? libs
2025-03-28 21:18:27 +01:00
joboet
dd4f616423
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-28 19:32:36 +01:00
Manuel Drehwald
e6a2c29bc4 tracking autodiff files via triagebot.toml 2025-03-28 14:15:08 -04:00
León Orell Valerian Liehr
7a295d1be0
Fix TAIT & ATPIT feature gating in the presence of anon consts 2025-03-28 18:15:23 +01:00
Oli Scherer
dabee5d563 Do not treat lifetimes from parent items as influencing child items 2025-03-28 17:06:00 +00:00
Boxy
9300fa19b7 Bump to 1.88.0 2025-03-28 16:53:17 +00:00
bors
19f42cb9bb Auto merge of #139054 - matthiaskrgr:rollup-2bk2fb4, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #137889 (update outdated doc with new example)
 - #138104 (Greatly simplify doctest parsing and information extraction)
 - #138678 (rustc_resolve: fix instability in lib.rmeta contents)
 - #138986 (feat(config): Add ChangeId enum for suppressing warnings)
 - #139038 (Update target maintainers for thumb targets to reflect new REWG Arm team name)
 - #139045 (bootstrap: update `test_find` test)
 - #139047 (Remove ScopeDepth)

Failed merges:

 - #139044 (bootstrap: Avoid cloning `change-id` list)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-28 16:37:12 +00:00
Benoît du Garreau
9055765ce1 io::Take: avoid new BorrowedBuf creation in some case 2025-03-28 16:36:49 +01:00
xizheyin
074edbd89c std: Explain range follows standard half-open range in offset
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-28 22:28:48 +08:00
Ralf Jung
7310925076 update lockfile 2025-03-28 15:28:14 +01:00
Ralf Jung
a8616f2115
Merge pull request #4241 from RalfJung/mangle_internal_symbol_cache
cache mangle_internal_symbol results
2025-03-28 13:42:50 +00:00
Rafael Bachmann
0f418520c6
Fix formatting nit in process.rs 2025-03-28 13:22:09 +01:00
Yotam Ofek
9ef35ddc0c use slice::contains where applicable 2025-03-28 12:21:21 +00:00
Yotam Ofek
827cb1b2a7 use try_fold instead of fold 2025-03-28 12:14:09 +00:00
Matthias Krüger
310bebc487
Rollup merge of #139047 - m-ou-se:remove-scope-depth, r=oli-obk
Remove ScopeDepth

The scope depth was tracked, but never seemed to be used for anything.

Every single place that used `(Scope, ScopeDepth)`, matched it on `(p, _)`.
2025-03-28 12:59:58 +01:00
Matthias Krüger
ea56904feb
Rollup merge of #139045 - onur-ozkan:less-verbose-bootstrap-test, r=Kobzol
bootstrap: update `test_find` test

`cc::Build::get_archiver` is noisy on the `arm-linux-androideabi` target and constantly printing `llvm-ar --version` output during bootstrap tests on all platforms.
2025-03-28 12:59:58 +01:00
Matthias Krüger
5261a0aedf
Rollup merge of #139038 - adamgreig:thumb-target-maintainers, r=Noratrieb
Update target maintainers for thumb targets to reflect new REWG Arm team name

Closes #139027

The name of the team responsible for these targets has changed as the team was merged with other Arm-related teams (see https://github.com/rust-embedded/wg/pull/818). The link gives an up-to-date list of github usernames that can be pinged, whereas the old email address is not very actively maintained or tracked.
2025-03-28 12:59:57 +01:00
Matthias Krüger
60833b1475
Rollup merge of #138986 - Shourya742:2025-03-25-add-ignore-to-change-id, r=Kobzol
feat(config): Add ChangeId enum for suppressing warnings

closes: #138925
2025-03-28 12:59:56 +01:00