about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-04-15Fix wrong suggestion for async gen block and add regression ui test for #139839Guillaume Gomez-4/+126
2025-04-15Auto merge of #139632 - Darksonn:cfi-fmt, r=m-ou-sebors-25/+50
cfi: do not transmute function pointers in formatting code Follow-up to #115954. Addresses #115199 point 2. Related to #128728. Discussion [on the LKML](https://lore.kernel.org/all/20250410115420.366349-1-panikiel@google.com/). cc `@maurer` `@rcvalle` `@RalfJung`
2025-04-15Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalatharbors-993/+2498
Rollup of 17 pull requests Successful merges: - #138374 (Enable contracts for const functions) - #138380 (ci: add runners for vanilla LLVM 20) - #138393 (Allow const patterns of matches to contain pattern types) - #139517 (std: sys: process: uefi: Use NULL stdin by default) - #139554 (std: add Output::exit_ok) - #139660 (compiletest: Add an experimental new executor to replace libtest) - #139669 (Overhaul `AssocItem`) - #139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}) - #139750 (std/thread: Use default stack size from menuconfig for NuttX) - #139772 (Remove `hir::Map`) - #139785 (Let CStrings be either 1 or 2 byte aligned.) - #139789 (do not unnecessarily leak auto traits in item bounds) - #139791 (drop global where-bounds before merging candidates) - #139798 (normalize: prefer `ParamEnv` over `AliasBound` candidates) - #139822 (Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix) - #139833 (Fix some HIR pretty-printing problems) - #139836 (Basic tests of MPMC receiver cloning) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-15Add commentAlice Ryhl-0/+19
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-04-15Use full path for core::mem::transmuteAlice Ryhl-2/+2
Suggested-by: Tamir Duberstein <tamird@gmail.com> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
2025-04-15Remove #![feature(no_sanitize)]Tamir Duberstein-1/+0
2025-04-15Rollup merge of #139836 - glyn:test-mpmc-receiver-cloning, r=jhprattStuart Cook-0/+30
Basic tests of MPMC receiver cloning Ref: https://github.com/rust-lang/rust/issues/126840#issuecomment-2802321146
2025-04-15Rollup merge of #139833 - nnethercote:fix-139633, r=oli-obkStuart Cook-4/+59
Fix some HIR pretty-printing problems r? `@oli-obk`
2025-04-15Rollup merge of #139822 - 0x79de:fix-eopnotsupp-mapping, r=dtolnayStuart Cook-0/+1
Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized. Fixes #139803
2025-04-15Rollup merge of #139798 - lcnr:where-bounds-gt-alias-bound, r=compiler-errorsStuart Cook-21/+59
normalize: prefer `ParamEnv` over `AliasBound` candidates cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/175 not the only issue affecting bevy sadly r? ``@compiler-errors``
2025-04-15Rollup merge of #139791 - lcnr:ignore-global-where-bounds, r=compiler-errorsStuart Cook-6/+93
drop global where-bounds before merging candidates fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/172 r? ```@compiler-errors```
2025-04-15Rollup merge of #139789 - lcnr:opaques-auto-trait-leakage, r=compiler-errorsStuart Cook-7/+285
do not unnecessarily leak auto traits in item bounds fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/158 Not a fix for https://github.com/rust-lang/trait-system-refactor-initiative/issues/173 as you may have realized/tried yourself, cc #139788. However, fixing this feels desirable regardless and I don't see any reason not to. r? ```@compiler-errors```
2025-04-15Rollup merge of #139785 - fneddy:fix_test_cstring_merging_alignment, ↵Stuart Cook-1/+1
r=Mark-Simulacrum Let CStrings be either 1 or 2 byte aligned. We see a regression on the `tests/assembly/cstring-merging.rs` test on s390x. Some architectures (like s390x) require strings to be 2 byte aligned. Therefor the section name will be marked with a .2 postfix on this architectures. Allowing a section name with a .1 or .2 postfix will make the test pass on either platform.
2025-04-15Rollup merge of #139772 - nnethercote:rm-hir-Map, r=ZalatharStuart Cook-65/+36
Remove `hir::Map` A follow-up to https://github.com/rust-lang/rust/pull/139232. r? `@Zalathar`
2025-04-15Rollup merge of #139750 - no1wudi:fix, r=tgross35Stuart Cook-6/+11
std/thread: Use default stack size from menuconfig for NuttX * Update comments to clarify the usage of zero as an indication for default stack size configuration * Adjust conditional compilation to reflect the changes in stack size handling for the NuttX platform This change improves clarity and consistency in stack size configuration across platforms.
2025-04-15Rollup merge of #139671 - m-ou-se:proc-macro-span, r=dtolnayStuart Cook-165/+76
Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file} Simplification/redesign of the unstable proc macro span API, tracked in https://github.com/rust-lang/rust/issues/54725: Before: ```rust impl Span { pub fn line(&self) -> usize; pub fn column(&self) -> usize; pub fn source_file(&self) -> SourceFile; } #[derive(Clone, Debug, PartialEq, Eq)] pub struct SourceFile { .. } impl !Send for SourceFile {} impl !Sync for SourceFile {} impl SourceFile { pub fn path(&self) -> PathBuf; pub fn is_real(&self) -> bool; } ``` After: ```rust impl Span { pub fn line(&self) -> usize; pub fn column(&self) -> usize; pub fn file(&self) -> String; // Mapped file name, for display purposes. pub fn local_file(&self) -> Option<PathBuf>; // Real file name as it exists on disk. } ``` This resolves the last blocker for stabilizing these methods. (Stabilizing will be a separate PR with FCP.)
2025-04-15Rollup merge of #139669 - nnethercote:overhaul-AssocItem, r=oli-obkStuart Cook-546/+609
Overhaul `AssocItem` `AssocItem` has multiple fields that only make sense some of the time. E.g. the `name` can be empty if it's an RPITIT associated type. It's clearer and less error prone if these fields are moved to the relevant `kind` variants. r? ``@fee1-dead``
2025-04-15Rollup merge of #139660 - Zalathar:new-executor, r=jieyouxuStuart Cook-117/+574
compiletest: Add an experimental new executor to replace libtest This PR adds a new "executor" to compiletest for running the list of collected tests, to eventually replace the current dependency on unstable libtest internals. The new executor is currently inactive by default. It must be activated explicitly by passing `-n` or `--new-executor` to compiletest, e.g. `./x test ui -- -n`. (After some amount of wider manual testing, the new executor will hopefully be made the default, and the libtest dependency can be removed. Contributors should not notice any change.) The new executor is a stripped-down rewrite of the subset of libtest needed by compiletest. # Supported functionality - Specifying the number of concurrent tests with `RUST_TEST_THREADS` - Filtering and skipping tests by name (substring or exact-match) - Forcibly running ignored tests with `--ignored` - Optional fail-fast with `--fail-fast` - JSON output, compatible with bootstrap's parser for libtest output - Running each test in its own thread - Short backtraces that ignore the executor itself - Slow test detection, with a hard-coded timeout of 60 seconds - Capturing stdout/stderr, via `#![feature(internal_output_capture)]` - Suppressing output capture with `--no-capture` # Unsupported functionality - Non-JSON output, as this is handled by bootstrap instead - Separate code path for concurrency=1, as the concurrent path should handle this case naturally - Fallback to running tests synchronously if new threads can't be spawned - Special handling of hosts that don't support basic functionality like threads or timers - Our ability to test *targets* should be unaffected - Graceful handling of some edge cases that could occur in arbitrary user-written unit tests, but would represent bugs in compiletest - Due to the current need for output capture, the new executor is still not entirely written in stable Rust --- r? jieyouxu
2025-04-15Rollup merge of #139554 - lolbinarycat:std-output-exit_ok, r=tgross35Stuart Cook-0/+34
std: add Output::exit_ok approved in ACP https://github.com/rust-lang/libs-team/issues/554 Tracking issue: https://github.com/rust-lang/rust/issues/84908
2025-04-15Rollup merge of #139517 - Ayush1325:uefi-cmd-stdin-null, r=joboetStuart Cook-7/+120
std: sys: process: uefi: Use NULL stdin by default According to the docs in `Command::output`: > By default, stdout and stderr are captured (and used to provide the resulting output). Stdin is not inherited from the parent and any attempt by the child process to read from the stdin stream will result in the stream immediately closing. This was being violated by UEFI which was inheriting stdin by default. While the docs don't explicitly state that the default should be NULL, the behaviour seems like reading from NULL. UEFI however, has a bit of a problem. The `EFI_SIMPLE_TEXT_INPUT_PROTOCOL` only provides support for reading 1 key press. This means that you either get an error, or it is assumed that the keypress was read successfully. So there is no way to have a successful read of length 0. Currently, I am returning UNSUPPORTED error when trying to read from NULL stdin. On linux however, you will get a read of length 0 for Null stdin. One possible way to get around this is to translate one of the UEFI errors to a read 0 (Maybe unsupported?). It is also possible to have a non-standard error code, but well, not sure if we go that route. Alternatively, if meaning of Stdio::Null is platform dependent, it should be fine to keep the current behaviour of returning an error. cc ```@nicholasbishop``` ```@dvdhrm```
2025-04-15Rollup merge of #138393 - oli-obk:pattern-type-in-pattern, r=BoxyUwUStuart Cook-9/+233
Allow const patterns of matches to contain pattern types Trying to pattern match on a type containing a pattern type will currently fail with an ICE ```rust error: internal compiler error: compiler/rustc_mir_build/src/builder/matches/test.rs:459:18: invalid type for non-scalar compare: (u32) is 1.. --> src/main.rs:22:5 | 22 | TWO => {} | ^^^ ``` because the compiler tries to generate a MIR `BinOp(Eq)` operation on a pattern type, which is not supported. While we could support that, there are side effects of allowing this (none that would compile, but the compiler would simultaneously think it could `==` pattern types and that it could not because `PartialEq` is not implemented. So instead I change the logic for pattern matching to transmute pattern types to their base type before comparing. r? ```@BoxyUwU``` cc #123646 ```@scottmcm``` ```@joshtriplett```
2025-04-15Rollup merge of #138380 - cuviper:ci-llvm-20, r=KobzolStuart Cook-0/+94
ci: add runners for vanilla LLVM 20 Ubuntu 25.04 has `llvm-20` packages that we can start testing with. The `Dockerfile` is otherwise the same as the `llvm-18`/`19` runners. try-job: x86_64-gnu-llvm-20-1 try-job: x86_64-gnu-llvm-20-2 try-job: x86_64-gnu-llvm-20-3
2025-04-15Rollup merge of #138374 - celinval:issue-136925-const-contract, ↵Stuart Cook-39/+183
r=compiler-errors,oli-obk,RalfJung Enable contracts for const functions Use `const_eval_select!()` macro to enable contract checking only at runtime. The existing contract logic relies on closures, which are not supported in constant functions. This commit also removes one level of indirection for ensures clauses since we no longer build a closure around the ensures predicate. Resolves #136925 **Call-out:** This is still a draft PR since CI is broken due to a new warning message for unreachable code when the bottom of the function is indeed unreachable. It's not clear to me why the warning wasn't triggered before. r? ```@compiler-errors```
2025-04-15Auto merge of #139826 - matthiaskrgr:rollup-0q0qvkd, r=matthiaskrgrbors-173/+353
Rollup of 8 pull requests Successful merges: - #139745 (Avoid unused clones in `Cloned<I>` and `Copied<I>`) - #139757 (opt-dist: use executable-extension for host llvm-profdata) - #139778 (Add test for issue 34834) - #139783 (Use `compiletest-ignore-dir` for bootstrap self-tests) - #139797 (Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it) - #139799 (Specify `--print info=file` syntax in `--help`) - #139811 (Use `newtype_index!`-generated types more idiomatically) - #139813 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-15compiletest: Add an experimental new executor to replace libtestZalathar-12/+452
The new executor can be enabled by passing `--new-executor` or `-n` to compiletest. For example: `./x test ui -- -n`
2025-04-15compiletest: Extract libtest-specific executor code to a submoduleZalathar-103/+113
2025-04-15Use a constant for unstable features needed by compiletestZalathar-7/+14
2025-04-15Basic tests of MPMC receiver cloningGlyn Normington-0/+30
Ref: https://github.com/rust-lang/rust/issues/126840#issuecomment-2802321146
2025-04-15Fix HIR pretty-printing of fns with just a variadic arg.Nicholas Nethercote-5/+7
Avoid the extraneous comma.
2025-04-15Pretty-print `PatKind::Missing` as `_`.Nicholas Nethercote-3/+56
Printing "no pattern" as `_` isn't ideal, but better than crashing, and HIR pretty-printing already has plenty of imperfections. The added `f2` and `f6` examples are ones that triggered the crash. Note that some of the added examples are printed badly, e.g. `fn(, ...)`. The next commit will fix those. Fixes #139633.
2025-04-14std: add Output::exit_okbinarycat-0/+34
approved in ACP https://github.com/rust-lang/libs-team/issues/554
2025-04-14ci: add runners for vanilla LLVM 20Josh Stone-0/+94
Ubuntu 25.04 has `llvm-20` packages that we can start testing with. The `Dockerfile` is otherwise the same as the `llvm-18`/`19` runners.
2025-04-15Move `name` field from `AssocItem` to `AssocKind` variants.Nicholas Nethercote-231/+276
To accurately reflect that RPITIT assoc items don't have a name. This avoids the use of `kw::Empty` to mean "no name", which is error prone. Helps with #137978.
2025-04-15Move two methods from `AssocKind` to `AssocItem`.Nicholas Nethercote-29/+26
Because all the other similar methods are on `AssocItem`.
2025-04-15Move `opt_rpitit_info` field to `hir::AssocKind::Type`.Nicholas Nethercote-91/+103
From `hir::AssocItem`.
2025-04-14Rollup merge of #139813 - RalfJung:miri-sync, r=RalfJungMatthias Krüger-18/+46
Miri subtree update r? `@ghost` Fixes build failures on macOS
2025-04-14Rollup merge of #139811 - yotamofek:pr/newtype_cleanups, r=oli-obkMatthias Krüger-87/+61
Use `newtype_index!`-generated types more idiomatically Continuation of sorts of #139674 Shouldn't affect anything, just makes some code simpler
2025-04-14Rollup merge of #139799 - clubby789:print=file, r=jieyouxuMatthias Krüger-17/+16
Specify `--print info=file` syntax in `--help` Closes #139794 I moved the listing of information that can be printed to the help string as it's getting rather long and it makes the `[=FILE]` part easier to see
2025-04-14Rollup merge of #139797 - folkertdev:naked-allow-unsafe, r=tgross35Matthias Krüger-28/+34
Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it tracking issue: https://github.com/rust-lang/rust/issues/138997 Per https://github.com/rust-lang/rust/pull/134213#issuecomment-2755984503, we want to make the `#[naked]` attribute an unsafe attribute. Making that change runs into a cyclic dependency with `compiler-builtins` which uses `#[naked]`, where `rustc` needs an updated `compiler-builtins` and vice versa. So based on https://github.com/rust-lang/rust/pull/139753 and [#t-compiler/help > updating &#96;compiler-builtins&#96; and &#96;rustc&#96;](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/updating.20.60compiler-builtins.60.20and.20.60rustc.60), this PR allows, but does not require `#[unsafe(naked)]`, and makes that change for some of the tests to check that both `#[naked]` and `#[unsafe(naked)]` are accepted. Then we can upgrade and synchronize `compiler-builtins`, and then make `#[naked]` (without `unsafe`) invalid. r? `@traviscross` (or someone from t-compiler if you're faster and this look allright)
2025-04-14Rollup merge of #139783 - jieyouxu:ignore-dir, r=ZalatharMatthias Krüger-2/+0
Use `compiletest-ignore-dir` for bootstrap self-tests Follow-up to #139705 and #139740. I did another survey pass over `//@ ignore-test` under `tests/`, and this is the only 2 non-tests that should use `compiletest-ignore-dir`. r? `@Zalathar` (or compiler/bootstrap)
2025-04-14Rollup merge of #139778 - reddevilmidzy:add-success-test, r=lcnrMatthias Krüger-0/+30
Add test for issue 34834 closes: #34834 This PR adds a UI test for a case where a trait with an associated type using a higher-ranked trait bound (HRTB) failed to compile in Rust 1.55.0 but succeeded starting from 1.56.0. ```rust pub trait Provides<'a> { type Item; } pub trait Selector: for<'a> Provides<'a> { type Namespace: PartialEq + for<'a> PartialEq<<Self as Provides<'a>>::Item>; fn get_namespace(&self) -> <Self as Provides>::Item; } pub struct MySelector; impl<'a> Provides<'a> for MySelector { type Item = &'a str; } impl Selector for MySelector { type Namespace = String; fn get_namespace(&self) -> &str { unimplemented!() } } fn main() {} ``` * ❌ [compile fail (rustc: 1.55.0)](https://godbolt.org/z/T1jY1Ebo6) * ⭕ [compile pass (rustc: 1.56.0)](https://godbolt.org/z/e4jo11Ma7)
2025-04-14Rollup merge of #139757 - ognevny:opt-dist-hostllvm, r=KobzolMatthias Krüger-1/+3
opt-dist: use executable-extension for host llvm-profdata because it's used for target llvm-profdata too r? Kobzol
2025-04-14Rollup merge of #139745 - thaliaarchi:iter-unused-clone-copy, r=joboetMatthias Krüger-20/+163
Avoid unused clones in `Cloned<I>` and `Copied<I>` Avoid cloning in `Cloned<I>` or copying in `Copied<I>` when elements are only needed by reference or not at all. There is already some precedent for this, given that `__iterator_get_unchecked` is implemented, which can skip elements. The reduced clones are technically observable by a user impl of `Clone`. r? libs-api
2025-04-14Auto merge of #139577 - davidtwco:sizedness-go-vroom, r=oli-obkbors-31/+70
re-use `Sized` fast-path There's an existing fast path for the `type_op_prove_predicate` predicate, checking for trivially `Sized` types, which can be re-used when evaluating obligations within queries. This should improve performance and was found to be beneficial in #137944. r? types
2025-04-14Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can ↵Folkert de Vries-28/+34
upgrade to it
2025-04-14Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix0x79de-0/+1
This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized. Fixes #139803
2025-04-14Auto merge of #139814 - matthiaskrgr:rollup-lxkkcz6, r=matthiaskrgrbors-41/+259
Rollup of 8 pull requests Successful merges: - #139127 (Fix up partial res of segment in primitive resolution hack) - #139392 (Detect and provide suggestion for `&raw EXPR`) - #139767 (Visit place in `BackwardIncompatibleDropHint` statement) - #139777 (Remove `define_debug_via_print` for `ExistentialProjection`, use regular structural debug impl) - #139796 (ptr docs: add missing backtics around 'usize') - #139801 (Add myself to mailmap) - #139804 (use `realpath` in `bootstrap.py` when creating build-dir) - #139807 (Improve wording of post-merge report) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-14Use `newtype_index!`-generated types more idiomaticallyYotam Ofek-87/+61
2025-04-14Rollup merge of #139807 - Kobzol:post-merge-report-wording, r=marcoieniMatthias Krüger-11/+15
Improve wording of post-merge report Slight changes to improve the rendered output e.g. [here](https://github.com/rust-lang/rust/pull/139241#issuecomment-2801733750) if only doctest changes were found. r? `@marcoieni`
2025-04-14Rollup merge of #139804 - WaffleLapkin:real, r=jieyouxuMatthias Krüger-1/+1
use `realpath` in `bootstrap.py` when creating build-dir Fixes #139800 r? `@jieyouxu` My use case for `./build` being a symlink is this: my "default" ~~partition~~ btrfs subvolume is snapshotted/backed up. I don't want to backup target-likes, so I move them to a special subvolume which isn't backed up. `./build` is a symlink into that subvolume. (`build.build-dir` configuration is not fully sufficient, it is still nice to be able to check build files with `ls ./build` or call tools from there)