Commit Graph

300570 Commits

Author SHA1 Message Date
Aleksey Kliger
b6d2130867 Add docstring 2025-07-07 15:56:37 -04:00
Jared Davis
52aa3839f2 Merge pull request #1 from sesgoe/ses/update-clippy-fix-13518
fix: check against 'main' function name instead of entrypoint function
2025-07-07 15:56:30 -04:00
Ses Goe
5853e6fa7e chore: add tests to check against the --test compile flag 2025-07-07 15:11:30 -04:00
Ses Goe
c000a0136c fix: check against 'main' function name instead of entrypoint function
update docs to be a bit more clear
2025-07-07 15:11:30 -04:00
Md. Yeasin Arafat
2bff99c275 Fix in String docs: remove 'else' from 'something else similar' 2025-07-08 01:05:16 +06:00
Aleksey Kliger
e2891c0fb9 configure.py: Write last key in each section
The loop that writes the keys in each section of bootstrap.toml
accumulates all the commented lines before a given key and emits them
when it reaches the next key in the section.  This ends up dropping
lines accumulated for the last key
2025-07-07 14:54:50 -04:00
Lukas Wirth
0209f9e5f8 Merge pull request #20180 from ChayimFriedman2/parser-stuck
fix: Always bump in the parser in `err_and_bump()`
2025-07-07 18:42:12 +00:00
Anne Stijns
6254afa5f2 Clarify the meaning of AttributeOrder::KeepFirst and AttributeOrder::KeepLast 2025-07-07 20:29:06 +02:00
Matthias Krüger
ff6b881c8d Rollup merge of #143591 - ehuss:future-typos, r=jieyouxu
Fix missing words in future tracking issue

Fixes some sloppy editing on my part.
2025-07-07 19:55:37 +02:00
Matthias Krüger
42b105eb21 Rollup merge of #143584 - fee1-dead-contrib:push-skswvrwsrmll, r=RalfJung
make `Machine::load_mir` infallible

it doesn't need to return an `InterpResult`.
2025-07-07 19:55:36 +02:00
Matthias Krüger
f5df1f562c Rollup merge of #143583 - folkertdev:loop-match-no-terminator-on-block, r=bjorn3
`loop_match`: fix 'no terminator on block'

tracking issue: https://github.com/rust-lang/rust/issues/132306
fixes https://github.com/rust-lang/rust/issues/143435

The argument `block` was not properly closed on an error path.

r? `@bjorn3`
2025-07-07 19:55:35 +02:00
Matthias Krüger
7ed6bd98a2 Rollup merge of #143572 - yotamofek:pr/unused-allow-attrs, r=fee1-dead
Remove unused allow attrs

These `#[allow]`s seem to be unused (at least according to `x check`, didn't run `x test` locally). Let's clean them up! 🧹
2025-07-07 19:55:35 +02:00
Matthias Krüger
b6777b1939 Rollup merge of #143566 - jieyouxu:fix-x86_64-unknown-netbsd, r=fee1-dead
Fix `x86_64-unknown-netbsd` platform support page

`x86_64-unknown-netbsd` is Tier 2 with host tools, not Tier 3.

cc `@he32.`

r? compiler
2025-07-07 19:55:34 +02:00
Matthias Krüger
6c8482ee2c Rollup merge of #143539 - JonathanBrouwer:ice-regression-tests, r=oli-obk
Regression tests for repr ICEs

Closes https://github.com/rust-lang/rust/issues/143522
Closes https://github.com/rust-lang/rust/issues/143479

Both issues were already (accidentally) fixed in this PR, but having the tests is nice https://github.com/rust-lang/rust/pull/143252

r? `@jdonszelmann`
2025-07-07 19:55:33 +02:00
Matthias Krüger
1b922d3901 Rollup merge of #143438 - makai410:rustdoc-fix, r=ehuss
Fix the link in `rustdoc.md`
2025-07-07 19:55:33 +02:00
Matthias Krüger
2554c424ef Rollup merge of #143340 - nabijaczleweli:awhile, r=mati865
awhile -> a while where appropriate
2025-07-07 19:55:32 +02:00
Matthias Krüger
00a4418158 Rollup merge of #132469 - estebank:issue-132041, r=Nadrieril
Do not suggest borrow that is already there in fully-qualified call

When encountering `&str::from("value")` do not suggest `&&str::from("value")`.

Fix #132041.
2025-07-07 19:55:31 +02:00
Chayim Refael Friedman
aa331b1c5f Fix a case where the link type was None
Which caused a panic.
2025-07-07 20:44:18 +03:00
Alex Crichton
7ec8c89c15 Update intro blurb in wasm32-wasip1 docs
I was reading over this documentation in light of the effort to enlist
more maintainers for Tier 2 targets and figured it was time for a
refresh of this documentation now that historical renames/etc have all
become a thing of the past. No new major changes to this documentation,
mostly just wanted to update it and reflect the modern status quo for
this target.
2025-07-07 10:42:08 -07:00
bors
9ac09016b0 Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubilee
Allow custom default address spaces and parse `p-` specifications in the datalayout string

Some targets, such as CHERI, use as default an address space different from the "normal" default address space `0` (in the case of CHERI, [200 is used](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-877.pdf)). Currently, `rustc` does not allow to specify custom address spaces and does not take into consideration [`p-` specifications in the datalayout string](https://llvm.org/docs/LangRef.html#langref-datalayout).

This patch tries to mitigate these problems by allowing targets to define a custom default address space (while keeping the default value to address space `0`) and adding the code to parse the `p-` specifications in `rustc_abi`. The main changes are that `TargetDataLayout` now uses functions to refer to pointer-related informations, instead of having specific fields for the size and alignment of pointers in the default address space; furthermore, the two `pointer_size` and `pointer_align` fields in `TargetDataLayout` are replaced with an `FxHashMap` that holds info for all the possible address spaces, as parsed by the `p-` specifications.

The potential performance drawbacks of not having ad-hoc fields for the default address space will be tested in this PR's CI run.

r? workingjubilee
2025-07-07 17:28:14 +00:00
bors
2f8eeb2bba Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubilee
Allow custom default address spaces and parse `p-` specifications in the datalayout string

Some targets, such as CHERI, use as default an address space different from the "normal" default address space `0` (in the case of CHERI, [200 is used](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-877.pdf)). Currently, `rustc` does not allow to specify custom address spaces and does not take into consideration [`p-` specifications in the datalayout string](https://llvm.org/docs/LangRef.html#langref-datalayout).

This patch tries to mitigate these problems by allowing targets to define a custom default address space (while keeping the default value to address space `0`) and adding the code to parse the `p-` specifications in `rustc_abi`. The main changes are that `TargetDataLayout` now uses functions to refer to pointer-related informations, instead of having specific fields for the size and alignment of pointers in the default address space; furthermore, the two `pointer_size` and `pointer_align` fields in `TargetDataLayout` are replaced with an `FxHashMap` that holds info for all the possible address spaces, as parsed by the `p-` specifications.

The potential performance drawbacks of not having ad-hoc fields for the default address space will be tested in this PR's CI run.

r? workingjubilee
2025-07-07 17:28:14 +00:00
Folkert de Vries
bb2d169700 use is_multiple_of to check if an addr is aligned 2025-07-07 17:08:03 +00:00
mejrs
429deed03a Port #[rustc_dummy] 2025-07-07 18:16:09 +02:00
Bastian Kersting
b4e68e212e Respect endianness correctly in CheckEnums test suite
The endianness can change the test expectation for the enum check.
This change is fixing the failing tests on big endian by changing
the tests so that they behave the same as on little endian.
2025-07-07 17:58:44 +02:00
Ralf Jung
e296e6bdfe move our data structures into a central location 2025-07-07 17:53:28 +02:00
Eric Huss
2cb24783f5 Fix missing words in future tracking issue
Fixes some sloppy editing on my part.
2025-07-07 08:40:04 -07:00
Chris Denton
2412f8921c UWP: link ntdll functions using raw-dylib 2025-07-07 15:39:31 +00:00
David Barsky
7fbbdb6295 Merge pull request #20185 from ChayimFriedman2/variant-symbols
feat: Include enum variants in world symbols
2025-07-07 15:15:27 +00:00
Makai
be9669f8f4 fix the link in rustdoc.md 2025-07-07 15:12:37 +00:00
Jared Davis
1f36d4df93 run cargo dev fmt on changes 2025-07-07 11:08:45 -04:00
Jared Davis
2b93d2cca6 skip exit late lint pass on tests
When using the `--test` or `--all-targets` flag, the exit lint should not fail on the main function.
2025-07-07 10:38:29 -04:00
bors
1b0bc594a7 Auto merge of #143582 - jieyouxu:rollup-8t9mhfj, r=jieyouxu
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#143130 (doc(std): clarify `NonZero<T>` usage limitation in doc comment)
 - rust-lang/rust#143415 (Get rid of build-powerpc64le-toolchain.sh)
 - rust-lang/rust#143464 (Make tests/ui/abi/debug.rs cross-compile)
 - rust-lang/rust#143482 (Fix short linker error output)
 - rust-lang/rust#143524 (Move `stable_mir` back to its own crate)
 - rust-lang/rust#143528 (interpret: rename StackPopCleanup)
 - rust-lang/rust#143551 (Dont resolve instance of root in `mir_callgraph_cyclic`)
 - rust-lang/rust#143558 (mbe: Refactors and function extractions in `compile_declarative_macro`)
 - rust-lang/rust#143563 (std: fix typo in `std::path`)
 - rust-lang/rust#143564 (compiler: Deduplicate `must_emit_unwind_tables()` comments)
 - rust-lang/rust#143577 (Disable download-rustc for library profile)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-07 14:20:33 +00:00
Ralf Jung
1a6eff747f const-block-as-pattern: do not refer to no-longer-existing nightly feature 2025-07-07 16:18:41 +02:00
Jakub Beránek
37115f1bd6 Fix wrong cache event query key 2025-07-07 15:16:42 +02:00
Yotam Ofek
3b48407f93 Remove unused allow attrs 2025-07-07 12:58:16 +00:00
Pavel Grigorenko
4f0b0b0f01 Port #[rustc_std_internal_symbol] to the new attribute system 2025-07-07 14:59:52 +03:00
Pavel Grigorenko
5d7771e50d Port #[ffi_pure] to the new attribute system 2025-07-07 14:59:01 +03:00
Deadbeef
be6cd11d1b make Machine::load_mir infallible
it doesn't need to return an `InterpResult`.
2025-07-07 19:57:04 +08:00
Folkert de Vries
6d58a88c3c loop_match: fix 'no terminator on block' 2025-07-07 13:55:40 +02:00
Pavel Grigorenko
99a9fe1b22 Port #[ffi_const] to the new attribute system 2025-07-07 14:52:52 +03:00
许杰友 Jieyou Xu (Joe)
364dbd61f2 Rollup merge of #143577 - Noratrieb:Noratrieb-patch-4, r=Kobzol
Disable download-rustc for library profile

The feature currently completely breaks `x test` (rust-lang/rust#142505), core functionality of working on the standard library. Therefore it should be disabled by default until that problem is fixed. Having to wait a bit longer for a check build is nothing compared to completely mysterious build errors when testing.
2025-07-07 19:45:44 +08:00
许杰友 Jieyou Xu (Joe)
0938cb779f Rollup merge of #143564 - Enselic:must_emit_unwind_tables-comment, r=oli-obk
compiler: Deduplicate `must_emit_unwind_tables()` comments

There is one comment at a call site and one comment in the function definition that are mostly saying the same thing. Fold the call site comment into the function definition comment to reduce duplication.

There are actually some inaccuracies in the comments but let's deduplicate before we address the inaccuracies.
2025-07-07 19:45:43 +08:00
许杰友 Jieyou Xu (Joe)
e366f16b16 Rollup merge of #143563 - xizheyin:fix-typo, r=joshtriplett
std: fix typo in `std::path`

I noticed that most of the document used `'` instead of `’`, so I adjusted it.

r? `@ibraheemdev`
2025-07-07 19:45:43 +08:00
许杰友 Jieyou Xu (Joe)
4be8c49cdc Rollup merge of #143558 - joshtriplett:mbe-refactors, r=SparrowLii
mbe: Refactors and function extractions in `compile_declarative_macro`

These refactors help pave the way for parsing attribute rules.

Best reviewed commit-by-commit.

- **mbe: Simplify compile_declarative_macro by factoring out some variables**
- **mbe: Factor out a helper to check an LHS**
- **mbe: Factor out a helper to check for unexpected EOF in definition**
- **mbe: Clarify comments about error handling in `compile_declarative_macro`**
2025-07-07 19:45:42 +08:00
许杰友 Jieyou Xu (Joe)
b6015a68de Rollup merge of #143551 - compiler-errors:root-sub, r=cjgillot
Dont resolve instance of root in `mir_callgraph_cyclic`

`Instance::try_resolve` on a default trait body method will always fail, since it's still possible to further substitute. This leads to a cycle, since in `tests/mir-opt/inline_default_trait_body.rs`, both `Trait::a` and `Trait::b` need to consider the other to be cyclical, but since we couldn't resolve a body, we'd just consider *nothing* to be cyclical.

The root instance we care about when computing `mir_callgraph_cyclic` is trivial to compute (it's just `InstanceKind::Item`), so just replace it with a call to `Instance::new_raw`.

r? `@cjgillot` `@oli-obk`

Fixes rust-lang/rust#143534
2025-07-07 19:45:41 +08:00
许杰友 Jieyou Xu (Joe)
eed55947ac Rollup merge of #143528 - RalfJung:stack-pop-cleanup, r=oli-obk
interpret: rename StackPopCleanup

The name `StackPopCleanup` stopped making sense a long time ago IMO -- in the common case, it has nothing to do with "cleanup", and everything with where the program should jump next. If we didn't have unwinding this would be just the return block, but given that we do have unwinding I figured maybe "continuation" would be a good name. This comes up in [continuation-passing style](https://en.wikipedia.org/wiki/Continuation-passing_style) and refers to where the program will *continue* when a function is done. So from a PL perspective it is the most fitting term I think -- but it may be too jargony.

r? `@oli-obk` what do you think?
2025-07-07 19:45:41 +08:00
许杰友 Jieyou Xu (Joe)
02aa4ff12f Rollup merge of #143524 - makai410:smir-move-back, r=oli-obk
Move `stable_mir` back to its own crate

We've finished the refactoring, so it's time to move `stable_mir` back to its own crate.

This PR leaves an empty `rustc_internal` module with a `#[deprecated]` attribute in `rustc_smir` to let users know we just moved it to `stable_mir`.
2025-07-07 19:45:40 +08:00
许杰友 Jieyou Xu (Joe)
4ba4b5f24f Rollup merge of #143482 - ia0:fix, r=fee1-dead
Fix short linker error output

This PR does 2 things:

- It removes the braces when there's a single element. This is required since brace expansion (at least in bash and zsh) only triggers if there's at least 2 elements.

- It removes the extra `.rlib` suffixes of the elements. See https://github.com/rust-lang/rust/pull/135707#discussion_r2185212393 for context.

Running `cargo +stage1 build` on the following program:

```rust
unsafe extern "C" {
    fn foo() -> libc::c_int;
}

fn main() {
    let x = unsafe { foo() } as u32;
    // println!("{}", data_encoding::BASE64.encode(&x.to_le_bytes()));
}
```

Gives the following diff before and after the PR:

```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib}.rlib
+/tmp/foo/target/debug/deps/liblibc-faf416f178830595.rlib
```

Running on the same program with the additional dependency, we get the following diff:

```diff
-/tmp/foo/target/debug/deps/{liblibc-faf416f178830595.rlib,libdata_encoding-84bb5aadfa9e8839.rlib}.rlib
+/tmp/foo/target/debug/deps/{liblibc-faf416f178830595,libdata_encoding-84bb5aadfa9e8839}.rlib
```
2025-07-07 19:45:40 +08:00
许杰友 Jieyou Xu (Joe)
fc13c96ca6 Rollup merge of #143464 - workingjubilee:make-debug-rs-cross-compile, r=oli-obk
Make tests/ui/abi/debug.rs cross-compile

Resumption of rust-lang/rust#141979, making the test cross-compile.
2025-07-07 19:45:39 +08:00
许杰友 Jieyou Xu (Joe)
9c6ef43341 Rollup merge of #143415 - Gelbpunkt:cleanup-dist-ppc64le-toolchain, r=marcoieni
Get rid of build-powerpc64le-toolchain.sh

The dist-powerpc64le-linux-musl runner never actually used the toolchain that the script produced, it instead used the one from crosstool-ng.

The dist-powerpc64le-linux-gnu runner did use it, from what I can tell mainly to get a glibc 2.17 version with ppc64le support backported. Since crosstool-ng has the necessary patches, we can just use crosstool-ng to get an appropriate toolchain. While at it, use kernel 3.10 headers since that's the version documented in platform support for this target.

try-job: dist-powerpc64le-linux-gnu
try-job: dist-powerpc64le-linux-musl
2025-07-07 19:45:39 +08:00