Commit Graph

259584 Commits

Author SHA1 Message Date
bors
51917e2e69 Auto merge of #127403 - compiler-errors:rollup-x2yb5t0, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #123600 (impl PathBuf::add_extension and Path::with_added_extension)
 - #127107 (Improve dead code analysis)
 - #127221 (Improve well known value check-cfg diagnostic for the standard library)
 - #127333 (Split `SolverDelegate` back out from `InferCtxtLike`)
 - #127363 (Improve readability of some fmt code examples)
 - #127366 (Use `ControlFlow` results for visitors that are only looking for a single value)
 - #127368 (Added dots at the sentence ends of rustc AST doc)
 - #127393 (Remove clubby789 from review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-06 02:48:17 +00:00
Michael Goulet
b73a790904
Rollup merge of #127393 - clubby789:unreview, r=workingjubilee
Remove clubby789 from review rotation

These days I'm unfortunately too busy to be able to take up reviews, and it looks like some PRs have been blocked on this 😓
2024-07-05 20:49:35 -04:00
Michael Goulet
aeb1a65dbf
Rollup merge of #127368 - YohDeadfall:dots-in-docs, r=fmease
Added dots at the sentence ends of rustc AST doc

Just a tiny improvement for the AST documentation by bringing consistency to sentence ends. I intentionally didn't terminate every sentence, there are still some members not having them, but at least there's no mixing style on the type level.
2024-07-05 20:49:34 -04:00
Michael Goulet
a3535b963b
Rollup merge of #127366 - oli-obk:falliblevisitor, r=compiler-errors
Use `ControlFlow` results for visitors that are only looking for a single value

These visitors all had a `Option<Value>` or `bool` field, that, once set, was never unset or modified again. They have been refactored by removing the field and returning `ControlFlow` directly from the visitor
2024-07-05 20:49:34 -04:00
Michael Goulet
521d451bc4
Rollup merge of #127363 - GuillaumeGomez:improve-fmt-code-readability, r=Amanieu
Improve readability of some fmt code examples

Some indent was weird. Some examples were too long (overall better to keep it to maximum 80 columns, but only changed the most outstanding ones).

r? ```@Amanieu```
2024-07-05 20:49:33 -04:00
Michael Goulet
16ba4b773d
Rollup merge of #127333 - compiler-errors:infer_ctxt_like-again, r=lcnr
Split `SolverDelegate` back out from `InferCtxtLike`

This is because in order to uplift things like the `Generalizer` and other `TypeRelation`s, we want to be able to interface with `InferCtxtLike` (and `InferCtxt` as its implementation), rather that `SolverDelegate`, which only really exists as a hack to be able to define some downstream methods in `rustc_type_ir`.

r? lcnr
2024-07-05 20:49:32 -04:00
Michael Goulet
865518d1f2
Rollup merge of #127221 - Urgau:check-cfg-std-diag, r=pnkfelix
Improve well known value check-cfg diagnostic for the standard library

This PR adjust the current logic for hidding the rustc/Cargo suggestion to add a value to a well-known name to exclude the standard library and rustc crates.

This is done in order to improve the contributor experience, in particular when adding a new target, which often requires adding some cfgs like `target_os` which may not be available yet in stage0.

<details>

The diagnostic code would look like this.

```text
error: unexpected `cfg` condition value: `blable`
   --> library/core/src/lib.rs:369:7
    |
369 | #[cfg(target_os = "blable")]
    |       ^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, and `windows` and 2 more
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("blable"))'] }
    = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(target_os, values(\"blable\"))");` to the top of the `build.rs`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: `-D unexpected-cfgs` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`
```

</details>
2024-07-05 20:49:32 -04:00
Michael Goulet
31fe9628cf
Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelix
Improve dead code analysis

Fixes #120770

1. check impl items later if self ty is private although the trait method is public, cause we must use the ty firstly if it's private
2. mark the adt live if it appears in pattern, like generic argument, this implies the use of the adt
3. based on the above, we can handle the case that private adts impl Default, so that we don't need adding rustc_trivial_field_reads on Default, and the logic in should_ignore_item

r? ``@pnkfelix``
2024-07-05 20:49:31 -04:00
Michael Goulet
f20307851e
Rollup merge of #123600 - tisonkun:path_with_extension, r=dtolnay
impl PathBuf::add_extension and Path::with_added_extension

See the ACP for motivation and discussions - https://github.com/rust-lang/libs-team/issues/368
2024-07-05 20:49:31 -04:00
bors
5c08cc765a Auto merge of #127364 - DianQK:update-llvm, r=nikic
Update LLVM submodule

Fixes #127260. Fixes #127286.

r? `@nikic`
2024-07-06 00:23:38 +00:00
clubby789
9f66af4319 Remove clubby789 from review rotation 2024-07-05 22:08:13 +01:00
Michael Goulet
27588d1de3 Split SolverDelegate back out from InferCtxtLike 2024-07-05 16:39:39 -04:00
bors
524d806c62 Auto merge of #127312 - Kobzol:ci-org-agnostic, r=jdno
Make CI more agnostic of the owning GitHub organization

This should make it possible to switch running `auto` and `try` builds from `rust-lang-ci` to `rust-lang`.

r? `@jdno`
2024-07-05 20:06:15 +00:00
bors
6e2780775f Auto merge of #126957 - Oneirical:artestic-inspiration, r=jieyouxu,kobzol
Migrate `pgo-gen`, `pgo-use` and `profile` `run-make` tests to rmake.rs

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: aarch64-apple
try-job: x86_64-msvc
2024-07-05 17:46:11 +00:00
tison
3aa2abdd3d
add unit tests for extra extension feature
Signed-off-by: tison <wander4096@gmail.com>
2024-07-05 10:44:15 -07:00
tison
a0f4114ba9
update comments
Signed-off-by: tison <wander4096@gmail.com>
2024-07-05 10:29:35 -07:00
Yoh Deadfall
291ed596f7 Added dots at the sentence ends of rustc AST doc 2024-07-05 18:10:05 +03:00
Oli Scherer
7dca61b68b Use ControlFlow results for visitors that are only looking for a single value 2024-07-05 15:00:40 +00:00
Oneirical
c9be69fd0a Add shallow_find_files helper function to run-make-support 2024-07-05 10:25:48 -04:00
bors
9a21ac8e7e Auto merge of #127365 - aDotInTheVoid:compiler-doc-comments, r=Nilstrieb
Fix a few doc comment for compiler-interal API docs.

They only used `//` instead of `///` so weren't picked up by rustdoc.

r? `@Nilstrieb`
2024-07-05 14:18:28 +00:00
Oneirical
b15e72a9ed rewrite profile to rmake 2024-07-05 10:17:48 -04:00
Oneirical
a1555eb0d6 rewrite pgo-use to rmake 2024-07-05 10:17:48 -04:00
Oneirical
1e4d821136 rewrite pgo-gen to rmake 2024-07-05 10:17:46 -04:00
Alona Enraght-Moony
f763d62149 Fix a few doc comment for compiler-interal API docs.
They only used `//` instead of `///` so weren't picked up by rustdoc.
2024-07-05 14:14:35 +00:00
DianQK
3d699a4fa1
Update LLVM submodule 2024-07-05 22:06:57 +08:00
Guillaume Gomez
4abc51a219 Improve readability of some fmt code examples 2024-07-05 14:05:29 +02:00
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