Commit Graph

259756 Commits

Author SHA1 Message Date
Michael Goulet 23c6f23b21 Uplift push_outlives_components 2024-07-06 10:47:46 -04:00
Michael Goulet e5d6a416e8 Uplift PredicateEmittingRelation first 2024-07-06 10:05:49 -04:00
yukang f46c4129e0 show unit output when there is only output diff in diagnostics 2024-07-06 21:00:30 +08:00
Vadim Petrochenkov 83cf471361 out_of_scope_macro_calls: Detect calls inside attributes more precisely 2024-07-06 15:36:30 +03:00
lukas 3e9c9a05a8 Mark format! with must_use hint 2024-07-06 14:24:20 +02:00
bors 3bec61736a Auto merge of #127420 - matthiaskrgr:rollup-vpitwow, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #127275 (offset_from, offset: clearly separate safety requirements the user needs to prove from corollaries that automatically follow)
 - #127379 (rustdoc-search: stop constructing pointless arrays in decode)
 - #127391 (Use verbose suggestion for `ptr::null_mut()`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-06 12:07:55 +00:00
Camille GILLOT 0184c6f52e Cache hir_owner_nodes in ParentHirIterator. 2024-07-06 11:56:37 +00:00
Matthias Krüger 1e0028197f
Rollup merge of #127391 - estebank:null_mut, r=cjgillot
Use verbose suggestion for `ptr::null_mut()`
2024-07-06 13:26:26 +02:00
Matthias Krüger 04056524a0
Rollup merge of #127379 - notriddle:notriddle/decode, r=GuillaumeGomez
rustdoc-search: stop constructing pointless arrays in decode

I'm not sure why I ever thought that would be okay. This is clearly hot code, and should avoid Array.prototype.map when it's not needed. In any case, it shows up in the profiler.

rustdoc-js-profiler:
https://notriddle.com/rustdoc-html-demo-11/decode-opt-1/index.html

Firefox profiler:
[Before](https://share.firefox.dev/3RRH2fR)
[After](https://share.firefox.dev/3Wblcq8)
2024-07-06 13:26:26 +02:00
Matthias Krüger 2137d19ef6
Rollup merge of #127275 - RalfJung:offset-from-isize-min, r=Amanieu
offset_from, offset: clearly separate safety requirements the user needs to prove from corollaries that automatically follow

By landing https://github.com/rust-lang/rust/pull/116675 we decided that objects larger than `isize::MAX` cannot exist in the address space of a Rust program, which lets us simplify these rules.

For `offset_from`, we can even state that the *absolute* distance fits into an `isize`, and therefore exclude `isize::MIN`. This PR also changes Miri to treat an `isize::MIN` difference like the other isize-overflowing cases.
2024-07-06 13:26:25 +02:00
Camille Gillot 12edc8db87
Update compiler/rustc_mir_transform/src/gvn.rs
Co-authored-by: Michael Goulet <michael@errs.io>
2024-07-06 12:45:23 +02:00
bors 28cc0b643d Auto merge of #127414 - workingjubilee:rollup-lcxw1eh, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #125751 (Add `new_range_api` for RFC 3550)
 - #127098 (Migrate `output-type-permutations` `run-make` test to rmake)
 - #127369 (Match ergonomics 2024: align with RFC again)
 - #127383 (Use verbose style for argument removal suggestion)
 - #127392 (Use verbose suggestion for changing arg type)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-06 07:17:53 +00:00
Jubilee 853148752f
Rollup merge of #127392 - estebank:arg-type, r=jieyouxu
Use verbose suggestion for changing arg type
2024-07-05 23:23:36 -07:00
Jubilee d0f61ce214
Rollup merge of #127383 - estebank:arg-removal, r=compiler-errors
Use verbose style for argument removal suggestion
2024-07-05 23:23:36 -07:00
Jubilee 3ba4195a68
Rollup merge of #127369 - Jules-Bertholet:match-ergonomics-2021, r=Nadrieril
Match ergonomics 2024: align with RFC again

- `&` matches `&mut` on old editions
- Add some more tests

r? ``@Nadrieril``

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

``@rustbot`` label A-edition-2024 A-patterns
2024-07-05 23:23:35 -07:00
Jubilee 02629721ba
Rollup merge of #127098 - Oneirical:big-test-party, r=Kobzol,jieyouxu
Migrate `output-type-permutations` `run-make` test 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).

try-job: x86_64-msvc
try-job: armhf-gnu
try-job: aarch64-apple
try-job: test-various
2024-07-05 23:23:35 -07:00
Jubilee 9c8a88996e
Rollup merge of #125751 - pitaj:new_range_api, r=jhpratt
Add `new_range_api` for RFC 3550

Initial implementation for #125687

This includes a `From<legacy::RangeInclusive> for RangeInclusive` impl for convenience, instead of the `TryFrom` impl from the RFC. Having `From` is highly convenient and the debug assert should find almost all misuses.

This includes re-exports of all existing `Range` types under `core::range`, plus the range-related traits (`RangeBounds`, `Step`, `OneSidedRange`) and the `Bound` enum.

Currently the iterators are just wrappers around the old range types.

Tracking issues:

- https://github.com/rust-lang/rust/issues/123741
- https://github.com/rust-lang/rust/issues/125687
2024-07-05 23:23:34 -07:00
trevyn 09b3fcebf4
Correct description of E0502 2024-07-06 09:13:14 +03:00
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
Michael Goulet 99429a6a18 Split out transitive_bounds_that_define_assoc_item 2024-07-05 20:21:16 -04:00
Camille GILLOT b97f83b27f Verify that allocations output by GVN are sufficiently aligned. 2024-07-05 22:59:10 +00:00
Camille GILLOT 6aebb2cfec Add test. 2024-07-05 22:58:54 +00:00
Peter Jaszkowiak ffea65bf61 add `new_range_api` for RFC 3550
This includes a `From<legacy::RangeInclusive> for RangeInclusive` impl for convenience, instead of the `TryFrom` impl from the RFC.
Having `From` is highly convenient and the assertion is unlikely to be a problem in practice.

This includes re-exports of all existing `Range` types under `core::range`, plus the range-related traits (`RangeBounds`, `Step`, `OneSidedRange`) and the `Bound` enum.

Currently the iterators are just wrappers around the old range types,
and most other trait impls delegate to the old rage types as well.

Also includes an `.iter()` shorthand for `.clone().into_iter()`
2024-07-05 16:33:58 -06:00
clubby789 9f66af4319 Remove clubby789 from review rotation 2024-07-05 22:08:13 +01:00
Esteban Küber 75692056e1 Use verbose suggestion for changing arg type 2024-07-05 20:58:33 +00:00
Michael Goulet 27588d1de3 Split SolverDelegate back out from InferCtxtLike 2024-07-05 16:39:39 -04:00
Esteban Küber fca286a39e Use verbose suggestion for `ptr::null_mut()` 2024-07-05 20:38:21 +00:00
Maybe Lapkin 073f3a263b Equate types instead of using `Unsize` 2024-07-05 22:35:14 +02: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
Michael Goulet e5412da723 Supertrait elaboration doesn't need to use Predicates 2024-07-05 15:51:53 -04:00
Esteban Küber 8e9a3661a8 Use verbose style for argument removal suggestion 2024-07-05 19:40:09 +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
Michael Howell fbb6300fc2 rustdoc-search: stop constructing pointless arrays in decode
I'm not sure why I ever thought that would be okay. This is
clearly hot code, and should avoid Array.prototype.map when
it's not needed. In any case, it shows up in the profiler.

rustdoc-js-profiler:
https://notriddle.com/rustdoc-html-demo-11/decode-opt-1/index.html

Firefox profiler:
[Before](https://share.firefox.dev/3RRH2fR)
[After](https://share.firefox.dev/3Wblcq8)
2024-07-05 10:23:59 -07:00
Michael Goulet 465e7d546e Rework receiver_is_valid 2024-07-05 11:59:54 -04:00
Michael Goulet fb8d5f1e13 Actually just make can_eq process obligations (almost) everywhere 2024-07-05 11:59:54 -04:00
Michael Goulet fdde66acee Process alias-relate obligations when proving receiver_is_valid 2024-07-05 11:59:52 -04:00
Jules Bertholet 76da7aebe4
Match ergonomics 2024: test type inference 2024-07-05 11:17:49 -04:00
Jules Bertholet 5a35fc446e
Match ergonomics 2024: `&` matches `&mut` on old editions 2024-07-05 11:17:13 -04:00
Yoh Deadfall 291ed596f7 Added dots at the sentence ends of rustc AST doc 2024-07-05 18:10:05 +03:00