Commit graph

259554 commits

Author SHA1 Message Date
bors 11dd90f761 Auto merge of #127360 - GuillaumeGomez:rollup-f0zs1qr, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #124290 (DependencyList: removed outdated comment)
 - #126709 (Migrate `include_bytes_deps`, `optimization-remarks-dir-pgo`, `optimization-remarks-dir`, `issue-40535` and `rmeta-preferred` `run-make` tests to rmake)
 - #127214 (Use the native unwind function in miri where possible)
 - #127320 (Update windows-bindgen to 0.58.0)
 - #127349 (Tweak `-1 as usize` suggestion)
 - #127352 (coverage: Rename `mir::coverage::BranchInfo` to `CoverageInfoHi`)
 - #127359 (Improve run make llvm ident code)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-05 11:32:40 +00:00
Guillaume Gomez 4fd3b123bc
Rollup merge of #127359 - GuillaumeGomez:improve-run-make-llvm-ident-code, r=jieyouxu
Improve run make llvm ident code

I took the commits that are not blocking https://github.com/rust-lang/rust/pull/127237.

r? `@Kobzol`
2024-07-05 11:33:18 +02:00
Guillaume Gomez e4d7f7c9e6
Rollup merge of #127352 - Zalathar:coverage-info, r=oli-obk
coverage: Rename `mir::coverage::BranchInfo` to `CoverageInfoHi`

This opens the door to collecting and storing coverage information that is unrelated to branch coverage or MC/DC, during MIR building.

There is no change to the output of coverage instrumentation, but one deliberate change is that functions now *always* have an attached `CoverageInfoHi` (if coverage is enabled and they are eligible), even if they didn't collect any interesting branch information.

---

`@rustbot` label +A-code-coverage
2024-07-05 11:33:17 +02:00
Guillaume Gomez 6d3f2b1040
Rollup merge of #127349 - estebank:negative-unsigned-literal, r=petrochenkov
Tweak `-1 as usize` suggestion

When writing a negative unsigned integer literal, use a verbose suggestion and account for `as` casting.
2024-07-05 11:33:17 +02:00
Guillaume Gomez 80a9717091
Rollup merge of #127320 - ChrisDenton:win-sys, r=Mark-Simulacrum
Update windows-bindgen to 0.58.0

This also switches from the bespoke `std` generated bindings to the normal `sys` ones everyone else uses.

This has almost no difference except that the  `sys` bindings use the `windows_targets::links!` macro for FFI imports, which we implement manually. This does cause the diff to look much larger than it really is but the bulk of the changes are mostly contained to the generated code.
2024-07-05 11:33:16 +02:00
Guillaume Gomez 7a208c72b0
Rollup merge of #127214 - bjorn3:miri_native_unwind, r=oli-obk
Use the native unwind function in miri where possible

Continuation of https://github.com/rust-lang/miri/pull/3319

cc `@RalfJung`
2024-07-05 11:33:15 +02:00
Guillaume Gomez e66f4d3356
Rollup merge of #126709 - Oneirical:exitestial-crisis, r=jieyouxu
Migrate `include_bytes_deps`, `optimization-remarks-dir-pgo`, `optimization-remarks-dir`, `issue-40535` and `rmeta-preferred` `run-make` tests to rmake

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

Needs BSD tryjob.

try-job: aarch64-apple
try-job: x86_64-msvc
try-job: armhf-gnu
try-job: test-various
2024-07-05 11:33:15 +02:00
Guillaume Gomez 7a79392c82
Rollup merge of #124290 - klensy:dep-format, r=jieyouxu
DependencyList: removed outdated comment

Comment was outdated. Didn't updated description, as `Linkage` enum have descriptive names.

Also added fixme about moving this file to rustc_metadata.
2024-07-05 11:33:14 +02:00
Guillaume Gomez 415e202c48 Improve code of run-make/llvm-ident test 2024-07-05 11:19:52 +02:00
bors 2ad6630673 Auto merge of #127008 - Jules-Bertholet:tc-ergonomics, r=Nadrieril
Match ergonomics 2024: Implement TC's match ergonomics proposal

Under gate `ref_pat_eat_one_layer_2024_structural`. Enabling `ref_pat_eat_one_layer_2024` at the same time allows the union of what the individual gates allow. `@traviscross`

r? `@Nadrieril`

cc https://github.com/rust-lang/rust/issues/123076

`@rustbot` label A-edition-2024 A-patterns
2024-07-05 09:10:17 +00:00
Guillaume Gomez 3e4368053f Improve Command::args API in run-make-support 2024-07-05 10:53:22 +02:00
bors d2e6cf7fa7 Auto merge of #127344 - matthiaskrgr:morecrashes, r=jieyouxu
crashes: add latest

r? `@jieyouxu`
`@bors` rollup=iffy
2024-07-05 06:19:47 +00:00
Zalathar f96f443631 Tweak how the extra newline is printed after coverage info 2024-07-05 13:53:05 +10:00
Zalathar f095de4bf1 coverage: Rename mir::coverage::BranchInfo to CoverageInfoHi
This opens the door to collecting and storing coverage information that is
unrelated to branch coverage or MC/DC.
2024-07-05 13:53:05 +10:00
bors 51917ba8f2 Auto merge of #126171 - RalfJung:simd_bitmask_multibyte, r=workingjubilee
simd_bitmask intrinsic: add a non-power-of-2 multi-byte example

r? `@calebzulawski` `@workingjubilee`
2024-07-05 01:58:22 +00:00
Esteban Küber 86a19467c1 Tweak -1 as usize suggestion
When writing a negative unsigned integer literal, use a verbose suggestion and account for `as` casting.
2024-07-05 00:52:01 +00:00
bors 489233170a Auto merge of #123781 - RalfJung:miri-fn-identity, r=oli-obk
Miri function identity hack: account for possible inlining

Having a non-lifetime generic is not the only reason a function can be duplicated. Another possibility is that the function may be eligible for cross-crate inlining. So also take into account the inlining attribute in this Miri hack for function pointer identity.

That said, `cross_crate_inlinable` will still sometimes return true even for `inline(never)` functions:
- when they are `DefKind::Ctor(..) | DefKind::Closure` -- I assume those cannot be `InlineAttr::Never` anyway?
- when `cross_crate_inline_threshold == InliningThreshold::Always`

so maybe this is still not quite the right criterion to use for function pointer identity.
2024-07-04 23:45:56 +00:00
Matthias Krüger eb19e8106b crashes: add latest 2024-07-04 23:44:10 +02:00
bors cc8da78a03 Auto merge of #127288 - lqd:typelen-cache, r=compiler-errors
cache type sizes in type-size limit visitor

This is basically https://github.com/rust-lang/rust/pull/125507#issuecomment-2206813779 as lcnr can't open the PR now.

Locally it reduces the `itertools` regression by quite a bit, to "only +50%" compared to nightly (that includes overhead from the local lack of artifact post-processing, and is just a data point to compare to the 10-20x timings without the cache).

```console
Benchmark 1: cargo +stage1 build --release
  Time (mean ± σ):      2.721 s ±  0.009 s    [User: 2.446 s, System: 0.325 s]
  Range (min … max):    2.710 s …  2.738 s    10 runs

Benchmark 2: cargo +nightly build --release
  Time (mean ± σ):      1.784 s ±  0.005 s    [User: 1.540 s, System: 0.279 s]
  Range (min … max):    1.778 s …  1.792 s    10 runs

Summary
  cargo +nightly build --release ran
    1.52 ± 0.01 times faster than cargo +stage1 build --release
```

On master, it's from 34s to the 2.7s above.

r? compiler-errors
2024-07-04 21:17:19 +00:00
bors c422581297 Auto merge of #127317 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-07-04 18:57:16 +00:00
bors 8a9cccb100 Auto merge of #127326 - matthiaskrgr:rollup-kz7vd3w, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #123043 (Disable dead variant removal for `#[repr(C)]` enums.)
 - #126405 (Migrate some rustc_builtin_macros to SessionDiagnostic)
 - #127037 (Remove some duplicated tests)
 - #127283 (Reject SmartPointer constructions not serving the purpose)
 - #127301 (Tweak some structured suggestions to be more verbose and accurate)
 - #127307 (Allow to have different types for arguments of `Rustc::remap_path_prefix`)
 - #127309 (jsondocck: add `$FILE` built-in variable)
 - #127314 (Trivial update on tidy bless note)
 - #127319 (Remove a use of `StructuredDiag`, which is incompatible with automatic error tainting and error translations)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-04 16:37:39 +00:00
Matthias Krüger dd42f7a0a6
Rollup merge of #127319 - oli-obk:fail2taint, r=compiler-errors
Remove a use of `StructuredDiag`, which is incompatible with automatic error tainting and error translations

fixes #127219

I want to remove all of `StructuredDiag`, but it's a bit more involved as it is also used from the `ItemCtxt`, which doesn't support tainting yet.
2024-07-04 18:16:26 +02:00
Matthias Krüger 1652721ea1
Rollup merge of #127314 - chenyukang:yukang-fix-bless-note, r=albertlarsan68
Trivial update on tidy bless note

Make the notes more verbose.
2024-07-04 18:16:25 +02:00
Matthias Krüger 6f43a02c12
Rollup merge of #127309 - its-the-shrimp:jsondocck_add_file_var, r=aDotInTheVoid
jsondocck: add `$FILE` built-in variable

This built-in variable will allow accessing the full path to the currently tested file and allow to test things like source code spans generated by rustdoc-json, and that is exactly the reason why I've come up with the idea to add this

[futher discussion on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/rustdoc-json.20test.20help/near/449039819)
2024-07-04 18:16:25 +02:00
Matthias Krüger c091d09b04
Rollup merge of #127307 - GuillaumeGomez:different-types-remap_path_prefix, r=Kobzol
Allow to have different types for arguments of `Rustc::remap_path_prefix`

r? `@Kobzol`
2024-07-04 18:16:24 +02:00
Matthias Krüger 54bd3a7b8d
Rollup merge of #127301 - estebank:fix-suggestions, r=Urgau
Tweak some structured suggestions to be more verbose and accurate

Addressing some issues I found while working on #127282.
```
error: this URL is not a hyperlink
  --> $DIR/auxiliary/include-str-bare-urls.md:1:11
   |
LL | HEADS UP! https://example.com MUST SHOW UP IN THE STDERR FILE!
   |           ^^^^^^^^^^^^^^^^^^^
   |
   = note: bare URLs are not automatically turned into clickable links
note: the lint level is defined here
  --> $DIR/include-str-bare-urls.rs:14:9
   |
LL | #![deny(rustdoc::bare_urls)]
   |         ^^^^^^^^^^^^^^^^^^
help: use an automatic link instead
   |
LL | HEADS UP! <https://example.com> MUST SHOW UP IN THE STDERR FILE!
   |           +                   +
```
```
error[E0384]: cannot assign twice to immutable variable `v`
  --> $DIR/assign-imm-local-twice.rs:7:5
   |
LL |     v = 1;
   |     ----- first assignment to `v`
LL |     println!("v={}", v);
LL |     v = 2;
   |     ^^^^^ cannot assign twice to immutable variable
   |
help: consider making this binding mutable
   |
LL |     let mut v: isize;
   |         +++
```
```
error[E0393]: the type parameter `Rhs` must be explicitly specified
  --> $DIR/issue-22560.rs:9:23
   |
LL | trait Sub<Rhs=Self> {
   | ------------------- type parameter `Rhs` must be specified for this
...
LL | type Test = dyn Add + Sub;
   |                       ^^^
   |
   = note: because of the default `Self` reference, type parameters must be specified on object types
help: set the type parameter to the desired type
   |
LL | type Test = dyn Add + Sub<Rhs>;
   |                          +++++
```
```
error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
  --> $DIR/issue-33819.rs:4:34
   |
LL |         Some(ref v) => { let a = &mut v; },
   |                                  ^^^^^^ cannot borrow as mutable
   |
help: try removing `&mut` here
   |
LL -         Some(ref v) => { let a = &mut v; },
LL +         Some(ref v) => { let a = v; },
   |
```
```
help: remove the invocation before committing it to a version control system
   |
LL -     dbg!();
   |
```
```
error[E0308]: mismatched types
  --> $DIR/issue-39974.rs:1:21
   |
LL | const LENGTH: f64 = 2;
   |                     ^ expected `f64`, found integer
   |
help: use a float literal
   |
LL | const LENGTH: f64 = 2.0;
   |                      ++
```
```
error[E0529]: expected an array or slice, found `Vec<i32>`
  --> $DIR/match-ergonomics.rs:8:9
   |
LL |         [&v] => {},
   |         ^^^^ pattern cannot match with input type `Vec<i32>`
   |
help: consider slicing here
   |
LL |     match x[..] {
   |            ++++
```
```
error[E0609]: no field `0` on type `[u32; 1]`
  --> $DIR/parenthesized-deref-suggestion.rs:10:21
   |
LL |     (x as [u32; 1]).0;
   |                     ^ unknown field
   |
help: instead of using tuple indexing, use array indexing
   |
LL |     (x as [u32; 1])[0];
   |                    ~ +
```
2024-07-04 18:16:24 +02:00
Matthias Krüger d27136fb29
Rollup merge of #127283 - dingxiangfei2009:check-repr-transparent, r=davidtwco
Reject SmartPointer constructions not serving the purpose

Tracking issue: #123430

With this PR we will reject a row of malformed `SmartPointer` implementor candidates.

cc `@Darksonn` `@davidtwco` for context.
2024-07-04 18:16:23 +02:00
Matthias Krüger e62956dea5
Rollup merge of #127037 - oli-obk:define_opaque_types18, r=davidtwco
Remove some duplicated tests

probably some parallel PR development that happened here, copying over the same examples from issues.
2024-07-04 18:16:23 +02:00
Matthias Krüger b16a711191
Rollup merge of #126405 - He1pa:translate_builtin_macro_diag, r=davidtwco
Migrate some rustc_builtin_macros to SessionDiagnostic

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->

Part of https://github.com/rust-lang/rust/issues/100717.
pick up abandoned pr: #101935
`@rustbot` label +A-translation
2024-07-04 18:16:22 +02:00
Matthias Krüger f0a0f8f7e8
Rollup merge of #123043 - GoldsteinE:fix/repr-c-dead-branches, r=oli-obk
Disable dead variant removal for `#[repr(C)]` enums.

This prevents removing dead branches from a `#[repr(C)]` enum (they now get discriminants allocated as if they were inhabited).

Implementation notes: ABI of something like

```rust
#[repr(C)]
enum Foo {
    Foo(!),
}
```

is still `Uninhabited`, but its layout is now computed as if all the branches were inhabited.
This seemed to me like a proper way to do it, especially given that ABI sanity check explicitly asserts that type-level uninhabitedness implies ABI uninhabitedness.

This probably needs some sort of FCP (given that it changes `#[repr(C)]` layout, which is a stable guarantee), but I’m not sure how to call for one or which team is the most relevant.

See https://github.com/rust-lang/unsafe-code-guidelines/issues/500.
2024-07-04 18:16:22 +02:00
bors 9f877c9cd2 Auto merge of #127170 - bjorn3:no_specialize_index_borrowck, r=michaelwoerister
Stop using specialization in rustc_index and rustc_borrowck

For rustc_borrowck the version with specialization isn't much more readable anyway IMO. For rustc_index it probably doesn't affect perf in any noticeable way anyway.
2024-07-04 14:24:43 +00:00
Oneirical 3ea36f5bb6 add shallow_find_files helper function to run-make-support 2024-07-04 10:05:56 -04:00
Oneirical b167a15d64 rewrite rmeta-preferred to rmake 2024-07-04 10:05:56 -04:00
Oneirical 5e23dfea9d rewrite and rename issue-40535 to rmake 2024-07-04 10:05:55 -04:00
Oneirical 651f02363d rewrite optimization-remarks-dir to rmake 2024-07-04 10:05:37 -04:00
Oneirical 73d7dc7f22 rewrite optimization-remarks-dir-pgo to rmake 2024-07-04 10:05:37 -04:00
Oneirical 40cad01f2f rewrite and rename include_bytes_deps to rmake 2024-07-04 10:05:37 -04:00
Chris Denton 14f4ed2ba3
Add comments to windows_targets.rs 2024-07-04 13:27:24 +00:00
Oli Scherer 0d54fe0d02 Remove a use of StructuredDiag, which is incompatible with automatic error tainting and error translations 2024-07-04 12:20:51 +00:00
Chris Denton 34860a56f0
Update windows-bindgen to 0.58.0 2024-07-04 12:18:38 +00:00
bors e2cf31a614 Auto merge of #127120 - Kobzol:bootstrap-cmd-refactor-3, r=onur-ozkan
Bootstrap command refactoring: consolidate output modes (step 3)

This PR is a continuation to https://github.com/rust-lang/rust/pull/126731. It consolidates the output modes of bootstrap (`Print` vs `CaptureAll` vs `CaptureStdout`) and simplifies the logic around error printing (now a command error is always printed if the failure is not ignored). It also ports even more usages of `Command` to `BootstrapCommand`, most notably the git helpers and many usages of the `output` function.

The last commit was added because the third commit made two variants of the `Tool` enum unused (no idea why, but it seems to have been a false positive that they were used before).

It can be reviewed now, but I would wait with merging until at least a few days after https://github.com/rust-lang/rust/pull/126731, just to catch any potential issues from that PR before we move further.

As a next step, I want to clean up the API of the command a little bit to make usage easier (currently it's a bit verbose), and then continue with the rest of the tasks from the tracking issue.

As always, best reviewed commit by commit.

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

r? `@onur-ozkan`

try-job: aarch64-apple
2024-07-04 10:54:22 +00:00
bors a3460e23ea Auto merge of #3732 - JoJoDeveloping:tree-borrows-protector-end-write, r=RalfJung
TB: Refine protector end semantics

Tree Borrows has protector end tag semantics, namely that protectors ending cause a [special implicit read](https://perso.crans.org/vanille/treebor/diff.0.html) on all locations protected by that protector that have actually been accessed. See also #3067.

While this is enough for ensuring protectors allow adding/reordering reads, it does not prove that one can reorder writes. For this, we need to make this stronger, by making this implicit read be a write in cases when there was a write to the location protected by that protector, i.e. if the permission is `Active`.

There is a test that shows why this behavior is necessary, see `tests/fail/tree_borrows/protector-write-lazy.rs`.
2024-07-04 10:31:24 +00:00
Johannes Hostert 02bec40930
TB: protector end semantics never causes immediate UB 2024-07-04 12:20:14 +02:00
yukang 87b741549c trivial update on tidy bless note 2024-07-04 10:07:22 +00:00
Johannes Hostert 0a86e79664
Add UI test for protector end write semantics 2024-07-04 12:05:33 +02:00
Johannes Hostert 8ef2c6c6af
TB: Make FnEntry access on protected locations be a write under certain circumstances 2024-07-04 12:05:23 +02:00
schvv31n 12f29e991a added built-in var to jsondocck 2024-07-04 10:18:57 +01:00
Guillaume Gomez 1471532131 Allow to have different types for arguments of Rustc::remap_path_prefix 2024-07-04 11:07:19 +02:00
Ding Xiang Fei 0b4edb2487
reject SmartPointer constructions not serving the purpose 2024-07-04 16:41:23 +08:00
bors 9ffe52e05b Auto merge of #127305 - jhpratt:rollup-3p5wf3h, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - #126792 (wasm64 build with target-feature=+simd128,+atomics)
 - #127195 (Remove unqualified form import of io::Error in process_vxworks.rs and fallback on remove_dir_impl for vxworks)
 - #127287 (jsondocck: Use correct index for error message.)
 - #127289 (rustdoc-json: Better representation of lifetime bounds in where clauses.)
 - #127303 (chore: remove repeat words)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-04 08:36:35 +00:00