1
Fork 0
Commit graph

284846 commits

Author SHA1 Message Date
Jesus Checa Hidalgo
20432c9eee Use explicit cpu in some asm and codegen tests.
Some tests expect to be compiled for a specific CPU or require certain
target features to be present (or absent). These tests work fine with
default CPUs but fail in downstream builds for RHEL and Fedora, where
we use non-default CPUs such as z13 on s390x, pwr9 on ppc64le, or
x86-64-v2/x86-64-v3 on x86_64.
2025-03-19 19:45:46 +01:00
Mara Bos
25896cc668 Add cfg(not(bootstrap)) for new test. 2025-03-19 18:08:23 +01:00
lcnr
cfc78cec79 merge opaque types of nested bodies 2025-03-19 17:52:53 +01:00
Mara Bos
93d5ca82b0 Pin tests. 2025-03-19 17:42:43 +01:00
Jana Dönszelmann
7c085f7ffd
add rustc_macro_edition_2021 2025-03-19 17:37:35 +01:00
lcnr
f8fe978fab remove unnecessary loop 2025-03-19 17:32:21 +01:00
Scott McMurray
35248c6830 Add chaining versions of lt/le/gt/ge and use them in tuple PartialOrd 2025-03-19 09:27:02 -07:00
Scott McMurray
b54ca0e433 Add a MIR pre-codegen test for tuple comparisons
We have codegen ones, but it looks like we could make those less flakey by just doing something better in the first place...
2025-03-19 09:13:41 -07:00
Manish Goregaokar
48ce25ea0e
Add MSRV check for question_mark (#14436)
changelog: [`question_mark`]: Now respects the [`msrv`] configuration
2025-03-19 15:56:45 +00:00
Matthias Krüger
966021d00a
Rollup merge of #138613 - m-ou-se:no-more-e0773, r=jdonszelmann,petrochenkov
Remove E0773 "A builtin-macro was defined more than once."

Error E0773 "A builtin-macro was defined more than once" is triggered when using the same `#[rustc_builtin_macro(..)]` twice. However, it can only be triggered in unstable code (using a `rustc_` attribute), and there doesn't seem to be any harm in using the same implementation from `compiler/rustc_builtin_macros/…` for multiple macro definitions.

By changing the Box to an Arc in `SyntaxExtensionKind`, we can throw away the `BuiltinMacroState::{NotYetSeen, AlreadySeen}` logic, simplifying things.
2025-03-19 16:52:58 +01:00
Matthias Krüger
9ab2a0e353
Rollup merge of #138594 - oli-obk:no-select, r=lcnr
Fix next solver handling of shallow trait impl check

I'm trying to remove unnecessary direct calls to `select`, and this one seemed like a good place to start 😆

r? `@compiler-errors` or `@lcnr`
2025-03-19 16:52:57 +01:00
Matthias Krüger
c3f74bcb39
Rollup merge of #138589 - zachs18:block-label-not-supported-here-loop-body-help, r=petrochenkov
If a label is placed on the block of a loop instead of the header, suggest moving it to the header.

Fixes #138585

If a label is placed on the block of a loop instead of the header, suggest to the user moving it to the loop header instead of ~~suggesting to remove it~~ emitting a tool-only suggestion to remove it.

```rs
fn main() {
    loop 'a: { return; }
}
```

```diff
 error: block label not supported here
  --> src/main.rs:2:10
   |
 2 |     loop 'a: { return; }
   |          ^^^ not supported here
+  |
+help: if you meant to label the loop, move this label before the loop
+  |
+2 -     loop 'a: { return; }
+2 +     'a: loop { return; }
+  |
```

Questions for reviewer:

* The "desired output" in the linked issue had the main diagnostic be "misplaced loop label". Should the main diagnostic message the changed instead of leaving it as "block label not supported here"?
* Should this be `Applicability::MachineApplicable`?
2025-03-19 16:52:56 +01:00
Matthias Krüger
2df731d586
Rollup merge of #138540 - okaneco:const_split_off_first_last, r=m-ou-se
core/slice: Mark some `split_off` variants unstably const

Tracking issue: #138539

Add feature gate `#![feature(const_split_off_first_last)]`
Mark `split_off_first`, `split_off_first_mut`, `split_off_last`, and `split_off_last_mut` slice methods unstably const
2025-03-19 16:52:55 +01:00
Matthias Krüger
2ab69b898a
Rollup merge of #138001 - meithecatte:privately-uninhabited, r=Nadrieril
mir_build: consider privacy when checking for irrefutable patterns

This PR fixes #137999.

Note that, since this makes the compiler reject code that was previously accepted, it will probably need a crater run.

I include a commit that factors out a common code pattern into a helper function, purely because the fact that this was repeated all over the place was bothering me. Let me know if I should split that into a separate PR instead.
2025-03-19 16:52:54 +01:00
Matthias Krüger
ce76292014
Rollup merge of #137051 - thaliaarchi:io-optional-impls/empty, r=m-ou-se
Implement default methods for `io::Empty` and `io::Sink`

Implements default methods of `io::Read`, `io::BufRead`, and `io::Write` for `io::Empty` and `io::Sink`. These implementations are equivalent to the defaults, except in doing less unnecessary work.

`Read::read_to_string` and `BufRead::read_line` both have a redundant call to `str::from_utf8` which can't be inlined from `core` and `Write::write_all_vectored` has slicing logic which can't be simplified (See on [Compiler Explorer](https://rust.godbolt.org/z/KK6xcrWr4)). The rest are optimized to the minimal with `-C opt-level=3`, but this PR gives that benefit to unoptimized builds.

This includes an implementation of `Write::write_fmt` which just ignores the `fmt::Arguments<'_>`. This could be problematic whenever a user formatting impl is impure, but the docs do not guarantee that the args will be expanded.

Tracked in https://github.com/rust-lang/rust/issues/136756.

r? `@m-ou-se`
2025-03-19 16:52:53 +01:00
Matthias Krüger
d46cc71f54
Rollup merge of #135394 - clarfonthey:uninit-slices-part-2, r=tgross35
`MaybeUninit` inherent slice methods part 2

These were moved out of #129259 since they require additional libs-api approval. Tracking issue: #117428.

New API surface:

```rust
impl<T> [MaybeUninit<T>] {
    // replacing fill; renamed to avoid conflict
    pub fn write_filled(&mut self, value: T) -> &mut [T] where T: Clone;

    // replacing fill_with; renamed to avoid conflict
    pub fn write_with<F>(&mut self, value: F) -> &mut [T] where F: FnMut() -> T;

    // renamed to remove "fill" terminology, since this is closer to the write_*_of_slice methods
    pub fn write_iter<I>(&mut self, iter: I) -> (&mut [T], &mut Self) where I: Iterator<Item = T>;
}
```

Relevant motivation for these methods; see #129259 for earlier methods' motiviations.

* I chose `write_filled` since `filled` is being used as an object here, whereas it's being used as an action in `fill`.
* I chose `write_with` instead of `write_filled_with` since it's shorter and still matches well.
* I chose `write_iter` because it feels completely different from the fill methods, and still has the intent clear.

In all of the methods, it felt appropriate to ensure that they contained `write` to clarify that they are effectively just special ways of doing `MaybeUninit::write` for each element of a slice.

Tracking issue: https://github.com/rust-lang/rust/issues/117428

r? libs-api
2025-03-19 16:52:52 +01:00
bors
1aeb99d248 Auto merge of #122156 - Zoxc:side-effect-dep-node, r=oli-obk
Represent diagnostic side effects as dep nodes

This changes diagnostic to be tracked as a special dep node (`SideEffect`) instead of having a list of side effects associated with each dep node. `SideEffect` is always red and when forced, it emits the diagnostic and marks itself green. Each emitted diagnostic generates a new `SideEffect` with an unique dep node index.

Some implications of this:

- Diagnostic may now be emitted more than once as they can be emitted once when the `SideEffect` gets marked green and again if the task it depends on needs to be re-executed due to another node being red. It relies on deduplicating of diagnostics to avoid that.

- Anon tasks which emits diagnostics will no longer *incorrectly* be merged with other anon tasks.

- Reusing a CGU will now emit diagnostics from the task generating it.
2025-03-19 15:51:54 +00:00
Alejandra González
31497d68fb
fix: option_if_let_else FP when value partially moved (#14209)
fixes #13964

The lint `option_map_unwrap_or` used to have a similar issue in #10579,
so I borrowed its solution to fix this one.

changelog: [`option_if_let_else`]: fix FP when value partially moved
2025-03-19 15:34:53 +00:00
Oli Scherer
14cd467001 Fix next solver handling of shallow trait impl check 2025-03-19 14:40:14 +00:00
Oli Scherer
055d31c7a5 Demonstrate next-solver missing diagnostic 2025-03-19 14:38:23 +00:00
Jakub Beránek
9b88fd09d7
Update GCC submodule 2025-03-19 15:35:47 +01:00
Jakub Beránek
b24dc75ee4
Respect --src bootstrap flag
Previously it was simply ignored.
2025-03-19 14:57:06 +01:00
Jakub Beránek
2139a783b0
Fix bug in get_git_modified_files
It was ignoring files without extension.
2025-03-19 14:55:52 +01:00
Jakub Beránek
599dc823c9
Simplify get_git_modified_files
It only ever returned `Some`, so `Option` was useless in its return type.
2025-03-19 14:55:37 +01:00
Mara Bos
6c865c1e14 Allow builtin macros to be used more than once.
This removes E0773 "A builtin-macro was defined more than once."
2025-03-19 14:12:47 +01:00
bors
a7fc463dd8 Auto merge of #138693 - matthiaskrgr:rollup-ejq8mwp, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #136177 (clarify BufRead::{fill_buf, consume} docs)
 - #138654 (Remove the regex dependency from coretests)
 - #138655 (rustc-dev-guide sync)
 - #138656 (Remove double nesting in post-merge workflow)
 - #138658 (CI: mirror alpine and centos images to ghcr)
 - #138659 (coverage: Don't store a body span in `FunctionCoverageInfo`)
 - #138661 (Revert: Add *_value methods to proc_macro lib)
 - #138670 (Remove existing AFIDT implementation)
 - #138674 (Various codegen_llvm cleanups)
 - #138684 (use then in docs for `fuse` to enhance readability)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-19 12:39:34 +00:00
xizheyin
5a52b5d92a Suggest -Whelp when pass --print lints to rustc
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-19 18:48:00 +08:00
Nicholas Nethercote
f27cab806e Use Option<Ident> for lowered param names.
Parameter patterns are lowered to an `Ident` by
`lower_fn_params_to_names`, which is used when lowering bare function
types, trait methods, and foreign functions. Currently, there are two
exceptional cases where the lowered param can become an empty `Ident`.

- If the incoming pattern is an empty `Ident`. This occurs if the
  parameter is anonymous, e.g. in a bare function type.

- If the incoming pattern is neither an ident nor an underscore. Any
  such parameter will have triggered a compile error (hence the
  `span_delayed_bug`), but lowering still occurs.

This commit replaces these empty `Ident` results with `None`, which
eliminates a number of `kw::Empty` uses, and makes it impossible to fail
to check for these exceptional cases.

Note: the `FIXME` comment in `is_unwrap_or_empty_symbol` is removed. It
actually should have been removed in #138482, the precursor to this PR.
That PR changed the lowering of wild patterns to `_` symbols instead of
empty symbols, which made the mentioned underscore check load-bearing.
2025-03-19 20:54:10 +11:00
Nikita Popov
80f8f00fa4 Update to LLVM 20.1.1 2025-03-19 10:36:30 +01:00
bors
c4b38a5967 Auto merge of #138653 - matthiaskrgr:rollup-fwwqmr7, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #136320 (exit: document interaction with C)
 - #138080 (Leave a breadcrumb towards bootstrap config documentation in `bootstrap.toml`)
 - #138301 (Implement `read_buf` for Hermit)
 - #138569 (rustdoc-json: Add tests for `#[repr(...)]`)
 - #138635 (Extract `for_each_immediate_subpat` from THIR pattern visitors)
 - #138642 (Unvacation myself)
 - #138644 (Add `#[cfg(test)]` for Transition in dfa in `rustc_transmute`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-19 09:28:24 +00:00
LuuuXXX
027423d2c4 Fix: add ohos target notes 2025-03-19 17:23:34 +08:00
Jan Verbeek
d793c0abfa Add MSRV check for question_mark 2025-03-19 09:33:58 +01:00
Matthias Krüger
3b7faca09c
Rollup merge of #138684 - bend-n:use_then, r=jhpratt
use then in docs for `fuse` to enhance readability

use the more-idiomatic `then_some` rather than an `if { some } else { none }` for `fused` docs
2025-03-19 08:17:19 +01:00
Matthias Krüger
5661e98058
Rollup merge of #138674 - oli-obk:llvm-cleanups, r=compiler-errors
Various codegen_llvm cleanups

Mostly just adding safe wrappers and deduplicating code
2025-03-19 08:17:19 +01:00
Matthias Krüger
351ba39d54
Rollup merge of #138670 - compiler-errors:remove-afidt, r=oli-obk
Remove existing AFIDT implementation

This experiment will need to be reworked differently; I don't think we'll be going with the `dyn* Future` approach that is currently implemented.

r? oli-obk

Fixes #136286
Fixes #137706
Fixes #137895

Tracking:
* #133119
2025-03-19 08:17:18 +01:00
Matthias Krüger
8b713e2cde
Rollup merge of #138661 - RalfJung:revert-rustc-dev-breakage, r=petrochenkov
Revert: Add *_value methods to proc_macro lib

This reverts https://github.com/rust-lang/rust/pull/136355. That PR caused unexpected breakage:
- the rustc-dev component can no longer be loaded by cargo, which impacts Miri and clippy and likely others
- rustc_lexer can no longer be published to crates.io, which impacts RA

See https://github.com/rust-lang/rust/issues/138647 for context.
Cc `@GuillaumeGomez` `@Amanieu`
2025-03-19 08:17:17 +01:00
Matthias Krüger
00dddc6ecd
Rollup merge of #138659 - Zalathar:no-body-span, r=oli-obk
coverage: Don't store a body span in `FunctionCoverageInfo`

We aren't using this body span for anything truly essential, and having it around will be awkward when we eventually start to support expansion regions, since they aren't necessarily within the main body.
2025-03-19 08:17:17 +01:00
Matthias Krüger
cc06501b4b
Rollup merge of #138658 - marcoieni:mirror-alpine-and-centos, r=Kobzol
CI: mirror alpine and centos images to ghcr
2025-03-19 08:17:16 +01:00
Matthias Krüger
09c28f8d3d
Rollup merge of #138656 - Kobzol:post-merge-unnest, r=marcoieni
Remove double nesting in post-merge workflow

See [this](https://github.com/rust-lang/rust/pull/138630#issuecomment-2732224491) :)

Can be tested with:
```bash
#!/bin/bash

PARENT_COMMIT=493c38ba371929579fe136df26eccd9516347c7a
SHA=259fdb521200c9abba547302fc2c826479ef26b2

printf "<details>\n<summary>What is this?</summary>\n" >> output.log
printf "This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.\n" >> output.log
printf "</details>\n\n" >> output.log

cargo run --release post-merge-report ${PARENT_COMMIT} ${SHA} >> output.log
```

I think that it's better to leave the notice in CI, to avoid generating it in citool, which can also be executed locally.

r? `@marcoieni`
2025-03-19 08:17:16 +01:00
Matthias Krüger
67d3e5e53f
Rollup merge of #138655 - Kobzol:rdg-sync, r=jieyouxu
rustc-dev-guide sync

r? `@jieyouxu`
2025-03-19 08:17:15 +01:00
Matthias Krüger
a4c32b1d18
Rollup merge of #138654 - bjorn3:remove_coretests_regex, r=tgross35
Remove the regex dependency from coretests

It is only used by a single test, yet would take up unnecessary space once stdlib deps get vendored.
2025-03-19 08:17:14 +01:00
Matthias Krüger
b52275fd01
Rollup merge of #136177 - hkBst:patch-24, r=ibraheemdev
clarify BufRead::{fill_buf, consume} docs

Fixes #85394
2025-03-19 08:17:14 +01:00
bors
1370611c0a Auto merge of #138690 - jieyouxu:temp-disable-fuchsia, r=Kobzol
Temporarily disable Fuchsia test job to unblock queue

See <https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/fuchsia.20failure/with/506637259> for efforts to fix the test job.

This PR temporarily disables the Fuchsia test job to unblock the queue, so that neither the Fuchsia maintainers nor T-infra maintainers should feel pressured to fix the job ASAP.

Please feel free to re-enable once the test job is fixed.
FYI `@erickt` since you or other Fuchsia maintainers will need to revert this change to merge Fuchsia test job fixes in the future.

r? infra-ci
2025-03-19 06:16:45 +00:00
Jieyou Xu
351e0f7a31
Temporarily disable Fuchsia test job to unblock queue
See
<https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/fuchsia.20failure/with/506637259>
for efforts to fix the test job.
2025-03-19 13:43:34 +08:00
Caleb Zulawski
3c705b810d Merge commit 'c14f2fc3eb' into sync-from-portable-simd-2025-03-19 2025-03-19 00:58:47 -04:00
bendn
7a8cdf00e6
use then 2025-03-19 10:45:42 +07:00
Eric Holk
2bd7f73c21
Refactor YieldKind so postfix yield must have an expression 2025-03-18 12:19:43 -07:00
Michael Goulet
0a6a0e47d2 Dont consider fields that are forced unstable due to -Zforce-unstable-if-unmarked to be uninhabited 2025-03-18 18:24:02 +00:00
Michael Goulet
f6107ca173 Consider fields to be inhabited if they are unstable 2025-03-18 18:23:36 +00:00
Eric Holk
299e5d0514
Apply suggestions from code review
Co-authored-by: Travis Cross <tc@traviscross.com>
2025-03-18 10:50:33 -07:00