1
Fork 0
Commit graph

286843 commits

Author SHA1 Message Date
Nicholas Nethercote
5fb0f570f5 Avoid another kw::Empty use.
`sym::dummy` also appears to work.
2025-04-15 15:34:20 +10:00
Nicholas Nethercote
31320a925f Remove another kw::Empty use in rustdoc.
Again by using `Option<Symbol>` to represent "no name".
2025-04-15 15:34:18 +10:00
bors
58c2dd9a54 Auto merge of #139826 - matthiaskrgr:rollup-0q0qvkd, r=matthiaskrgr
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-15 04:50:15 +00:00
Zalathar
e3d6813920 compiletest: Add an experimental new executor to replace libtest
The new executor can be enabled by passing `--new-executor` or `-n` to
compiletest.

For example: `./x test ui -- -n`
2025-04-15 13:00:36 +10:00
Zalathar
6fda3e52c9 compiletest: Extract libtest-specific executor code to a submodule 2025-04-15 12:36:45 +10:00
Zalathar
4c23295dd9 Use a constant for unstable features needed by compiletest 2025-04-15 12:36:45 +10:00
Wesley Wiser
e216915295 Stabilize -Zdwarf-version as -Cdwarf-version 2025-04-14 21:26:41 -05:00
Nicholas Nethercote
e53f2a01ce Remove some kw::Empty uses in rustdoc.
Some `unwrap` uses here, but they are on paths involving item kinds that
are known to have an identifier.
2025-04-15 12:26:37 +10:00
Glyn Normington
1376810d44 Basic tests of MPMC receiver cloning
Ref: https://github.com/rust-lang/rust/issues/126840#issuecomment-2802321146
2025-04-15 02:37:57 +01:00
Nicholas Nethercote
16670e1676 Fix HIR pretty-printing of fns with just a variadic arg.
Avoid the extraneous comma.
2025-04-15 10:41:10 +10:00
Nicholas Nethercote
f8edc831ca Pretty-print PatKind::Missing as _.
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-15 10:40:58 +10:00
binarycat
9676d4aeb7 std: add Output::exit_ok
approved in ACP https://github.com/rust-lang/libs-team/issues/554
2025-04-14 19:11:31 -05:00
Josh Stone
c2712bcd2d 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.
2025-04-14 16:13:04 -07:00
Nicholas Nethercote
78599d83e7 Move name field from AssocItem to AssocKind variants.
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-15 08:07:15 +10:00
Nicholas Nethercote
89e93a51c8 Move two methods from AssocKind to AssocItem.
Because all the other similar methods are on `AssocItem`.
2025-04-15 08:07:15 +10:00
Nicholas Nethercote
b26f3d4347 Move opt_rpitit_info field to hir::AssocKind::Type.
From `hir::AssocItem`.
2025-04-15 08:06:59 +10:00
Matthias Krüger
8587c95bc6
Rollup merge of #139813 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`

Fixes build failures on macOS
2025-04-14 21:55:41 +02:00
Matthias Krüger
04d10520f0
Rollup merge of #139811 - yotamofek:pr/newtype_cleanups, r=oli-obk
Use `newtype_index!`-generated types more idiomatically

Continuation of sorts of #139674
Shouldn't affect anything, just makes some code simpler
2025-04-14 21:55:40 +02:00
Matthias Krüger
7dc3feccdd
Rollup merge of #139799 - clubby789:print=file, r=jieyouxu
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-14 21:55:39 +02:00
Matthias Krüger
1bceed826e
Rollup merge of #139797 - folkertdev:naked-allow-unsafe, r=tgross35
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-14 21:55:39 +02:00
Matthias Krüger
6b3531e915
Rollup merge of #139783 - jieyouxu:ignore-dir, r=Zalathar
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-14 21:55:38 +02:00
Matthias Krüger
bf247c7086
Rollup merge of #139778 - reddevilmidzy:add-success-test, r=lcnr
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-14 21:55:38 +02:00
Matthias Krüger
9b564dfc1d
Rollup merge of #139757 - ognevny:opt-dist-hostllvm, r=Kobzol
opt-dist: use executable-extension for host llvm-profdata

because it's used for target llvm-profdata too

r? Kobzol
2025-04-14 21:55:37 +02:00
Matthias Krüger
efca25fddc
Rollup merge of #139745 - thaliaarchi:iter-unused-clone-copy, r=joboet
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-14 21:55:37 +02:00
bors
2da29dbe8f Auto merge of #139577 - davidtwco:sizedness-go-vroom, r=oli-obk
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-14 19:54:27 +00:00
Chris Denton
1d757833c6
Remove safe remove 2025-04-14 18:47:15 +00:00
Folkert de Vries
cb22c1d5e9
Allow (but don't require) #[unsafe(naked)] so that compiler-builtins can upgrade to it 2025-04-14 20:44:15 +02:00
0x79de
188d44dd6e 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-14 21:25:48 +03:00
Michael Goulet
3df7882272 Normalize ADT fields in find_tails_for_unsizing 2025-04-14 16:51:00 +00:00
bors
990039ec53 Auto merge of #139814 - matthiaskrgr:rollup-lxkkcz6, r=matthiaskrgr
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-14 16:45:11 +00:00
Yotam Ofek
4b63362f3d Use newtype_index!-generated types more idiomatically 2025-04-14 16:17:06 +00:00
Matthias Krüger
47e5b18f33
Rollup merge of #139807 - Kobzol:post-merge-report-wording, r=marcoieni
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-14 18:15:34 +02:00
Matthias Krüger
b70e119e37
Rollup merge of #139804 - WaffleLapkin:real, r=jieyouxu
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)
2025-04-14 18:15:34 +02:00
Matthias Krüger
06d0ea7c33
Rollup merge of #139801 - clubby789:clubby-mailmap, r=jieyouxu
Add myself to mailmap
2025-04-14 18:15:33 +02:00
Matthias Krüger
470e4de1da
Rollup merge of #139796 - RalfJung:usize-backtics, r=jieyouxu
ptr docs: add missing backtics around 'usize'

We almost always have the backticks, except here... so let's just fix that. Barely worth a PR but it's user-visible docs so here we go.
2025-04-14 18:15:33 +02:00
Matthias Krüger
87c319a770
Rollup merge of #139777 - compiler-errors:debuggier-proj, r=lcnr
Remove `define_debug_via_print` for `ExistentialProjection`, use regular structural debug impl

The pretty print impl for `ExistentialProjection` always prints `AssocItem = Ty`:

6e83046233/compiler/rustc_middle/src/ty/print/pretty.rs (L3293-L3299)

We can't change this, b/c it's used for both pretty printing dyn types and for legacy symbol mangling.

Unfortunately, we also use this printing procedure for `Debug` impls. That means that it leaves out the *trait name* and *trait args* when debug printing an `ExistentialProjection` (or an `ExistentialPredicate` which has a variant for `ExistentialProjection`). This leads to awkward situations, like the two seemingly identical existential projection predicates present in a `dyn Trait` type using the definition below:

```rust
trait Super { type Assoc; }

trait Foo: Super<A, Assoc = i32> + Super<B, Assoc = i32> {}
```

Namely, they both just render as `Projection(Assoc = i32)`! This makes debugging `dyn Trait` type system bugs really hard, so let's use the *regular* debug impl for `ExistentialProjection`.
2025-04-14 18:15:32 +02:00
Matthias Krüger
143f5d7696
Rollup merge of #139767 - compiler-errors:www, r=oli-obk
Visit place in `BackwardIncompatibleDropHint` statement

Remove a weird hack from the `LocalUpdater` where we were manually visiting the place stored in a `StatementKind::BackwardIncompatibleDropHint` because the MIR visitor impls weren't doing so.

Also, clean up `BackwardIncompatibleDropHint`s in `CleanupPostBorrowck`, since they're not needed for runtime MIR.
2025-04-14 18:15:32 +02:00
Matthias Krüger
bf49dfc943
Rollup merge of #139392 - compiler-errors:raw-expr, r=oli-obk
Detect and provide suggestion for `&raw EXPR`

When emitting an error in the parser, and we detect that the previous token was `raw` and we *could* have consumed `const`/`mut`, suggest that this may have been a mistyped raw ref expr. To do this, we add `const`/`mut` to the expected token set when parsing `&raw` as an expression (which does not affect the "good path" of parsing, for the record).

This is kind of a rudimentary error improvement, since it doesn't actually attempt to recover anything, leading to some other knock-on errors b/c we still treat `&raw` as the expression that was parsed... but at least we add the suggestion! I don't think the parser grammar means we can faithfully recover `&raw EXPR` early, i.e. during `parse_expr_borrow`.

Fixes #133231
2025-04-14 18:15:31 +02:00
Matthias Krüger
a4adc005a1
Rollup merge of #139127 - compiler-errors:prim-ty-hack, r=oli-obk
Fix up partial res of segment in primitive resolution hack

There is a hack in the resolver:

```
// In `a(::assoc_item)*` `a` cannot be a module. If `a` does resolve to a module we
// don't report an error right away, but try to fallback to a primitive type.
```

This fixes up the resolution for primitives which would otherwise resolve to a module, but we weren't also updating the res of the path segment, leading to weird diagnostics.

We explicitly call `self.r.partial_res_map.insert` instead of `record_partial_res` b/c we have recorded a partial res already, and we specifically want to override it.

cc https://github.com/rust-lang/rust/issues/139095#issuecomment-2764371934
2025-04-14 18:15:30 +02:00
Ralf Jung
758e99a800 update lockfile 2025-04-14 17:43:14 +02:00
Michael Goulet
83ea3454df Remove define_debug_via_print for ExistentialProjection 2025-04-14 15:37:31 +00:00
Mara Bos
1f3199c899 Disable some r-a tests in bootstrap. 2025-04-14 16:53:24 +02:00
Michael Goulet
13b4734e31 Derive Obligation's fold impls 2025-04-14 14:47:59 +00:00
Oli Scherer
7ad16974b9 Allow const patterns of matches to contain pattern types 2025-04-14 14:27:35 +00:00
Jakub Beránek
3da0a19a29
Improve wording of post-merge report 2025-04-14 16:27:33 +02:00
clubby789
1b46969a11 Specify --print info=file syntax in --help 2025-04-14 14:52:27 +01:00
Waffle Lapkin
d5de2fa8bb
use realpath in bootstrap.py when creating build-dir
this avoids crashes when `./build` is a symlink to a non-existent
directory.
2025-04-14 15:37:12 +02:00
bors
07d3fd1d9b Auto merge of #138603 - xizheyin:issue-137405, r=chenyukang
Report line number of test when should_panic test failed

Closes #137405

---

try-job: x86_64-gnu-llvm-19-3
try-job: test-various
2025-04-14 13:33:44 +00:00
clubby789
dc584580f3 Add myself to mailmap 2025-04-14 14:27:15 +01:00
lcnr
9c88eb6c43 normalize: prefer ParamEnv over AliasBound 2025-04-14 14:46:48 +02:00