Commit Graph

148864 Commits

Author SHA1 Message Date
Guillaume Gomez
47265df3f0
Rollup merge of #125944 - P1n3appl3:fuchsia, r=lqd
Update fuchsia maintainers

This makes the maintainers list in the docs line up with the current [fuchsia team](https://github.com/rust-lang/team/blob/master/teams/fuchsia.toml).
2024-06-04 21:41:37 +02:00
Guillaume Gomez
1f1b644f25
Rollup merge of #125933 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

6 commits in 85442a608426d3667f1c9458ad457b241a36b569..5228bfac8267ad24659a81b92ec5417976b5edbc
2024-05-29 20:55:49 UTC to 2024-05-27 17:22:03 UTC

- Fix typo in ch10-03 (rust-lang/book#3539)
- Backport changes to ch 9 and 10 (rust-lang/book#3946)
- infra: correctly support preprocessors for nostarch (rust-lang/book#3944)
- Use `<kbd>` instead of `<span class="keystroke">` (rust-lang/book#3945)
- infra: Fix clippy warning in remove_markup (rust-lang/book#3943)
- fix: ch10-03 - misleading use of expect on .split (rust-lang/book#3939)

## rust-lang/edition-guide

2 commits in 0c68e90acaae5a611f8f5098a3c2980de9845ab2..bbaabbe088e21a81a0d9ae6757705020d5d7b416
2024-05-24 19:07:18 UTC to 2024-05-21 22:40:52 UTC

- 2024: Document reserving `gen` keyword (rust-lang/edition-guide#300)
- 2024: Document cargo changes (rust-lang/edition-guide#301)

## rust-embedded/book

1 commits in dd962bb82865a5284f2404e5234f1e3222b9c022..b10c6acaf0f43481f6600e95d4b5013446e29f7a
2024-05-31 08:51:50 UTC to 2024-05-31 08:51:50 UTC

- Add some explanations as to why exception re-entrancy may still be an issue in a multicore-environment. (rust-embedded/book#367)

## rust-lang/reference

6 commits in e356977fceaa8591c762312d8d446769166d4b3e..6019b76f5b28938565b251bbba0bf5cc5c43d863
2024-06-03 15:58:57 UTC to 2024-05-25 18:35:54 UTC

- Add Apple `target_abi` values to the example values (rust-lang/reference#1507)
- this needs a space (rust-lang/reference#1506)
- Mention Variadics With No Fixed Parameter (rust-lang/reference#1494)
- Add "scopes" chapter. (rust-lang/reference#1040)
- update patterns.md for const pattern RFC (rust-lang/reference#1456)
- document guarantee about evaluation of associated consts and const blocks (rust-lang/reference#1497)

## rust-lang/rust-by-example

3 commits in 20482893d1a502df72f76762c97aed88854cdf81..4840dca06cadf48b305d3ce0aeafde7f80933f80
2024-05-28 13:56:12 UTC to 2024-05-27 11:51:10 UTC

- Update mdbook-i18n-helpers to 0.3.3 (rust-lang/rust-by-example#1857)
- Fix CI failure (rust-lang/rust-by-example#1856)
- Add precision on From/Into asymmetry to from_into.md (rust-lang/rust-by-example#1855)

## rust-lang/rustc-dev-guide

4 commits in b6d4a4940bab85cc91eec70cc2e3096dd48da62d..6a7374bd87cbac0f8be4fd4877d8186d9c313985
2024-05-31 00:27:28 UTC to 2024-05-21 09:56:12 UTC

- Flesh out the "representing types" chapter (rust-lang/rustc-dev-guide#1985)
- sync the stage0 filename (rust-lang/rustc-dev-guide#1979)
- Add Rust for Linux notification group entry (rust-lang/rustc-dev-guide#1984)
- fix some typos (rust-lang/rustc-dev-guide#1983)
2024-06-04 21:41:37 +02:00
Guillaume Gomez
610592b5fe
Rollup merge of #125930 - weihanglo:opt-dist-respect-cargo-config, r=Kobzol
feat(opt-dist): new flag `--benchmark-cargo-config`

This should be the last piece toward self-contained `opt-dist` (I believe).

The flag propagates cargo configs to `rustc-perf --cargo-config`,
which is particularly useful when the environment is air-gapped,
and you want to use the default set of training crates vendored
in the rustc-src tarball.

It fixes the issue described in #125465

> * The current pinned rustc-perf uses `tempfile::Tempdir` as the working
  directory when collecting profiles from some of these packages.
  This "tmp" working directory usage make it impossible for Cargo to pick
  up the correct vendor sources setting in `.cargo/config.toml` bundled
  in the rustc-src tarball. [^1]
> [^1]: 4f313add60/collector/src/compile/benchmark/mod.rs (L164-L173)

See also

* <https://github.com/rust-lang/rustc-perf/pull/1913>
* <https://github.com/rust-lang/rust/pull/125465>
* https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/tempfile.20in.20rustc-perf.20make.20it.20hard.20to.20configure.20vendor

r​? Kobzol
2024-06-04 21:41:35 +02:00
Oneirical
59e2074c79 rewrite suspicious-library in rmake 2024-06-04 15:27:13 -04:00
Guillaume Gomez
7e993b24d5 Create run-make env_var and env_var_os helpers 2024-06-04 21:07:48 +02:00
Santiago Pastorino
bac72cf7cf
Add safe/unsafe to static inside extern blocks 2024-06-04 14:19:43 -03:00
Santiago Pastorino
2a377122dd
Handle safety keyword for extern block inner items 2024-06-04 14:19:42 -03:00
Oli Scherer
81895065bb Give test a more useful name 2024-06-04 15:33:51 +00:00
Oli Scherer
7894a11483 Move tests to a more appropriate directory 2024-06-04 15:33:20 +00:00
Oli Scherer
14f9c63759 Show that it will pick up the entirely wrong function as a private candidate 2024-06-04 15:32:37 +00:00
Sergi-Ferrez
744dc8c503 Use checked_sub 2024-06-04 16:05:51 +02:00
Sergi-Ferrez
617e64c9e7 Update code format and tests 2024-06-04 13:49:39 +02:00
许杰友 Jieyou Xu (Joe)
756af9d5bc
Rollup merge of #125818 - Urgau:print-check-cfg-no-values, r=petrochenkov
Handle no values cfgs with `--print=check-cfg`

This PR fix a bug with `--print=check-cfg`, where no values cfgs where not printed since we only printed cfgs that had at least one values.

The representation I choose is `CFG=`, since it doesn't correspond to any valid config, it also IMO nicely complements the `values()` (to indicate no values). Representing the absence of value by the absence of the value.

So for `cfg(feature, values())` we would print `feature=`.

I also added the missing tracking issue number in the doc.

r? ```@petrochenkov```
2024-06-04 08:25:48 +01:00
许杰友 Jieyou Xu (Joe)
b477f89041
Rollup merge of #125750 - compiler-errors:expect, r=lcnr
Align `Term` methods with `GenericArg` methods, add `Term::expect_*`

* `Term::ty` -> `Term::as_type`.
* `Term::ct` -> `Term::as_const`.
* Adds `Term::expect_type` and `Term::expect_const`, and uses them in favor of `.ty().unwrap()`, etc.

I could also shorten these to `as_ty` and then do `GenericArg::as_ty` as well, but I do think the `as_` is important to signal that this is a conversion method, and not a getter, like `Const::ty` is.

r? types
2024-06-04 08:25:48 +01:00
许杰友 Jieyou Xu (Joe)
6c2cf0b038
Rollup merge of #125690 - Lokathor:arm-maintainer-reorg, r=ehuss
ARM Target Docs Update

Updates the ARM target docs, drawing more attention to the `arm-none-eabi` target group by placing all targets *within* that group as a sub-list in the Table of Contents.

Also updates the `armv4t-none-eabi` page (maintainer signoff: I'm that target's maintainer) to clarify that the page covers the arm version and the thumb version of the target, but that the target group page has the full info because there's nothing really specific to say for those targets.
2024-06-04 08:25:47 +01:00
许杰友 Jieyou Xu (Joe)
aa13b892c7
Rollup merge of #124486 - beetrees:vectorcall-tracking-issue, r=ehuss
Add tracking issue and unstable book page for `"vectorcall"` ABI

Originally added in 2015 by #30567, the Windows `"vectorcall"` ABI didn't have a tracking issue until now.

Tracking issue: #124485
2024-06-04 08:25:46 +01:00
onur-ozkan
8f677e8fb2 bootstrap: implement new feature bootstrap-self-test
Some of the bootstrap logics should be ignored during unit tests because they either
make the tests take longer or cause them to fail. Therefore we need to be able to exclude
them from the bootstrap when it's called by unit tests. This change introduces a new feature
called `bootstrap-self-test`, which is enabled on bootstrap unit tests by default. This allows
us to keep the logic separate between compiler builds and bootstrap tests without needing messy
workarounds (like checking if target names match those in the unit tests).

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-04 09:59:05 +03:00
Lokathor
f4b060e452 Add more ABI test cases. 2024-06-03 23:56:15 -04:00
bors
90d6255d82 Auto merge of #125380 - compiler-errors:wc-obj-safety, r=oli-obk
Make `WHERE_CLAUSES_OBJECT_SAFETY` a regular object safety violation

#### The issue

In #50781, we have known about unsound `where` clauses in function arguments:

```rust
trait Impossible {}

trait Foo {
    fn impossible(&self)
    where
        Self: Impossible;
}

impl Foo for &() {
    fn impossible(&self)
    where
        Self: Impossible,
    {}
}

// `where` clause satisfied for the object, meaning that the function now *looks* callable.
impl Impossible for dyn Foo {}

fn main() {
    let x: &dyn Foo = &&();
    x.impossible();
}
```

... which currently segfaults at runtime because we try to call a method in the vtable that doesn't exist. :(

#### What did u change

This PR removes the `WHERE_CLAUSES_OBJECT_SAFETY` lint and instead makes it a regular object safety violation. I choose to make this into a hard error immediately rather than a `deny` because of the time that has passed since this lint was authored, and the single (1) regression (see below).

That means that it's OK to mention `where Self: Trait` where clauses in your trait, but making such a trait into a `dyn Trait` object will report an object safety violation just like `where Self: Sized`, etc.

```rust
trait Impossible {}

trait Foo {
    fn impossible(&self)
    where
        Self: Impossible; // <~ This definition is valid, just not object-safe.
}

impl Foo for &() {
    fn impossible(&self)
    where
        Self: Impossible,
    {}
}

fn main() {
    let x: &dyn Foo = &&(); // <~ THIS is where we emit an error.
}
```

#### Regressions

From a recent crater run, there's only one crate that relies on this behavior: https://github.com/rust-lang/rust/pull/124305#issuecomment-2122381740. The crate looks unmaintained and there seems to be no dependents.

#### Further

We may later choose to relax this (e.g. when the where clause is implied by the supertraits of the trait or something), but this is not something I propose to do in this FCP.

For example, given:

```
trait Tr {
  fn f(&self) where Self: Blanket;
}

impl<T: ?Sized> Blanket for T {}
```

Proving that some placeholder `S` implements `S: Blanket` would be sufficient to prove that the same (blanket) impl applies for both `Concerete: Blanket` and `dyn Trait: Blanket`.

Repeating here that I don't think we need to implement this behavior right now.

----

r? lcnr
2024-06-04 02:34:20 +00:00
Sergi-Ferrez
b7a8f1f225 Include trailing commas in functions 2024-06-04 02:47:06 +02:00
Michael Goulet
273b990554 Align Term methods with GenericArg methods 2024-06-03 20:36:27 -04:00
bors
1689a5a531 Auto merge of #122597 - pacak:master, r=bjorn3
Show files produced by `--emit foo` in json artifact notifications

Right now it is possible to ask `rustc` to save some intermediate representation into one or more files with `--emit=foo`, but figuring out what exactly was produced is difficult. This pull request adds information about `llvm_ir` and `asm` intermediate files into notifications produced by `--json=artifacts`.

Related discussion: https://internals.rust-lang.org/t/easier-access-to-files-generated-by-emit-foo/20477

Motivation - `cargo-show-asm` parses those intermediate files and presents them in a user friendly way, but right now I have to apply some dirty hacks. Hacks make behavior confusing: https://github.com/hintron/computer-enhance/issues/35

This pull request introduces a new behavior: now `rustc` will emit a new artifact notification for every artifact type user asked to `--emit`, for example for `--emit asm` those will include all the `.s` files.

Most users won't notice this behavior, to be affected by it all of the following must hold:
- user must use `rustc` binary directly (when `cargo` invokes `rustc` - it consumes artifact notifications and doesn't emit anything)
- user must specify both `--emit xxx` and `--json artifacts`
- user must refuse to handle unknown artifact types
- user must disable incremental compilation (or deal with it better than cargo does, or use a workaround like `save-temps`) in order not to hit #88829 / #89149
2024-06-04 00:05:56 +00:00
Weihang Lo
0a11dcfdf4
feat(opt-dist): new flag --benchmark-cargo-config
The flag propagates cargo configs to `rustc-perf --cargo-config`,
which is particularly useful when the environment is air-gapped,
and you want to use the default set of training crates vendored
in the rustc-src tarball.
2024-06-03 17:15:52 -04:00
bors
7c52d2db63 Auto merge of #125383 - Oneirical:bundle-them-up, r=jieyouxu
Rewrite `emit`, `mixing-formats` and `bare-outfile` `run-make` tests in `rmake.rs` format

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
2024-06-03 18:35:54 +00:00
Julia Ryan
832b8b8688
Update fuchsia maintainers 2024-06-03 10:27:10 -07:00
rustbot
47053d1621 Update books 2024-06-03 13:00:52 -04:00
Weihang Lo
e9c4eb3cd3
chore: update src/tools/rustc-perf
This is needed for fixing the missing license issue.

See https://github.com/rust-lang/rust/pull/125465.
2024-06-03 11:38:23 -04:00
Michael Goulet
511f1cf7c8 check_is_object_safe -> is_object_safe 2024-06-03 09:49:30 -04:00
Michael Goulet
de6b219803 Make WHERE_CLAUSES_OBJECT_SAFETY a regular object safety violation 2024-06-03 09:49:04 -04:00
Michael Goulet
eb0a70a557 Opt-in diagnostics reporting to avoid doing extra work in the new solver 2024-06-03 09:27:52 -04:00
bors
8768db9912 Auto merge of #125912 - nnethercote:rustfmt-tests-mir-opt, r=oli-obk
rustfmt `tests/mir-opt`

Continuing the work started in #125759. Details in individual commit log messages.

r? `@oli-obk`
2024-06-03 10:25:12 +00:00
dalance
9d1ec7ea06 Add translation support by mdbook-i18n-helpers to bootstrap 2024-06-03 16:48:27 +09:00
onur-ozkan
92f85f12a8 wipe bootstrap build before switching to bumped rustc
Technically, wiping bootstrap builds can increase the build time.
But in practice, trying to manually resolve post-bump issues and
even accidentally removing the entire build directory will result
in a much greater loss of time. After all, the bootstrap build process
is not a particularly lengthy operation.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-03 07:19:11 +03:00
Nicholas Nethercote
ac24299636 Reformat mir! macro invocations to use braces.
The `mir!` macro has multiple parts:
- An optional return type annotation.
- A sequence of zero or more local declarations.
- A mandatory starting anonymous basic block, which is brace-delimited.
- A sequence of zero of more additional named basic blocks.

Some `mir!` invocations use braces with a "block" style, like so:
```
mir! {
    let _unit: ();
    {
	let non_copy = S(42);
	let ptr = std::ptr::addr_of_mut!(non_copy);
	// Inside `callee`, the first argument and `*ptr` are basically
	// aliasing places!
	Call(_unit = callee(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue())
    }
    after_call = {
	Return()
    }
}
```
Some invocations use parens with a "block" style, like so:
```
mir!(
    let x: [i32; 2];
    let one: i32;
    {
	x = [42, 43];
	one = 1;
	x = [one, 2];
	RET = Move(x);
	Return()
    }
)
```
And some invocations uses parens with a "tighter" style, like so:
```
mir!({
    SetDiscriminant(*b, 0);
    Return()
})
```
This last style is generally used for cases where just the mandatory
starting basic block is present. Its braces are placed next to the
parens.

This commit changes all `mir!` invocations to use braces with a "block"
style. Why?

- Consistency is good.

- The contents of the invocation is a block of code, so it's odd to use
  parens. They are more normally used for function-like macros.

- Most importantly, the next commit will enable rustfmt for
  `tests/mir-opt/`. rustfmt is more aggressive about formatting macros
  that use parens than macros that use braces. Without this commit's
  changes, rustfmt would break a couple of `mir!` macro invocations that
  use braces within `tests/mir-opt` by inserting an extraneous comma.
  E.g.:
  ```
  mir!(type RET = (i32, bool);, { // extraneous comma after ';'
      RET.0 = 1;
      RET.1 = true;
      Return()
  })
  ```
  Switching those `mir!` invocations to use braces avoids that problem,
  resulting in this, which is nicer to read as well as being valid
  syntax:
  ```
  mir! {
      type RET = (i32, bool);
      {
	  RET.0 = 1;
	  RET.1 = true;
	  Return()
      }
  }
  ```
2024-06-03 13:24:44 +10:00
Oneirical
6e120cf464 Remove some allowed-makefiles 2024-06-02 21:59:37 -04:00
Jubilee
18a46be6d9
Rollup merge of #125896 - jieyouxu:compiletest-rmake-comment, r=compiler-errors
compiletest: fix outdated rmake.rs comment

Noticed in https://github.com/rust-lang/rust/pull/125827#discussion_r1623420820. I fixed the PR description but forgot to update the comment.
2024-06-02 12:58:10 -07:00
Jubilee
6c92908869
Rollup merge of #125890 - Nilstrieb:gay-compiletest, r=jieyouxu
Improve compiletest expected/not found formatting

compiletest, oh compiletest, you are truly one of the tools in this repository. You're the omnipresent gatekeeper, ensuring that every new change works, doesn't break the world, and is nice. We thank you for your work, for your tests, for your test runs, for your features that help writing tests, for all the stability and and good you have caused. Without you, Rust wouldn't exist as it does, without you, nothing would work, without you, we would all go insane from having changes break and having to test them all by hand. Thank you, compiletest.

but holy shit i fucking hate your stupid debug output so much i simply cannot take this anymore aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

By changing a few magic lines in this file called "runtest.rs", we can cause compiletest to emit nicer messages. This is widely regarded as a good thing. We stop wasting vertical space, allowing more errors to be displayed at once. Additionally, we add colors, which make it so much more pretty *and* gay, both of which are very good and useful.

There's a bit of fuckery needed to get the colors to work. `colored` checks whether stdout is a terminal. We also print to stdout, so that works well.
But.... for some stupid reason that I absolutely refuse to even attempt to debug, stdout is *not* a terminal when executing tests *in a terminal*.
But stderr is >:).
So this just checks whether stderr is a terminal.
If you have a use case where you dump compiletest stdout into a place where colors are not supported while having stderr be a terminal, then I'm sorry for you, but you are gonna get colors and you're gonna like it. Stop it with the usual environment variable, which `colored` also respects by default.

### before (bad, hurts your brain, makes you want to cry)
![image](https://github.com/rust-lang/rust/assets/48135649/cbeecb5d-fc25-460b-b192-9808f8fa2079)

## after (good, gay, makes you want to cry)
![image](https://github.com/rust-lang/rust/assets/48135649/a655b220-8841-443e-a825-72a835d56882)

r? jieyouxu said he wants to review the PR
2024-06-02 12:58:09 -07:00
Jubilee
800b2f8b64
Rollup merge of #125808 - GuillaumeGomez:migrate-run-make-c-link-to-rust-dylib, r=jieyouxu
Migrate `run-make/c-link-to-rust-dylib` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

First commit comes from https://github.com/rust-lang/rust/pull/125773.

r? `@jieyouxu`
2024-06-02 12:58:08 -07:00
许杰友 Jieyou Xu (Joe)
590c373e43 compiletest: fix outdated rmake.rs comment 2024-06-02 14:33:31 +00:00
bors
5e6c2b6092 Auto merge of #125892 - workingjubilee:rollup-gytt1q7, r=workingjubilee
Rollup of 3 pull requests

Successful merges:

 - #125311 (Make repr(packed) vectors work with SIMD intrinsics)
 - #125849 (Migrate `run-make/emit-named-files` to `rmake.rs`)
 - #125851 (Add some more specific checks to the MIR validator)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-02 13:28:04 +00:00
Nilstrieb
3aefc4aeb2 Improve compiletest expected/not found formatting
compiletest, oh compiletest, you are truly one of the tools in this
repository. You're the omnipresent gatekeeper, ensuring that every new
change works, doesn't break the world, and is nice. We thank you for
your work, for your tests, for your test runs, for your features that
help writing tests, for all the stability and and good you have caused.
Without you, Rust wouldn't exist as it does, without you, nothing would
work, without you, we would all go insane from having changes break and
having to test them all by hand. Thank you, compiletest.

but holy shit i fucking hate your stupid debug output so much i simply
cannot take this anymore aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

By changing a few magic lines in this file called "runtest.rs", we can
cause compiletest to emit nicer messages. This is widely regarded as a
good thing. We stop wasting vertical space, allowing more errors to be
displayed at once. Additionally, we add colors, which make it so much
more pretty *and* gay, both of which are very good and useful.

There's a bit of fuckery needed to get the colors to work. `colored`
checks whether stdout is a terminal. We also print to stdout, so that
works well.
But.... for some stupid reason that I absolutely refuse to even attempt
to debug, stdout is *not* a terminal when executing tests *in a
terminal*.
But stderr is >:).
So this just checks whether stderr is a terminal.
If you have a use case where you dump compiletest stdout into a place
where colors are not supported while having stderr be a terminal, then
I'm sorry for you, but you are gonna get colors and you're gonna like
it. Stop it with the usual environment variable, which `colored` also
respects by default.
2024-06-02 14:09:34 +02:00
Jubilee
0722c9439e
Rollup merge of #125849 - GuillaumeGomez:migrate-emit-named-files, r=jieyouxu
Migrate `run-make/emit-named-files` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-06-02 05:06:47 -07:00
bors
8bec878b73 Auto merge of #125887 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-06-02 11:14:39 +00:00
Guillaume Gomez
32933a6869 Migrate run-make/c-link-to-rust-dylib to rmake.rs 2024-06-02 12:04:39 +02:00
Guillaume Gomez
2416f460f8 Add dynamic_lib_extension and read_dir functions to run-make-support library 2024-06-02 11:59:52 +02:00
Urgau
f58bf91ace Add missing tracking issue number for --print=check-cfg 2024-06-02 11:49:28 +02:00
Urgau
5f0043ace6 Handle no values cfg with --print=check-cfg 2024-06-02 11:49:28 +02:00
bors
4717bdfc13 Auto merge of #17328 - Veykril:derive-helper-completions, r=Veykril
feat: Enable completions within derive helper attributes

![Code_zG5qInoQ6B](https://github.com/rust-lang/rust-analyzer/assets/3757771/db30b98d-4981-45e3-83a5-7ff23fbd3f66)
2024-06-02 07:47:13 +00:00
Lukas Wirth
f122a6f2f1 feat: Enable completions within derive helper attributes 2024-06-02 09:45:57 +02:00
许杰友 Jieyou Xu (Joe)
45622450f8 compiletest: split rmake executable from scratch dir
When implementing support for rmake.rs, I copied over the `$TMPDIR`
directory logic from the legacy Makefile setup. In doing so, I also
compiled recipe `rmake.rs` into executables which unfortunately are
placed into `$TMPDIR` as well.

This causes a problem on Windows where:

- The `rmake.exe` executable is placed in `$TMPDIR`.
- We run the `rmake.exe` as a process.
- The process uses `rmake.exe` inside `$TMPDIR`.
- Windows prevents the .exe file from being deleted when the process
  is still alive.
- The recipe test code tries to `remove_dir_all($TMPDIR)`, which fails
  with access denied because `rmake.exe` is still being used.

We fix this by separating the recipe executable and the sratch
directory:

```
base_dir/
    rmake.exe
    scratch/
```

We construct a base directory, unique to each run-make test, under
which we place rmake.exe alongside a `scratch/` directory. This
`scratch/` directory is what is passed to rmake.rs tests as `$TMPDIR`,
so now `remove_dir_all($TMPDIR)` has a chance to succeed because
it no longer contains `rmake.exe`.

Oops. This was a fun one to try figure out.
2024-06-02 06:32:15 +00:00
bors
06d99cd694 Auto merge of #125773 - GuillaumeGomez:migrate-run-make-cdylib, r=jieyouxu
Migrate run make cdylib

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-06-02 02:11:35 +00:00
bors
0038c02103 Auto merge of #125775 - compiler-errors:uplift-closure-args, r=lcnr
Uplift `{Closure,Coroutine,CoroutineClosure}Args` and friends to `rustc_type_ir`

Part of converting the new solver's `structural_traits.rs` to be interner-agnostic.

I decided against aliasing `ClosureArgs<TyCtxt<'tcx>>` to `ClosureArgs<'tcx>` because it seemed so rare. I could do so if desired, though.

r? lcnr
2024-06-01 19:07:03 +00:00
bors
60d2f73fd1 Auto merge of #17326 - Veykril:fix-attr-derive-container, r=Veykril
fix: Fix container search failing for tokens originating within derive attributes
2024-06-01 18:58:59 +00:00
Lukas Wirth
8ab8bb0603 fix: Fix container search failing for tokens originating within derive attributes 2024-06-01 20:57:29 +02:00
Michael Goulet
333458c2cb Uplift TypeRelation and Relate 2024-06-01 12:50:58 -04:00
bors
a94483a5f2 Auto merge of #125856 - onur-ozkan:bootstrap-submodule-hotfix, r=onur-ozkan
include missing submodule on bootstrap

As of https://github.com/rust-lang/rust/pull/125408 PR, rustbook now relies on dependencies from the "src/doc/book" submodule.

However, bootstrap does not automatically sync this submodule before reading metadata informations. And if the submodule is not present, reading metadata will fail because rustbook's dependencies will be missing.

This change makes "src/doc/book" to be fetched/synced automatically before trying to read metadata.

cc `@Zalathar`
2024-06-01 16:48:46 +00:00
bors
f2208b3297 Auto merge of #123572 - Mark-Simulacrum:vtable-methods, r=oli-obk
Increase vtable layout size

This improves LLVM's codegen by allowing vtable loads to be hoisted out of loops (as just one example). The calculation here is an under-approximation but works for simple trait hierarchies (e.g., FnMut will be improved). We have a runtime assert that the approximation is accurate, so there's no risk of UB as a result of getting this wrong.

```rust
#[no_mangle]
pub fn foo(elements: &[u32], callback: &mut dyn Callback) {
    for element in elements.iter() {
        if *element != 0 {
            callback.call(*element);
        }
    }
}

pub trait Callback {
    fn call(&mut self, _: u32);
}
```

Simplifying a bit (e.g., numbering ends up different):

```diff
 ; Function Attrs: nonlazybind uwtable
-define void `@foo(ptr` noalias noundef nonnull readonly align 4 %elements.0, i64 noundef %elements.1, ptr noundef nonnull align 1 %callback.0, ptr noalias nocapture noundef readonly align 8 dereferenceable(24) %callback.1) unnamed_addr #0 {
+define void `@foo(ptr` noalias noundef nonnull readonly align 4 %elements.0, i64 noundef %elements.1, ptr noundef nonnull align 1 %callback.0, ptr noalias nocapture noundef readonly align 8 dereferenceable(32) %callback.1) unnamed_addr #0 {
 start:
   %_15 = getelementptr inbounds i32, ptr %elements.0, i64 %elements.1
`@@` -13,4 +13,5 `@@`
 bb4.lr.ph:                                        ; preds = %start
   %1 = getelementptr inbounds i8, ptr %callback.1, i64 24
+  %2 = load ptr, ptr %1, align 8, !nonnull !3
   br label %bb4

 bb6:                                              ; preds = %bb4
-  %4 = load ptr, ptr %1, align 8, !invariant.load !3, !nonnull !3
-  tail call void %4(ptr noundef nonnull align 1 %callback.0, i32 noundef %_9)
+  tail call void %2(ptr noundef nonnull align 1 %callback.0, i32 noundef %_9)
   br label %bb7
 }
```
2024-06-01 14:31:07 +00:00
onur-ozkan
5cdec6582a include missing submodule on bootstrap
As of https://github.com/rust-lang/rust/pull/125408 PR,
rustbook now relies on dependencies from the "src/doc/book" submodule.

However, bootstrap does not automatically sync this submodule before reading
metadata informations. And if the submodule is not present, reading
metadata will fail because rustbook's dependencies will be missing.

This change makes "src/doc/book" to be fetched/synced automatically
before trying to read metadata.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-01 17:27:35 +03:00
bors
c1ea2b562e Auto merge of #17302 - mladedav:dm/fix-clear, r=Veykril
fix diagnostics clearing when flychecks run per-workspace

This might be causing #17300 or it's a different bug with the same functionality.

I wonder if the decision to clear diagnostics should stay in the main loop or maybe the flycheck itself should track it and tell the mainloop?

I have used a hash map but we could just as well use a vector since the IDs are `usizes` in some given range starting at 0. It would be probably faster but this just felt a bit cleaner and it allows us to change the ID to newtype later and we can just use a hasher that returns the underlying integer.
2024-06-01 14:14:14 +00:00
David Mládek
f476d37e4e Move state trackig of diagnostic clearing inside FlycheckActor 2024-06-01 15:59:23 +02:00
Mark Rousskov
95e073234f Deduplicate supertrait_def_ids code 2024-06-01 07:50:32 -04:00
bors
05965ae238 Auto merge of #124577 - GuillaumeGomez:stabilize-custom_code_classes_in_docs, r=rustdoc
Stabilize `custom_code_classes_in_docs` feature

Fixes #79483.

This feature has been around for quite some time now, I think it's fine to stabilize it now.

## Summary

## What is the feature about?

In short, this PR changes two things, both related to codeblocks in doc comments in Rust documentation:

 * Allow to disable generation of `language-*` CSS classes with the `custom` attribute.
 * Add your own CSS classes to a code block so that you can use other tools to highlight them.

#### The `custom` attribute

Let's start with the new `custom` attribute: it will disable the generation of the `language-*` CSS class on the generated HTML code block. For example:

```rust
/// ```custom,c
/// int main(void) {
///     return 0;
/// }
/// ```
```

The generated HTML code block will not have `class="language-c"` because the `custom` attribute has been set. The `custom` attribute becomes especially useful with the other thing added by this feature: adding your own CSS classes.

#### Adding your own CSS classes

The second part of this feature is to allow users to add CSS classes themselves so that they can then add a JS library which will do it (like `highlight.js` or `prism.js`), allowing to support highlighting for other languages than Rust without increasing burden on rustdoc. To disable the automatic `language-*` CSS class generation, you need to use the `custom` attribute as well.

This allow users to write the following:

```rust
/// Some code block with `{class=language-c}` as the language string.
///
/// ```custom,{class=language-c}
/// int main(void) {
///     return 0;
/// }
/// ```
fn main() {}
```

This will notably produce the following HTML:

```html
<pre class="language-c">
int main(void) {
    return 0;
}</pre>
```

Instead of:

```html
<pre class="rust rust-example-rendered">
<span class="ident">int</span> <span class="ident">main</span>(<span class="ident">void</span>) {
    <span class="kw">return</span> <span class="number">0</span>;
}
</pre>
```

To be noted, we could have written `{.language-c}` to achieve the same result. `.` and `class=` have the same effect.

One last syntax point: content between parens (`(like this)`) is now considered as comment and is not taken into account at all.

In addition to this, I added an `unknown` field into `LangString` (the parsed code block "attribute") because of cases like this:

```rust
/// ```custom,class:language-c
/// main;
/// ```
pub fn foo() {}
```

Without this `unknown` field, it would generate in the DOM: `<pre class="language-class:language-c language-c">`, which is quite bad. So instead, it now stores all unknown tags into the `unknown` field and use the first one as "language". So in this case, since there is no unknown tag, it'll simply generate `<pre class="language-c">`. I added tests to cover this.

EDIT(camelid): This description is out-of-date. Using `custom,class:language-c` will generate the output `<pre class="language-class:language-c">` as would be expected; it treats `class:language-c` as just the name of a language (similar to the langstring `c` or `js` or what have you) since it does not use the designed class syntax.

Finally, I added a parser for the codeblock attributes to make it much easier to maintain. It'll be pretty easy to extend.

As to why this syntax for adding attributes was picked: it's [Pandoc's syntax](https://pandoc.org/MANUAL.html#extension-fenced_code_attributes). Even if it seems clunkier in some cases, it's extensible, and most third-party Markdown renderers are smart enough to ignore Pandoc's brace-delimited attributes (from [this comment](https://github.com/rust-lang/rust/pull/110800#issuecomment-1522044456)).

r? `@notriddle`
2024-06-01 10:18:01 +00:00
bors
d4a5cb9fdd Auto merge of #17278 - chenx97:flycheck-process-wrap, r=lnicola
internal: replace command-group with process-wrap

Because command-group no longer receives updates and depends on an older version of nix.
2024-06-01 08:39:22 +00:00
Guillaume Gomez
190a96f9d3 Migrate run-make/emit-named-files to rmake.rs 2024-06-01 10:29:45 +02:00
Guillaume Gomez
8742bf375b Migrate run-make/cdylib to rmake.rs 2024-06-01 10:12:45 +02:00
Guillaume Gomez
b0d0cc6590 Add Cc::output method 2024-06-01 10:12:24 +02:00
bors
dcc9a8f283 Auto merge of #125835 - weihanglo:update-cargo, r=weihanglo
Update cargo

9 commits in 431db31d0dbeda320caf8ef8535ea48eb3093407..7a6fad0984d28c8330974636972aa296b67c4513
2024-05-28 18:17:31 +0000 to 2024-05-31 22:26:03 +0000
- fix(config): Ensure `--config net.git-fetch-with-cli=true` is respected (rust-lang/cargo#13992)
- Fix libcurl proxy documentation link (rust-lang/cargo#13990)
- fix(new): Dont say were adding to a workspace when a regular package is in root (rust-lang/cargo#13987)
- fix: adjust custom err from cert-check due to libgit2 1.8 change (rust-lang/cargo#13970)
- fix(toml): Ensure targets are in a deterministic order (rust-lang/cargo#13989)
- doc(cargo-package): explain no guarantee of vcs provenance (rust-lang/cargo#13984)
- chore: fix some comments (rust-lang/cargo#13982)
- feat: stabilize `cargo update --precise &lt;yanked&gt;` (rust-lang/cargo#13974)
- Update openssl-src to 111.28.2+1.1.1w (rust-lang/cargo#13976)

r? ghost
2024-06-01 04:03:23 +00:00
Weihang Lo
15564fa194
Update cargo 2024-05-31 22:13:20 -04:00
bors
20be84a7e6 Auto merge of #125408 - chriskrycho:chriskrycho/book-updates, r=ehuss
Support mdBook preprocessors for TRPL in rustbook

`rust-lang/book` recently added two mdBook preprocessors. Enable `rustbook` to use those preprocessors for books where they are requested by the `book.toml` by adding the preprocessors as path dependencies, and ignoring them where they are not requested, i.e. by all the books other than TRPL at present.

Addresses rust-lang/book#3927
2024-05-31 18:30:15 +00:00
Luke Franceschini
fa3835c419
docs: Missing word typo 2024-05-31 11:24:26 -04:00
Matthias Krüger
df9cd1700d
Rollup merge of #125816 - Zalathar:demangler, r=oli-obk
Don't build the `rust-demangler` binary for coverage tests

The coverage-run tests invoke `llvm-cov`, which requires us to specify a command-line demangler that it can use to demangle Rust symbol names.

Historically this used `src/tools/rust-demangler`, which means that we currently build two different command-line tools to help with the coverage tests (`rust-demangler` and `coverage-dump`).

However, it occurred to me that if we add a demangler mode to `coverage-dump` (which is only a handful of lines and no extra dependencies), then we only need to build one helper binary for the coverage tests, and there is no need for tests to build `rust-demangler` at all.

---

Note that the `rust-demangler` binary is separate from the `rustc-demangle` crate (which both `rust-demangler` and `coverage-dump` use as a dependency to do the actual demangling).

---

So the main benefits/motivations here are:
- Slightly faster builds after a fresh checkout or bootstrap bump.
- Making it clear that currently no tests actually need the `rust-demangler` binary, since the coverage tests can use their own tool instead.
2024-05-31 17:05:27 +02:00
Matthias Krüger
7667a91778
Rollup merge of #125756 - Zalathar:branch-on-bool, r=oli-obk
coverage: Optionally instrument the RHS of lazy logical operators

(This is an updated version of #124644 and #124402. Fixes #124120.)

When `||` or `&&` is used outside of a branching context (such as the condition of an `if`), the rightmost value does not directly influence any branching decision, so branch coverage instrumentation does not treat it as its own true-or-false branch.

That is a correct and useful interpretation of “branch coverage”, but might be undesirable in some contexts, as described at #124120. This PR therefore adds a new coverage level `-Zcoverage-options=condition` that behaves like branch coverage, but also adds additional branch instrumentation to the right-hand-side of lazy boolean operators.

---

As discussed at https://github.com/rust-lang/rust/issues/124120#issuecomment-2092394586, this is mainly intended as an intermediate step towards fully-featured MC/DC instrumentation. It's likely that we'll eventually want to remove this coverage level (rather than stabilize it), either because it has been incorporated into MC/DC instrumentation, or because it's getting in the way of future MC/DC work. The main appeal of landing it now is so that work on tracking conditions can proceed concurrently with other MC/DC-related work.

````@rustbot```` label +A-code-coverage
2024-05-31 17:05:24 +02:00
Zalathar
54b6849e06 Remove unused rust-demangler support from compiletest 2024-05-31 21:52:45 +10:00
Zalathar
feb8f3cc5d Use Builder::tool_exe to build the coverage-dump tool
This appears to be the canonical way to build a tool with the stage 0 compiler.
2024-05-31 21:52:45 +10:00
Zalathar
10ffc228a8 Use coverage-dump --demangle as the demangler for coverage-run tests
This avoids the need to build `rust-demangler` when running coverage tests,
since we typically need to build `coverage-dump` anyway.
2024-05-31 21:52:45 +10:00
Zalathar
9abfebdf1e Add an alternate --demangle mode to coverage-dump
The coverage-dump tool already needs `rustc_demangle` for its own purposes, so
the amount of extra code needed for a demangle mode is very small.
2024-05-31 21:52:45 +10:00
bors
99cb42c296 Auto merge of #124662 - zetanumbers:needs_async_drop, r=oli-obk
Implement `needs_async_drop` in rustc and optimize async drop glue

This PR expands on #121801 and implements `Ty::needs_async_drop` which works almost exactly the same as `Ty::needs_drop`, which is needed for #123948.

Also made compiler's async drop code to look more like compiler's regular drop code, which enabled me to write an optimization where types which do not use `AsyncDrop` can simply forward async drop glue to `drop_in_place`. This made size of the async block from the [async_drop test](67980dd6fb/tests/ui/async-await/async-drop.rs) to decrease by 12%.
2024-05-31 10:12:24 +00:00
Matthias Krüger
379233242b
Rollup merge of #125635 - fmease:mv-type-binding-assoc-item-constraint, r=compiler-errors
Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup

Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology.

Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense.

---

Old terminology (HIR, rustdoc):

```
`TypeBinding`: (associated) type binding
├── `Constraint`: associated type bound
└── `Equality`: (associated) equality constraint (?)
    ├── `Ty`: (associated) type binding
    └── `Const`: associated const equality (constraint)
```

Old terminology (AST, abbrev.):

```
`AssocConstraint`
├── `Bound`
└── `Equality`
    ├── `Ty`
    └── `Const`
```

New terminology (AST, HIR, rustdoc):

```
`AssocItemConstraint`: associated item constraint
├── `Bound`: associated type bound
└── `Equality`: associated item equality constraint OR associated item binding (for short)
    ├── `Ty`: associated type equality constraint OR associated type binding (for short)
    └── `Const`: associated const equality constraint OR associated const binding (for short)
```

r? compiler-errors
2024-05-31 08:50:22 +02:00
Henry Chen
772e48cfbb minor: replace command-group with process-wrap
Because command-group no longer receives updates and depends on an
older version of nix.
2024-05-31 12:43:40 +08:00
Lokathor
94d4040925 The modern styling is apparently to use Title Case for the chip/company, "Arm". 2024-05-30 19:34:05 -06:00
bors
434999efe6 Auto merge of #125710 - RalfJung:compiletest-components, r=workingjubilee
compiletest: clarify COMPILETEST_NEEDS_ALL_LLVM_COMPONENTS error

COMPILETEST_NEEDS_ALL_LLVM_COMPONENTS is a confusing name because elsewhere "needs" means "ignore when requirement not met", but here it means "fail when requirement not met".
2024-05-30 21:51:24 +00:00
León Orell Valerian Liehr
34c56c45cf
Rename HIR TypeBinding to AssocItemConstraint and related cleanup 2024-05-30 22:52:33 +02:00
bors
6f3df08aad Auto merge of #125378 - lcnr:tracing-no-lines, r=oli-obk
remove tracing tree indent lines

This allows vscode to collapse nested spans without having to manually remove the indent lines. This is incredibly useful when logging the new solver. I don't mind making them optional depending on some environment flag if you prefer using indent lines

For a gist of the new output, see https://gist.github.com/lcnr/bb4360ddbc5cd4631f2fbc569057e5eb#file-example-output-L181

r? `@oli-obk`
2024-05-30 18:57:48 +00:00
bors
7feb191f18 Auto merge of #125764 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-05-30 16:46:31 +00:00
lcnr
97d2c3a6a7 remove tracing tree indent lines 2024-05-30 15:26:48 +02:00
Philipp Krones
9b320af787
Merge commit 'c9139bd546d9cd69df817faeab62c5f9b1a51337' into clippy-subtree-update 2024-05-30 10:49:05 +02:00
bors
58f3894342 Auto merge of #3644 - narpfel:local-crates-metadata-format-update, r=RalfJung
Fix "local crate" detection

`PackageId` is an opaque identifier whose internal format is subject to change, so looking up the names of local crates by ID is more robust than parsing the ID.

Resolves #3643.
2024-05-30 08:25:23 +00:00
Ralf Jung
00644c12ed
add a comment 2024-05-30 10:23:54 +02:00
Matthias Krüger
5e83248a81
Rollup merge of #125753 - Zalathar:procres, r=jieyouxu
compiletest: Unify `cmd2procres` with `run_command_to_procres`

Historical context: I originally added `run_command_to_procres` in #112300 and #114843, because I didn't like the overly-specific failure message in `cmd2procres`, but at the time I didn't feel confident enough to change the existing code, so I just added my own similar code.

Now I'm going back to remove this redundancy by eliminating `cmd2procress`, and adjusting all callers to use a slightly-tweaked `run_command_to_procres` instead.
2024-05-30 10:23:09 +02:00
Matthias Krüger
cffcf9c828
Rollup merge of #125745 - tgross35:bump-stage0, r=Mark-Simulacrum
Bump the stage0 compiler to beta.7 (2024-05-26)

As mentioned at https://github.com/rust-lang/rust/pull/125016#issuecomment-2138383831
2024-05-30 10:23:08 +02:00
Matthias Krüger
60c2d80482
Rollup merge of #125739 - RalfJung:drop-in-place-docs, r=workingjubilee
drop_in_place: weaken the claim of equivalence with drop(ptr.read())

The two are *not* semantically equivalent in all cases, so let's not be so definite about this.

Fixes https://github.com/rust-lang/rust/issues/112015
2024-05-30 10:23:07 +02:00
Matthias Krüger
7ed5d469e8
Rollup merge of #125711 - oli-obk:const_block_ice2, r=Nadrieril
Make `body_owned_by` return the `Body` instead of just the `BodyId`

fixes #125677

Almost all `body_owned_by` callers immediately called `body`, too, so just return `Body` directly.

This makes the inline-const query feeding more robust, as all calls to `body_owned_by` will now yield a body for inline consts, too.

I have not yet figured out a good way to make `tcx.hir().body()` return an inline-const body, but that can be done as a follow-up
2024-05-30 10:23:07 +02:00
Ralf Jung
5c68a15e41 explain what the open questions are, and add a Miri test for that 2024-05-30 09:07:06 +02:00
Ralf Jung
daeb68a579 make env/var test deterministic 2024-05-30 09:05:03 +02:00
Ralf Jung
4ce7e094ae compiletest: clarify COMPILETEST_NEEDS_ALL_LLVM_COMPONENTS error
also improve wording for an ignore reason
2024-05-30 08:07:56 +02:00
Dorian Péron
fa563c1384 coverage: Add CLI support for -Zcoverage-options=condition 2024-05-30 15:38:46 +10:00
The Miri Cronjob Bot
a200d38ce9 fmt 2024-05-30 05:05:24 +00:00
The Miri Cronjob Bot
8faa34e2ec Merge from rustc 2024-05-30 05:04:17 +00:00
The Miri Cronjob Bot
5bf7832375 Preparing for merge from rustc 2024-05-30 04:56:50 +00:00
Zalathar
31043656fe compiletest: Unify cmd2procres with run_command_to_procres 2024-05-30 12:55:25 +10:00
bors
caa187f3bc Auto merge of #125744 - fmease:rollup-ky7d098, r=fmease
Rollup of 7 pull requests

Successful merges:

 - #125653 (Migrate `run-make/const-prop-lint` to `rmake.rs`)
 - #125662 (Rewrite `fpic`, `simple-dylib` and `issue-37893` `run-make` tests in `rmake.rs` or ui test format)
 - #125699 (Streamline `x fmt` and improve its output)
 - #125701 ([ACP 362] genericize `ptr::from_raw_parts`)
 - #125723 (Migrate `run-make/crate-data-smoke` to `rmake.rs`)
 - #125733 (Add lang items for `AsyncFn*`, `Future`, `AsyncFnKindHelper`'s associated types)
 - #125734 (ast: Revert a breaking attribute visiting order change)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-30 00:49:44 +00:00
Trevor Gross
2f35cfd87a Bump the stage0 compiler to beta.7 (2024-05-25) 2024-05-29 19:30:51 -04:00
León Orell Valerian Liehr
fdfffc0048
Rollup merge of #125734 - petrochenkov:macinattr, r=wesleywiser
ast: Revert a breaking attribute visiting order change

Fixes https://github.com/rust-lang/rust/issues/124535
Fixes https://github.com/rust-lang/rust/issues/125201
2024-05-30 01:12:38 +02:00
León Orell Valerian Liehr
a34d0f1370
Rollup merge of #125723 - GuillaumeGomez:migrate-run-make-crate-data-smoke, r=jieyouxu
Migrate `run-make/crate-data-smoke` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ``@jieyouxu``
2024-05-30 01:12:37 +02:00
León Orell Valerian Liehr
c62fa8294e
Rollup merge of #125699 - nnethercote:streamline-rustfmt, r=GuillaumeGomez
Streamline `x fmt` and improve its output

- Removes the ability to pass paths to `x fmt`, because it's complicated and not useful, and adds `--all`.
- Improves `x fmt` output.
- Improves `x fmt`'s internal code.

r? ``@GuillaumeGomez``
2024-05-30 01:12:36 +02:00
León Orell Valerian Liehr
c2c8e9024f
Rollup merge of #125662 - Oneirical:more-tests-again, r=jieyouxu
Rewrite `fpic`, `simple-dylib` and `issue-37893` `run-make` tests in `rmake.rs` or ui test format

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-05-30 01:12:35 +02:00
León Orell Valerian Liehr
3b6a3eb3cc
Rollup merge of #125653 - GuillaumeGomez:migrate-const-prop-lint, r=jieyouxu
Migrate `run-make/const-prop-lint` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ``@jieyouxu``
2024-05-30 01:12:34 +02:00
bors
23ea77b8ed Auto merge of #125702 - workingjubilee:tell-tidy-about-csky, r=nikic
Give tidy the good news about C-SKY

It seems this was overlooked in https://github.com/rust-lang/rust/pull/125472 because we don't test C-SKY much yet.

Fixes #125697

r? `@erikdesjardins`
2024-05-29 22:34:14 +00:00
bors
debd22da66 Auto merge of #125732 - matthiaskrgr:rollup-bozbtk3, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #124655 (Add `-Zfixed-x18`)
 - #125693 (Format all source files in `tests/coverage/`)
 - #125700 (coverage: Avoid overflow when the MC/DC condition limit is exceeded)
 - #125705 (Reintroduce name resolution check for trying to access locals from an inline const)
 - #125708 (tier 3 target policy: clarify the point about producing assembly)
 - #125715 (remove unneeded extern crate in rmake test)
 - #125719 (Extract coverage-specific code out of `compiletest::runtest`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-29 20:11:09 +00:00
Paul Gey
a963103898 add tests for local crate detection 2024-05-29 21:02:06 +02:00
Vadim Petrochenkov
6e67eaa311 ast: Revert a breaking attribute visiting order change 2024-05-29 21:55:24 +03:00
Matthias Krüger
6ef3dd0d38
Rollup merge of #125719 - Zalathar:run-coverage, r=jieyouxu
Extract coverage-specific code out of `compiletest::runtest`

I had been vaguely intending to do this for a while, but seeing #89475 on the compiletest dashboard inspired me to actually go and do it.

This moves a few hundred lines of coverage-specific code out of the main module, making navigation a bit easier. There is still a small amount of coverage-specific logic in broader functions in that module, since it can't easily be moved.

This is just cut-and-paste plus fixing visibility and imports, so no functional changes.

I also removed the unit test for anonymizing line numbers in MC/DC reports, as foreshadowed by the comment I wrote when adding it. That functionality is now adequately exercised by the actual snapshot tests for MC/DC coverage.

(Removing the test now avoids the need to move it, or to make the function it calls visible.)
2024-05-29 20:12:36 +02:00
Matthias Krüger
a6a819c128
Rollup merge of #125708 - RalfJung:tier3, r=compiler-errors
tier 3 target policy: clarify the point about producing assembly

I think that is already the intended meaning of the policy, but I am not sure.

Cc ``@rust-lang/compiler``
2024-05-29 20:12:34 +02:00
Matthias Krüger
d0311c1303
Rollup merge of #124655 - Darksonn:fixed-x18, r=lqd,estebank
Add `-Zfixed-x18`

This PR is a follow-up to #124323 that proposes a different implementation. Please read the description of that PR for motivation.

See the equivalent flag in [the clang docs](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-ffixed-x18).

MCP: https://github.com/rust-lang/compiler-team/issues/748
Fixes https://github.com/rust-lang/rust/issues/121970
r? rust-lang/compiler
2024-05-29 20:12:32 +02:00
bors
e9b7aa08f7 Auto merge of #125613 - ChrisDenton:windows-recipie, r=jieyouxu
Use `rmake` for `windows-` run-make tests

Convert some Makefile tests to recipes.

I renamed "issue-85441" to "windows-ws2_32" as I think it's slightly more descriptive. EDIT: `llvm-readobj` seems to work for reading DLL imports so I've used that instead of `objdump`.

cc #121876
2024-05-29 18:03:55 +00:00
bors
ec5327d0b7 Auto merge of #3638 - saethlin:big-alloc-bench, r=RalfJung
Add a benchmark for creating large uninit allocations

Extracted from https://github.com/rust-lang/miri/issues/3637

I used this program to confirm that https://github.com/rust-lang/rust/pull/125633 has the desired effect.
2024-05-29 17:49:40 +00:00
Jubilee Young
60c30f57c1 ci: Consolidate $IS_NOT_LATEST_LLVM into $EXTERNAL_LLVM
We want to only demand that we check for all components we expect
if we actually built the components we expect, which means
we built the LLVM. Otherwise, it isn't worth checking.
2024-05-29 10:35:20 -07:00
Jubilee Young
a4b737643e give tidy the good news about C-SKY 2024-05-29 10:34:32 -07:00
Guillaume Gomez
301d7229f7 Add run-make-support::rust_lib_name 2024-05-29 18:00:14 +02:00
Oneirical
8c8d0db02d rewrite and rename issue-37893 to rmake 2024-05-29 11:38:47 -04:00
Oneirical
22953b3f52 convert simple-dylib to ui test 2024-05-29 11:34:39 -04:00
Guillaume Gomez
de1d0e0da9 Migrate run-make/crate-data-smoke to rmake.rs 2024-05-29 16:10:10 +02:00
Chris Denton
f34bbdecc4
Remove Makefiles from allowed_run_make_makefiles 2024-05-29 13:15:41 +00:00
Chris Denton
e03f9cb52d
Convert run-make/windows-safeseh to rmake 2024-05-29 13:14:19 +00:00
Guillaume Gomez
5b0e6cb672 Migrate run-make/const-prop-lint to rmake.rs 2024-05-29 15:04:19 +02:00
bors
f2e1a3a80a Auto merge of #125360 - RalfJung:packed-field-reorder, r=fmease
don't inhibit random field reordering on repr(packed(1))

`inhibit_struct_field_reordering_opt` being false means we exclude this type from random field shuffling. However, `packed(1)` types can still be shuffled! The logic was added in https://github.com/rust-lang/rust/pull/48528 since it's pointless to reorder fields in packed(1) types (there's no padding that could be saved) -- but that shouldn't inhibit `-Zrandomize-layout` (which did not exist at the time).

We could add an optimization elsewhere to not bother sorting the fields for `repr(packed)` types, but I don't think that's worth the effort.

This *does* change the behavior in that we may now reorder fields of `packed(1)` structs (e.g. if there are niches, we'll try to move them to the start/end, according to `NicheBias`).  We were always allowed to do that but so far we didn't. Quoting the [reference](https://doc.rust-lang.org/reference/type-layout.html):

> On their own, align and packed do not provide guarantees about the order of fields in the layout of a struct or the layout of an enum variant, although they may be combined with representations (such as C) which do provide such guarantees.
2024-05-29 11:57:13 +00:00
Zalathar
268b9a74e3 Extract coverage-specific code out of compiletest::runtest
This moves a few hundred lines of coverage-specific code out of the main
module, making navigation a bit easier.
2024-05-29 21:28:12 +10:00
Oli Scherer
a34c26e7ec Make body_owned_by return the body directly.
Almost all callers want this anyway, and now we can use it to also return fed bodies
2024-05-29 10:04:08 +00:00
Oli Scherer
ceb45d5519 Don't require visit_body to take a lifetime that must outlive the function call 2024-05-29 10:04:08 +00:00
Daria Sukhonina
4903cf4df6 Revert miri async drop test but add warnings to each async drop test 2024-05-29 12:57:01 +03:00
Daria Sukhonina
57a44b2119 Bless new async destructor sizes in async drop tests 2024-05-29 12:57:01 +03:00
Daria Sukhonina
e0904cd6a9 Add size check inside of the async drop tests 2024-05-29 12:50:44 +03:00
Ralf Jung
eafe80f5d9 tier 3 target policy: clarify the point about producing assembly 2024-05-29 11:21:17 +02:00
Nicholas Nethercote
4dec0a0e99 Clarify the closure in rustfmt.
- Avoid calling `try_wait` followed immediately by `wait`.
- Make the match exhaustive.
- Improve the comment.
2024-05-29 18:00:35 +10:00
Nicholas Nethercote
a22cfccca2 Rename fmt_override.
It's a weird name, the `fmt_` prefix seems unnecessary.
2024-05-29 16:24:50 +10:00
Nicholas Nethercote
3d5d6d2220 Adjust x fmt printed output.
Currently, `x fmt` can print two lists of files.
- The untracked files that are skipped. Always done if within a git
  repo.
- The modified files that are formatted.

But if you run with `--all` (or with `GITHUB_ACTIONS=true`) it doesn't
print anything about which files are formatted.

This commit increases consistency.
- The formatted/checked files are now always printed. And it makes it clear why
  a file was formatted, e.g. with "modified".
- It uses the same code for both untracked files and formatted/checked
  files. This means that now if there are a lot of untracked files just
  the number will be printed, which is like the old behaviour for
  modified files.

Example output:
```
fmt: skipped 31 untracked files
fmt: formatted modified file compiler/rustc_mir_transform/src/instsimplify.rs
fmt: formatted modified file compiler/rustc_mir_transform/src/validate.rs
fmt: formatted modified file library/core/src/ptr/metadata.rs
fmt: formatted modified file src/bootstrap/src/core/build_steps/format.rs
```
or (with `--all`):
```
fmt: checked 3148 files
```
2024-05-29 16:24:50 +10:00
Nicholas Nethercote
e98740aa0d Clarify x fmt messages.
- Precede them all with `fmt` so it's clear where they are coming from.
- Use `error:` and `warning:` when appropriate.
- Print warnings to stderr instead of stdout
2024-05-29 16:24:50 +10:00
Nicholas Nethercote
5cf198d0d6 Remove path choice from x fmt and add --all option.
By default, `x fmt` formats/checks modified files. But it also lets you
choose one or more paths instead.

This adds significant complexity to `x fmt`. Explicit paths are
specified via `WalkBuilder::add` rather than `OverrideBuilder::add`. The
`ignore` library is not simple, and predicting the interactions between
the two mechanisms is difficult.

Here's a particularly interesting case.
- You can request a path P that is excluded by the `ignore` list in the
  `rustfmt.toml`. E.g. `x fmt tests/ui/` or `x fmt tests/ui/bitwise.rs`.
- `x fmt` will add P to the walker (via `WalkBuilder::add`), traverse it
  (paying no attention to the `ignore` list from the `rustfmt.toml`
  file, due to the different mechanism), and call `rustfmt` on every
  `.rs` file within it.
- `rustfmt` will do nothing to those `.rs` files, because it *also*
  reads `rustfmt.toml` and sees that they match the `ignore` list!

It took me *ages* to debug and understand this behaviour. Not good!

`x fmt` even lets you name a path below the current directory. This was
intended to let you do things like `x fmt std` that mirror things like
`x test std`. This works by looking for `std` and finding `library/std`,
and then formatting that. Unfortuantely, this motivating case now gives
an error. When support was added in #107944, `library/std` was the only
directory named `std`. Since then, `tests/ui/std` was added, and so `x
fmt std` now gives an error.

In general, explicit paths don't seem particularly useful. The only two
cases `x fmt` really needs are:
- format/check the files I have modified (99% of uses)
- format/check all files

(While respecting the `ignore` list in `rustfmt.toml`, of course.)

So this commit moves to that model. `x fmt` will now give an error if
given an explicit path. `x fmt` now also supports a `--all` option. (And
running with `GITHUB_ACTIONS=true` also causes everything to be
formatted/checked, as before.) Much simpler!
2024-05-29 16:24:48 +10:00
许杰友 Jieyou Xu (Joe)
98f3217a83
Rollup merge of #125639 - ChrisDenton:run-make-support-doc, r=onur-ozkan
Support `./x doc run-make-support --open`

Having easy access to the run-make-support documentation is invaluable when creating run-make tests using the new Rust recipes.
2024-05-29 03:25:10 +01:00
许杰友 Jieyou Xu (Joe)
7e93a632a8
Rollup merge of #125638 - Oneirical:lets-find-some-tests, r=jieyouxu
Rewrite `lto-smoke`, `simple-rlib` and `mixing-deps` `run-make` tests in `rmake.rs` format

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-05-29 03:25:10 +01:00
许杰友 Jieyou Xu (Joe)
305137de18
Rollup merge of #125633 - RalfJung:miri-no-copy, r=saethlin
miri: avoid making a full copy of all new allocations

Hopefully fixes https://github.com/rust-lang/miri/issues/3637

r? ``@saethlin``
2024-05-29 03:25:09 +01:00
许杰友 Jieyou Xu (Joe)
3cc59aeaae
Rollup merge of #125226 - madsmtm:fix-mac-catalyst-tests, r=workingjubilee
Make more of the test suite run on Mac Catalyst

Combined with https://github.com/rust-lang/rust/pull/125225, the only failing parts of the test suite are in `tests/rustdoc-js`, `tests/rustdoc-js-std` and `tests/debuginfo`. Tested with:
```console
./x test --target=aarch64-apple-ios-macabi library/std
./x test --target=aarch64-apple-ios-macabi --skip=tests/rustdoc-js --skip=tests/rustdoc-js-std --skip=tests/debuginfo tests
```

Will probably put up a PR later to enable _running_ on (not just compiling for) Mac Catalyst in CI, though not sure where exactly I should do so? `src/ci/github-actions/jobs.yml`?

Note that I've deliberately _not_ enabled stack overflow handlers on iOS/tvOS/watchOS/visionOS (see https://github.com/rust-lang/rust/issues/25872), but rather just skipped those tests, as it uses quite a few APIs that I'd be weary about getting rejected by the App Store (note that Swift doesn't do it on those platforms either).

r? ``@workingjubilee``

CC ``@thomcc``

``@rustbot`` label O-ios O-apple
2024-05-29 03:25:08 +01:00
许杰友 Jieyou Xu (Joe)
7e441a11a1
Rollup merge of #124320 - Urgau:print-check-cfg, r=petrochenkov
Add `--print=check-cfg` to get the expected configs

This PR adds a new `--print` variant `check-cfg` to get the expected configs.

Details and rational can be found on the MCP: https://github.com/rust-lang/compiler-team/issues/743

``@rustbot`` label +F-check-cfg +S-waiting-on-MCP
r? ``@petrochenkov``
2024-05-29 03:25:07 +01:00
许杰友 Jieyou Xu (Joe)
2d3b1e014b
Rollup merge of #124251 - scottmcm:unop-ptr-metadata, r=oli-obk
Add an intrinsic for `ptr::metadata`

The follow-up to #123840, so we can remove `PtrComponents` and `PtrRepr` from libcore entirely (well, after a bootstrap update).

As discussed in <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/.60ptr_metadata.60.20in.20MIR/near/435637808>, this introduces `UnOp::PtrMetadata` taking a raw pointer and returning the associated metadata value.

By no longer going through a `union`, this should also help future PRs better optimize pointer operations.

r? ``@oli-obk``
2024-05-29 03:25:07 +01:00
Lokathor
bb1f5c38c0 delete the offending single space. 2024-05-28 17:30:30 -06:00
Lokathor
d8704b9ac6 It's spelled "ARM", in all caps. 2024-05-28 17:16:36 -06:00
Ben Kimock
483485e19e Add a benchmark for creating large uninit allocations 2024-05-28 19:13:31 -04:00
Lokathor
144adf6787 update armv4t docs 2024-05-28 17:08:19 -06:00
Lokathor
f6463142ee make the fact that arm-none-eabi is a group of targets the first thing you see on the page. 2024-05-28 16:15:28 -06:00
Lokathor
a126c110d9 Reorder the TOC so that targets are put under their meta-group 2024-05-28 16:07:48 -06:00
bors
da159eb331 Auto merge of #125682 - weihanglo:update-cargo, r=weihanglo
Update cargo

5 commits in a8d72c675ee52dd57f0d8f2bae6655913c15b2fb..431db31d0dbeda320caf8ef8535ea48eb3093407
2024-05-24 03:34:17 +0000 to 2024-05-28 18:17:31 +0000
- Include `lints.rust.unexpected_cfgs.check-cfg` in the fingerprint (rust-lang/cargo#13958)
- feat(test): Auto-redact elapsed time (rust-lang/cargo#13973)
- chore: Update to snapbox 0.6 (rust-lang/cargo#13963)
- fix: check if rev is full commit sha for github fast path (rust-lang/cargo#13969)
- test: switch from `drop` to `let _` due to nightly rustc change (rust-lang/cargo#13964)

r? ghost
2024-05-28 20:31:04 +00:00
Paul Gey
d5235f91ad Fix "local crate" detection
`PackageId` is an opaque identifier whose internal format is subject to
change, so looking up the names of local crates by ID is more robust
than parsing the ID.

Resolves #3643.
2024-05-28 22:28:55 +02:00
Oneirical
d553d5ba2d rewrite incr-prev-body-beyond-eof in rmake 2024-05-28 15:41:51 -04:00
Weihang Lo
037577a95a
Update cargo 2024-05-28 15:31:13 -04:00
David Mládek
4be8e5a372 add FlycheckStatus to global state 2024-05-28 20:45:13 +02:00
Oneirical
b4834a1c98 rewrite resolve-rename in rmake 2024-05-28 14:37:08 -04:00
Scott McMurray
57948c84ec Add Miri smoke pass test for ptr_metadata intrinsic 2024-05-28 09:28:51 -07:00
Scott McMurray
5a8c1f372a Add Miri tests for PtrMetadata UB 2024-05-28 09:28:51 -07:00
Ralf Jung
4991fd95dd move ./miri environment variables to CONTRIBUTING 2024-05-28 18:28:35 +02:00
Matthias Krüger
faabc74625
Rollup merge of #125637 - nnethercote:rustfmt-fixes, r=GuillaumeGomez
rustfmt fixes

The `rmake.rs` entries in `rustfmt.toml` are causing major problems for `x fmt`. This PR removes them and does some minor related cleanups.

r? ``@GuillaumeGomez``
2024-05-28 18:04:33 +02:00
Matthias Krüger
86f6fae93d
Rollup merge of #125590 - ChrisDenton:mingw-ci-3, r=Kobzol
Add a "Setup Python" action for github-hosted runners and remove unnecessary `CUSTOM_MINGW` environment variable

The Setup Python action isn't strictly necessary ([even on Windows](https://github.com/rust-lang/rust/pull/125584)) but it is [recommend by GitHub](https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#specifying-a-python-version).

The `CUSTOM_MINGW` environment variable is redundant now as it's always set for mingw and always unset otherwise.

try-job: x86_64-mingw
try-job: x86_64-mingw
try-job: dist-x86_64-msvc
try-job: dist-x86_64-mingw
2024-05-28 18:04:32 +02:00
Matthias Krüger
78b4cafa6e
Rollup merge of #125573 - GuillaumeGomez:migrate-allow-warnings-cmdline-stability, r=jieyouxu
Migrate `run-make/allow-warnings-cmdline-stability` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ``@jieyouxu``
2024-05-28 18:04:32 +02:00
Oneirical
cc97376ade Rewrite simple-rlib to rmake 2024-05-28 11:41:53 -04:00
Oli Scherer
ddc5f9b6c1 Create const block DefIds in typeck instead of ast lowering 2024-05-28 13:38:43 +00:00
Mads Marquart
e6b9bb7b72 Make more of the test suite run on Mac Catalyst
This adds the `only-apple`/`ignore-apple` compiletest directive, and
uses that basically everywhere instead of `only-macos`/`ignore-macos`.

Some of the updates in `run-make` are a bit redundant, as they use
`ignore-cross-compile` and won't run on iOS - but using Apple in these
is still more correct, so I've made that change anyhow.
2024-05-28 12:31:33 +02:00
Nicholas Nethercote
f1b0ca08a4 Don't format tests/run-make/*/rmake.rs.
It's reasonable to want to, but in the current implementation this
causes multiple problems.

- All the `rmake.rs` files are formatted every time even when they
  haven't changed. This is because they get whitelisted unconditionally
  in the `OverrideBuilder`, before the changed files get added.

- The way `OverrideBuilder` works, if any files gets whitelisted then no
  unmentioned files will get traversed. This is surprising, and means
  that the `rmake.rs` entries broke the use of explicit paths to `x
  fmt`, and also broke `GITHUB_ACTIONS=true git check --fmt`.

The commit removes the `rmake.rs` entries, fixes the formatting of a
couple of files that were misformatted (not previously caught due to the
`GITHUB_ACTIONS` breakage), and bans `!`-prefixed entries in
`rustfmt.toml` because they cause all these problems.
2024-05-28 19:28:46 +10:00
Nicholas Nethercote
4702a1c345 Fix comments.
Some are too long, some aren't complete sentences, some are complete
sentences but don't bother with an upper case letter at the start. All
annoying and hurt readability.
2024-05-28 19:28:21 +10:00
Guillaume Gomez
404d47ec20 Migrate run-make/allow-warnings-cmdline-stability to rmake.rs 2024-05-28 11:24:24 +02:00
Guillaume Gomez
56733372b8 Add assert_not_contains to run-make-support library 2024-05-28 11:24:23 +02:00
David Mládek
eeda60ddd8 fix diagnostics clearing when flychecks run per-workspace 2024-05-28 11:07:57 +02:00
Rémy Rakic
f0273664ce document DIST_TRY_BUILD 2024-05-28 08:52:33 +00:00
Rémy Rakic
822c3203c6 remove legacy rustsrc folder 2024-05-28 08:36:00 +00:00
The Miri Cronjob Bot
54db9aaa37 Merge from rustc 2024-05-28 05:20:27 +00:00
The Miri Cronjob Bot
4277ddf54e Preparing for merge from rustc 2024-05-28 05:12:58 +00:00
Chris Denton
ef9e6caabc
Fix run-make-support doc errors
error: redundant explicit link target because label contains path that resolves to same destination
2024-05-28 02:12:06 +00:00
Chris Denton
b119e42b18
Add run-make-support to x doc 2024-05-28 02:11:56 +00:00
Oneirical
634270e8da rewrite mixing-deps in rmake 2024-05-27 21:10:57 -04:00
Oneirical
d9d013bec0 rewrite lto-smoke to rmake 2024-05-27 20:57:01 -04:00
Ralf Jung
869306418d miri: avoid making a full copy of all new allocations 2024-05-27 23:33:54 +02:00
bors
84b40fc908 Auto merge of #125628 - matthiaskrgr:rollup-3zk9v3w, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #125339 (The number of tests does not depend on the architecture's pointer width)
 - #125542 (Migrate rustdoc verify output files)
 - #125616 (MIR validation: ensure that downcast projection is followed by field projection)
 - #125625 (Use grep to implement verify-line-endings)

Failed merges:

 - #125573 (Migrate `run-make/allow-warnings-cmdline-stability` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-27 20:49:23 +00:00
Matthias Krüger
4966e1ae35
Rollup merge of #125625 - ChrisDenton:line-endings, r=Mark-Simulacrum
Use grep to implement verify-line-endings

Unless I'm missing something (which I might be!) then `verify-line-endings` is easy to implement with `grep` rather than using a bespoke tool with varying availability.
2024-05-27 20:43:26 +02:00
Matthias Krüger
61f9d35798
Rollup merge of #125616 - RalfJung:mir-validate-downcast-projection, r=compiler-errors
MIR validation: ensure that downcast projection is followed by field projection

Cc https://github.com/rust-lang/rust/issues/120369
2024-05-27 20:43:26 +02:00
Matthias Krüger
e8dd585dd8
Rollup merge of #125542 - GuillaumeGomez:migrate-rustdoc-verify-output-files, r=jieyouxu
Migrate rustdoc verify output files

Part of https://github.com/rust-lang/rust/issues/121876.

r? ```@jieyouxu```
2024-05-27 20:43:25 +02:00
Matthias Krüger
8bd15878eb
Rollup merge of #125339 - tbu-:pr_tidy_ui_tests_u32, r=clubby789
The number of tests does not depend on the architecture's pointer width

Use `u32` instead of `usize` for counting them.
2024-05-27 20:43:24 +02:00
bors
f00b02e6bb Auto merge of #125599 - camelid:clarify-stability, r=notriddle,GuillaumeGomez
rustdoc: Clarify const-stability with regard to normal stability

Fixes #125511.

- Elide const-unstable if also unstable overall
- Show "const" for const-unstable if also overall unstable
2024-05-27 18:42:42 +00:00
Chris Denton
7a847fc4fb
Use grep to implement verify-line-endings 2024-05-27 17:19:58 +00:00
bors
c1b051602c Auto merge of #17258 - maxwase:code-assist-async-sugar, r=Veykril
Add `toggle_async_sugar` assist code action

Implement code action for sugaring and de-sugaring asynchronous functions.

This code action does not import `Future` trait when de-sugaring and does not touch function boby, I guess this can be implemented later if needed. This action also does not take into consideration other bounds because IMO it's usually "let me try to use sugared version here".

Feel free to request changes, that's my first code action implementation 😄

Closes #17010
Relates to #16195
2024-05-27 16:40:04 +00:00
bors
cbd40a2da4 Auto merge of #17253 - ThouCheese:master, r=Veykril
Implement assist to switch between doc and normal comments

Hey first PR to rust-analyzer to get my feet wet with the code base. It's an assist to switch a normal comment to a doc comment and back, something I've found myself doing by hand a couple of times.

I shamelessly stole `relevant_line_comments` from `convert_comment_block`, because I didn't see any inter-assist imports happening in the files I peeked at so I thought this would be preferable.
2024-05-27 16:27:23 +00:00
bors
9fe2afcc8e Auto merge of #17291 - kilpkonn:master, r=Veykril
Fix `data_constructor` ignoring generics for struct

Previously didn't work for structs with generics due to `field.ty()` having placeholders in type.
_Enums were handeled correctly already._

Also renamed `type_constructor -> data_constructor` as this is more correct name for it
2024-05-27 16:15:10 +00:00
Ralf Jung
98a3ac9e6d also add type aliases for the pointer types 2024-05-27 17:40:02 +02:00
Ralf Jung
fcb4cf52d8 avoid repeating the Provenance parameter everywhere 2024-05-27 17:30:05 +02:00
Ralf Jung
84f70abacb fmt 2024-05-27 16:43:30 +02:00
Ralf Jung
8058933c7d Merge from rustc 2024-05-27 16:42:12 +02:00
Ralf Jung
d562cec048 Preparing for merge from rustc 2024-05-27 16:41:53 +02:00
Ralf Jung
7d24f87068 MIR validation: ensure that downcast projection is followed by field projection 2024-05-27 16:32:12 +02:00
bors
f6e4703e91 Auto merge of #125611 - GuillaumeGomez:rollup-dfavpgg, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #124870 (Update Result docs to the new guarantees)
 - #125148 (codegen: tweak/extend shift comments)
 - #125522 (Add "better" edition handling on lint-docs tool)
 - #125530 (cleanup dependence of `ExtCtxt` in transcribe when macro expansion)
 - #125535 (clean-up: remove deprecated field `dist.missing-tools`)
 - #125597 (Uplift `EarlyBinder` into `rustc_type_ir`)
 - #125607 (Migrate `run-make/compile-stdin` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-27 13:22:55 +00:00
Guillaume Gomez
bdf3864d51 Migrate run-make/rustdoc-verify-output-files to rmake.rs 2024-05-27 14:41:19 +02:00
Guillaume Gomez
f0ab814aec Add Rustdoc::output_format 2024-05-27 14:41:19 +02:00
Guillaume Gomez
1551fd1202 Add file path in case it cannot be read in Diff::actual_file 2024-05-27 14:41:19 +02:00
Guillaume Gomez
90fec5a087 Add copy_dir_all and recursive_diff functions to run-make-support 2024-05-27 14:41:19 +02:00
Guillaume Gomez
7083131c92
Rollup merge of #125607 - GuillaumeGomez:migrate-compile-stdin, r=jieyouxu
Migrate `run-make/compile-stdin` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-05-27 13:10:37 +02:00
Guillaume Gomez
cfa7ab474f
Rollup merge of #125535 - onur-ozkan:remove-deprecated-field, r=clubby789
clean-up: remove deprecated field `dist.missing-tools`

It's been 5 months since this field was deprecated.
2024-05-27 13:10:36 +02:00
Guillaume Gomez
ad37f40355
Rollup merge of #125522 - spastorino:fix-lint-docs-edition-handling, r=Urgau,michaelwoerister
Add "better" edition handling on lint-docs tool

r? `@Urgau`
2024-05-27 13:10:34 +02:00
bors
a59072ec4f Auto merge of #125602 - RalfJung:interpret-mir-lifetime, r=oli-obk
interpret: get rid of 'mir lifetime

I realized our MIR bodies are actually at lifetime `'tcx`, so we don't need to carry around this other lifetime everywhere.

r? `@oli-obk`
2024-05-27 11:01:15 +00:00
Guillaume Gomez
e4abfaeb62 Migrate run-make/compile-stdin to rmake.rs 2024-05-27 11:37:27 +02:00
Chris Denton
f931290949
Update description of install-mingw 2024-05-27 09:32:25 +00:00
bors
b582f807fa Auto merge of #125410 - fmease:adj-lint-diag-api, r=nnethercote
[perf] Delay the construction of early lint diag structs

Attacks some of the perf regressions from https://github.com/rust-lang/rust/pull/124417#issuecomment-2123700666.

See individual commits for details. The first three commits are not strictly necessary.
However, the 2nd one (06bc4fc671, *Remove `LintDiagnostic::msg`*) makes the main change way nicer to implement.
It's also pretty sweet on its own if I may say so myself.
2024-05-27 08:44:12 +00:00
bors
fec98b3bbc Auto merge of #125468 - BoxyUwU:remove_defid_from_regionparam, r=compiler-errors
Remove `DefId` from `EarlyParamRegion`

Currently we represent usages of `Region` parameters via the `ReEarlyParam` or `ReLateParam` variants. The `ReEarlyParam` is effectively equivalent to `TyKind::Param` and `ConstKind::Param` (i.e. it stores a `Symbol` and a `u32` index) however it also stores a `DefId` for the definition of the lifetime parameter.

This was used in roughly two places:
- Borrowck diagnostics instead of threading the appropriate `body_id` down to relevant locations. Interestingly there were already some places that had to pass down a `DefId` manually.
- Some opaque type checking logic was using the `DefId` field to track captured lifetimes

I've split this PR up into a commit for generate rote changes to diagnostics code to pass around a `DefId` manually everywhere, and another commit for the opaque type related changes which likely require more careful review as they might change the semantics of lints/errors.

Instead of manually passing the `DefId` around everywhere I previously tried to bundle it in with `TypeErrCtxt` but ran into issues with some call sites of `infcx.err_ctxt` being unable to provide a `DefId`, particularly places involved with trait solving and normalization. It might be worth investigating adding some new wrapper type to pass this around everywhere but I think this might be acceptable for now.

This pr also has the effect of reducing the size of `EarlyParamRegion` from 16 bytes -> 8 bytes. I wouldn't expect this to have any direct performance improvement however, other variants of `RegionKind` over `8` bytes are all because they contain a `BoundRegionKind` which is, as far as I know, mostly there for diagnostics. If we're ever able to remove this it would shrink the `RegionKind` type from `24` bytes to `12` (and with clever bit packing we might be able to get it to `8` bytes). I am curious what the performance impact would be of removing interning of `Region`'s if we ever manage to shrink `RegionKind` that much.

Sidenote: by removing the `DefId` the `Debug` output for `Region` has gotten significantly nicer. As an example see this opaque type debug print before vs after this PR:
`Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0, T, DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0])`
`Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), ['a/#0, T, 'a/#0])`

r? `@compiler-errors` (I would like someone who understands the opaque type setup to atleast review the type system commit, but the rest is likely reviewable by anyone)
2024-05-27 06:36:57 +00:00
Ralf Jung
e8379c9598 interpret: get rid of 'mir lifetime everywhere 2024-05-27 08:25:57 +02:00
Ralf Jung
36d36a3e1f interpret: the MIR is actually at lifetime 'tcx 2024-05-27 07:45:41 +02:00
Noah Lev
699d28f968 rustdoc: Show "const" for const-unstable if also overall unstable
If a const function is unstable overall (and thus, in all circumstances
I know of, also const-unstable), we should show the option to use it as
const. You need to enable a feature to use the function at all anyway.

If the function is stabilized without also being const-stabilized, then
we do not show the const keyword and instead show "const: unstable" in
the version info.
2024-05-26 21:06:02 -07:00
bors
cdc509f7c0 Auto merge of #125580 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-05-27 02:23:10 +00:00
Chris Denton
f63931bc1a
Cleanup custom mingw in CI 2024-05-26 22:43:40 +00:00
bors
0aad3f64e2 Auto merge of #125576 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-05-26 22:08:06 +00:00
bors
da6c08e865 Auto merge of #3634 - RalfJung:macro_use, r=RalfJung
avoid using macro_use

This is the Miri version of https://github.com/rust-lang/rust/pull/124914
2024-05-26 21:10:05 +00:00
Ralf Jung
38870cf09c avoid using macro_use 2024-05-26 22:56:07 +02:00
bors
b531ca7ca8 Auto merge of #3629 - devnexen:illumos_num_cpus, r=RalfJung
solarish platform: add support for available-parallelism.
2024-05-26 20:45:36 +00:00
Ralf Jung
d3974fabfd
reorder code 2024-05-26 22:43:58 +02:00
David Carlier
887c130863 solarish platform add supports for available-parallelism. 2024-05-26 20:22:36 +00:00
bors
bdbbb6c6a7 Auto merge of #125546 - ChrisDenton:mingw-ci, r=Mark-Simulacrum
Try to not reinstall tools in mingw CI

Reinstalling the tools seems prone to failure (e.g. [latest](https://github.com/rust-lang/rust/pull/125529#issuecomment-2130919307)) and is more work. It also seems unnecessary as CI actually uses a vendored tarball for builds.

cc `@mati865`
2024-05-26 18:50:48 +00:00
bors
0963353634 Auto merge of #3631 - RalfJung:blocking-refactor, r=RalfJung
completely refactor how we manage blocking and unblocking threads

This hides a lot of invariants from the implementation of the synchronization primitives, and makes sure we never have to release or acquire a vector clock on another thread but the active one.
2024-05-26 18:36:10 +00:00
Ralf Jung
2e89443b93 add a macro to declare thread unblock callbacks 2024-05-26 19:15:05 +02:00
bors
8e861c6c4c Auto merge of #3632 - RalfJung:readdir, r=RalfJung
unix/fs: a bit of cleanup in macos_fbsd_readdir_r
2024-05-26 15:22:18 +00:00
Ralf Jung
350f5c88db unix/fs: a bit of cleanup in macos_fbsd_readdir_r 2024-05-26 17:20:28 +02:00
Ralf Jung
cbec1288a2 fix './miri run --dep --target _' 2024-05-26 16:37:50 +02:00
Ralf Jung
e6bb468b53 data_race: vector indices can be reused immediately when the thread is gone 2024-05-26 16:11:04 +02:00
Ralf Jung
a131243557 completely refactor how we manage blocking and unblocking threads 2024-05-26 16:11:04 +02:00
Matthias Krüger
c7a17656a0
Rollup merge of #125473 - weihanglo:respect-existing-config-toml, r=Kobzol
fix(opt-dist): respect existing config.toml

This is another step toward making opt-dist work in sandboxed environments. See also <https://github.com/rust-lang/rust/pull/125465>.

opt-dist verifies the final built rustc against a subset of rustc test
suite. However it overwrote the pre-existing `config.toml` [^1],
and that results in ./vendor/ directory removed [^2].

Instead of overwriting, this patch use `--set <config-value>` to
override paths to rustc / cargo / llvm-config.

[^1]: 606afbb617/src/tools/opt-dist/src/tests.rs (L62-L77)
[^2]: 8679004993/src/bootstrap/bootstrap.py (L1057)
2024-05-26 13:43:06 +02:00
Matthias Krüger
e346404fca
Rollup merge of #125307 - workingjubilee:uproot-entry-limit, r=Mark-Simulacrum
tidy: stop special-casing tests/ui entry limit

It is genuinely more annoying to have this error, now that this value is below the general `ENTRY_LIMIT` cap, when one is trying to clean out tests from tests/ui! This code has served its purpose well, let it rest now rather than force it to continue haunting us.
2024-05-26 13:43:05 +02:00
Chris Denton
941aa47433
Do less reinstalling in mingw CI 2024-05-26 10:52:31 +00:00
bors
f7ca8a6d66 Auto merge of #17296 - mathew-horner:no-clone-target, r=Veykril
Avoid clone when constructing runnable label.

I stumbled across this when reading this code. This seems like an unnecessary allocation (though likely small?)
2024-05-26 09:11:55 +00:00
Ralf Jung
5fa30f7eaa make release_clock always work on the current thread 2024-05-26 10:43:25 +02:00
Noah Lev
fa7a3f9049 rustdoc: Elide const-unstable if also unstable overall
It's confusing because if a function is unstable overall, there's no
need to highlight the constness is also unstable. Technically, these
attributes (overall stability and const-stability) are separate, but in
practice, we don't even show the const-unstable's feature flag (it's
normally the same as the overall function).
2024-05-25 23:05:27 -07:00
Weihang Lo
c81a40bbc0
opt-dist: dont overrwite config.toml when verifying
This is another step toward making opt-dist work in sandboxed environments

opt-dist verifies the final built rustc against a subset of rustc test
suite. However it overwrote the pre-existing `config.toml` [^1],
and that results in ./vendor/ directory removed [^2].

Instead of overwriting, this patch use `--set <config-value>` to
override paths to rustc / cargo / llvm-config.

[^1]: 606afbb617/src/tools/opt-dist/src/tests.rs (L62-L77)
[^2]: 8679004993/src/bootstrap/bootstrap.py (L1057)
2024-05-25 23:23:47 -04:00
bors
0a59f11362 Auto merge of #125552 - matthiaskrgr:rollup-f1yybpn, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #121377 (Stabilize `LazyCell` and `LazyLock`)
 - #122986 (Fix c_char on AIX)
 - #123803 (Fix `VecDeque::shrink_to` UB when `handle_alloc_error` unwinds.)
 - #124080 (Some unstable changes to where opaque types get defined)
 - #124667 (Stabilize `div_duration`)
 - #125472 (tidy: validate LLVM component names in tests)
 - #125523 (Exit the process a short time after entering our ctrl-c handler)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-25 22:26:32 +00:00
Jonas Rinke
eb9894f3c9 Removed return 2024-05-25 22:42:39 +02:00
Matthias Krüger
64730a1632
Rollup merge of #125472 - erikdesjardins:component, r=clubby789
tidy: validate LLVM component names in tests

LLVM component names are not immediately obvious (they usually omit any suffixes on the target arch name), and if they're incorrect, the test will silently never run.

This happened [here](https://github.com/rust-lang/rust/pull/125220#discussion_r1612626002), and it would be nice to prevent it.
2024-05-25 22:15:18 +02:00
Matthias Krüger
890982e47b
Rollup merge of #121377 - pitaj:lazy_cell_fn_pointer, r=dtolnay
Stabilize `LazyCell` and `LazyLock`

Closes #109736

This stabilizes the [`LazyLock`](https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html) and [`LazyCell`](https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html) types:

```rust
static HASHMAP: LazyLock<HashMap<i32, String>> = LazyLock::new(|| {
    println!("initializing");
    let mut m = HashMap::new();
    m.insert(13, "Spica".to_string());
    m.insert(74, "Hoyten".to_string());
    m
});

let lazy: LazyCell<i32> = LazyCell::new(|| {
    println!("initializing");
    92
});
```

r? libs-api
2024-05-25 22:15:16 +02:00
bors
1ba35e9bb4 Auto merge of #125515 - weihanglo:target-toml-override, r=onur-ozkan
bootstrap: support target specific config overrides

Can't find any previous discussion about not supporting this,
so I get it done.

The motivation of this is from <https://github.com/rust-lang/rust/pull/125473#issuecomment-2129954990>.
2024-05-25 20:15:11 +00:00
Mathew Horner
afa8dfc51f
Avoid clone when constructing runnable label. 2024-05-25 15:00:15 -05:00
bors
14562ddf8c Auto merge of #125502 - weihanglo:update-rustc-perf, r=Kobzol
Update rustc-perf

Just check if the latest commit works.

4f313add60...cc81f9654d

See discussion on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/tempfile.20in.20rustc-perf.20make.20it.20hard.20to.20configure.20vendor/near/440442827

r? ghost
2024-05-25 15:31:40 +00:00
Jonas Rinke
09677b03dd Formatting 2024-05-25 17:08:17 +02:00
Jonas Rinke
78fe45e273 Semicolon 2024-05-25 17:04:48 +02:00
Jonas Rinke
2315c6b764 Use correct format for setting environment variables when debugging with cpptools 2024-05-25 16:53:01 +02:00
bors
0b2f194b83 Auto merge of #125541 - matthiaskrgr:rollup-4gwt4xp, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #125271 (use posix_memalign on almost all Unix targets)
 - #125451 (Fail relating constants of different types)
 - #125478 (Bump bootstrap compiler to the latest beta compiler)
 - #125498 (Stop using the avx512er and avx512pf x86 target features)
 - #125510 (remove proof tree formatting, make em shallow)
 - #125513 (Don't eagerly monomorphize drop for types that are impossible to instantiate)
 - #125514 (Structurally resolve before `builtin_index` in EUV)
 - #125527 (Add manual Sync impl for ReentrantLockGuard)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-25 12:52:43 +00:00
Matthias Krüger
e58a0a8961
Rollup merge of #125478 - Urgau:check-cfg-config-bump-stage0, r=Mark-Simulacrum
Bump bootstrap compiler to the latest beta compiler

This PR updates the bootstrap compiler, aka stage0 to the latest beta version, since it contains rust-lang/cargo#13925.

It removes those unconditional Cargo warnings:

```
warning: [...]/rust/library/core/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: [...]/rust/library/std/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: [...]/rust/library/alloc/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
```

for all contributors/users of this repository (including CI).

I don't know if that's something we do, or if it's even advisable, feel free to close.

r? `@Mark-Simulacrum`
2024-05-25 12:54:35 +02:00
bors
77d4115655 Auto merge of #125524 - weihanglo:update-cargo, r=weihanglo
Update cargo

7 commits in 84dc5dc11a9007a08f27170454da6097265e510e..a8d72c675ee52dd57f0d8f2bae6655913c15b2fb
2024-05-20 18:57:08 +0000 to 2024-05-24 03:34:17 +0000
- Improve error description when deserializing partial field struct (rust-lang/cargo#13956)
- fix: remove symlink dir on Windows (rust-lang/cargo#13910)
- Fix wrong type of rustc-flags in documentation (rust-lang/cargo#13957)
- Add more high level traces (rust-lang/cargo#13951)
- upgrade gix from 0.62 to 0.63 (rust-lang/cargo#13948)
- Use `i32` rather than `usize` as "default integer" in library template (rust-lang/cargo#13939)
- fetch specific commits even if the github fast path fails (rust-lang/cargo#13946)

r? ghost
2024-05-25 10:44:58 +00:00
Tavo Annus
6d6bef0fdf Fix data_constructor ignoring generics for struct 2024-05-25 13:09:26 +03:00
onur-ozkan
c76477d909 add change entry
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-05-25 10:37:36 +03:00
onur-ozkan
56dddd4c7e Remove deprecated field dist.missing-tools
It's been 5 months since this field was deprecated.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-05-25 10:35:07 +03:00