Commit Graph

236414 Commits

Author SHA1 Message Date
bors
49691b1f70 Auto merge of #114370 - krtab:pop_assume_cap, r=scottmcm
Add invariant to Vec::pop that len < cap if pop successful

Fixes: https://github.com/rust-lang/rust/issues/114334
2023-10-16 21:06:14 +00:00
Esteban Küber
26954f60ff address review comment 2023-10-16 19:48:53 +00:00
Paul Gey
587899e9ca Preserve unicode escapes in format string literals when pretty-printing AST 2023-10-16 21:20:21 +02:00
Camille GILLOT
1f90d857d7 Stop trying to preserve pretty-printing. 2023-10-16 19:15:28 +00:00
Celina G. Val
364f1a3f16 Add MonoItems and Instance to stable_mir
Also add a few methods to instantiate instances and get an instance
definition.

We're still missing support to actually monomorphize the instance body.
2023-10-16 12:01:24 -07:00
bors
a76ec181fb Auto merge of #116804 - matthiaskrgr:rollup-m2qm8ul, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #114157 (Enable triagebot no-merges check)
 - #116257 (Suggest trait bounds for used associated type on type param)
 - #116430 (vendoring in tarball sources)
 - #116709 (Update minifier version to 0.2.3)
 - #116786 (Update my mailmap entry)
 - #116790 (opt-dist: disable unused features for tabled crate)
 - #116802 (Remove `DefiningAnchor::Bubble` from opaque wf check)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-16 18:57:44 +00:00
Camille GILLOT
0eb958a89b Rebless. 2023-10-16 18:36:47 +00:00
Camille GILLOT
669b99d35e Elaborate comment. 2023-10-16 18:33:05 +00:00
Camille GILLOT
c423305d41 Motivate renumbering and avoid underflow. 2023-10-16 18:24:30 +00:00
Guillaume Gomez
ad26a0b3dd Improve display of parallel jobs in rustdoc-gui tester script 2023-10-16 20:16:08 +02:00
Oğuz Ağcayazı
5e6da1e306 add myself to smir triage 2023-10-16 20:49:03 +03:00
Nilstrieb
414135d522 Make rustc_onunimplemented export path agnostic
This makes it so that all the matchers that match against paths use the
definition path instead of the export path. This removes all duplication
around `std`/`alloc`/`core`.

This is not necessarily optimal because we now depend on internal
implementation details like `core::ops::control_flow::ControlFlow`,
which is not very nice and probably not acceptable for a stable
`on_unimplemented`.

An alternative would be to just string-replace normalize away
`alloc`/`core` to `std` as a special case, keeping the export paths but
making it so that we're still fully standard library flavor agnostic.
2023-10-16 19:37:12 +02:00
Ralf Jung
6605116463 use target-arch based table 2023-10-16 19:29:16 +02:00
Matthias Krüger
b0572f1a12
Rollup merge of #116802 - compiler-errors:anchor-opaque-wf, r=oli-obk
Remove `DefiningAnchor::Bubble` from opaque wf check

Set the defining anchor to `DefiningAnchor::Bind(parent_def_id)` where `parent_def_id` is the first parent def-id that isn't an opaque.

This "fixes" some of the nested-return-type wf tests. If we *do* want these to be hard-errors for TAITs, we should probably make those error separately from this check (i.e. via some check like the code in the `OPAQUE_HIDDEN_INFERRED_BOUND` lint). The fact that some of these tests fail but not all of them seems kinda coincidental.

r? oli-obk
2023-10-16 19:10:51 +02:00
Matthias Krüger
98ea131a6e
Rollup merge of #116790 - klensy:opt-dist-tabled-no-derive, r=Kobzol
opt-dist: disable unused features for tabled crate

Features looks unused, so left only used ones.

r? `@Kobzol`
2023-10-16 19:10:51 +02:00
Matthias Krüger
cacde6767f
Rollup merge of #116786 - Urgau:mailmap-update, r=Nilstrieb
Update my mailmap entry
2023-10-16 19:10:50 +02:00
Matthias Krüger
96be07e566
Rollup merge of #116709 - GuillaumeGomez:update-minifier, r=notriddle
Update minifier version to 0.2.3

Thanks for the fix `@notriddle` !

r? `@notriddle`
2023-10-16 19:10:50 +02:00
Matthias Krüger
6f9df29ad5
Rollup merge of #116430 - onur-ozkan:vendoring-in-tarball-sources, r=clubby789
vendoring in tarball sources

fixes #94782
2023-10-16 19:10:49 +02:00
Matthias Krüger
14663e09b7
Rollup merge of #116257 - estebank:issue-101351, r=b-naber
Suggest trait bounds for used associated type on type param

Fix #101351.

When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound:

```
error[E0220]: associated type `Associated` not found for `T`
 --> file.rs:6:15
  |
6 |     field: T::Associated,
  |               ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo`
  |
help: consider restricting type parameter `T`
  |
5 | struct Generic<T: Foo> {
  |                 +++++
  ```

When an associated type on a type parameter has a typo, suggest fixing
it:

```
error[E0220]: associated type `Baa` not found for `T`
  --> $DIR/issue-55673.rs:9:8
   |
LL |     T::Baa: std::fmt::Debug,
   |        ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
   |
help: change the associated type name to use `Bar` from `Foo`
   |
LL |     T::Bar: std::fmt::Debug,
   |        ~~~
```
2023-10-16 19:10:49 +02:00
Matthias Krüger
cf25110def
Rollup merge of #114157 - pitaj:triagebot_no-merges, r=ehuss
Enable triagebot no-merges check

Follow-up on https://github.com/rust-lang/triagebot/pull/1704

### Motivation

Occasionally, a merge commit like cb5c011670 makes it past manual review and gets merged into master.

At one point, we tried adding a check to CI to prevent this from happening (https://github.com/rust-lang/rust/pull/105058), but that ended up [problematic](https://github.com/rust-lang/rust/pull/106319#issuecomment-1368144076) and was [reverted](https://github.com/rust-lang/rust/pull/106320). This kind of check is simply too fragile for CI, and there must be a way for a human to override the bot's decision.

The capability to detect and warn about merge commits has been present in triagebot for quite some time, but was never enabled at rust-lang/rust, possibly due to concerns about false positives on rollup and subtree sync PRs. This PR intends to alleviate those concerns.

### Configuration

This configuration will exclude rollup PRs and subtree sync PRs from merge commit detection, and it will post the default warning message and add the `has-merge-commits` and `S-waiting-on-author` labels when merge commits are detected on other PRs.

The eventual vision is to have bors refuse to merge if the `has-merge-commits` label is present. A reviewer can still force the merge by removing that label if they so wish.

### Note for contributors

The rollup tool should add that label automatically, but anyone performing subtree updates should begin including "subtree update" in the titles of those PRs, to avoid false positives.

r? infra

## Open Questions

1. This configuration uses the default message that's built into triagebot:

> There are merge commits (commits with multiple parents) in your changes. We have a [no merge policy](https://rustc-dev-guide.rust-lang.org/git.html#no-merge-policy) so these commits will need to be removed for this pull request to be merged.
>
> You can start a rebase with the following commands:
> ```shell-session
> $ # rebase
> $ git rebase -i master
> $ # delete any merge commits in the editor that appears
> $ git push --force-with-lease
> ```

Any changes to this are easy, I'll just have to add a `message` option. Should we mention the excluded titles in the message?
2023-10-16 19:10:48 +02:00
Arthur Carcano
0bcac8a7f2 Add invariant to Vec::pop that len < cap if pop successful
Fixes: https://github.com/rust-lang/rust/issues/114334
2023-10-16 18:49:25 +02:00
bors
4af886f8ab Auto merge of #116731 - Alexendoo:hash-untracked-state, r=oli-obk
Add `Config::hash_untracked_state` callback

For context, I'm looking to use [late module passes](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/context/struct.LintStore.html#structfield.late_module_passes) in Clippy which unlike regular late passes run incrementally per module

However we have a config file which can change between runs, we need changes to that to invalidate the `lint_mod` query. This PR adds a side channel for us to hash some extra state into `Options` in order to do that

This does not make any changes to Clippy, I plan to do that in a PR to the Clippy repo along with some other required changes

An alternative implementation would be to add a new query to track this state and override the `lint_mod` query in Clippy to first call that

cc `@rust-lang/clippy`
2023-10-16 16:33:42 +00:00
Camille GILLOT
02424e4bc5 Normalize alloc-id in tests. 2023-10-16 16:29:35 +00:00
Michael Goulet
743e6d1601 Remove DefiningAnchor::Bubble from opaque wf check 2023-10-16 15:50:31 +00:00
Michael Goulet
17ec3cd5bf Fix outlives suggestion for GAT in RPITIT 2023-10-16 15:42:26 +00:00
bors
98c1e3d95b Auto merge of #116550 - nnethercote:rustc-features-more, r=Nilstrieb
Cleanup `rustc_features` some more

The sequel to #116437.

r? `@Nilstrieb`
2023-10-16 14:34:53 +00:00
DaniPopes
0df670fb67
Add #[track_caller] to Option::unwrap_or_else 2023-10-16 15:17:15 +02:00
bors
e7bdc5f9f8 Auto merge of #114330 - RalfJung:dagling-ptr-deref, r=oli-obk
don't UB on dangling ptr deref, instead check inbounds on projections

This implements https://github.com/rust-lang/reference/pull/1387 in Miri. See that PR for what the change is about.

Detecting dangling references in `let x = &...;` is now done by validity checking only, so some tests need to have validity checking enabled. There is no longer inherently a "nodangle" check in evaluating the expression `&*ptr` (aside from the aliasing model).

r? `@oli-obk`

Based on:
- https://github.com/rust-lang/reference/pull/1387
- https://github.com/rust-lang/rust/pull/115524
2023-10-16 12:40:16 +00:00
Ralf Jung
1ac153f60b add oversized-ref test back 2023-10-16 13:52:19 +02:00
bors
a00c09e9d8 Auto merge of #116724 - RalfJung:alloc-bytes, r=oli-obk
interpret: clean up AllocBytes

Fixes https://github.com/rust-lang/miri/issues/2836
Nothing has moved here in half a year, so let's just remove these unused stubs -- they need a proper re-design anyway.

r? `@oli-obk`
2023-10-16 10:45:00 +00:00
Zalathar
7aa1b8390b coverage: Explain why we temporarily steal pending_dups 2023-10-16 21:05:46 +11:00
Zalathar
5e5a8e7769 coverage: Inline span_bcb_dominates
Interacting with `basic_coverage_blocks` directly makes it easier to satisfy
the borrow checker when mutating `pending_dups` while reading other fields.
2023-10-16 21:05:46 +11:00
Zalathar
4ab4273d64 coverage: Inline prev_starts_after_next 2023-10-16 21:05:46 +11:00
Zalathar
25e6303202 coverage: Move take_curr and note what its callers are doing 2023-10-16 21:05:46 +11:00
Zalathar
41038dbe4a coverage: Call prev/curr less in other places
This reduces clutter, and makes it easier to notice regions where mutations
definitely don't occur.
2023-10-16 21:05:46 +11:00
Zalathar
b1c44f4a25 coverage: Call prev/curr less in to_refined_spans
This makes it easier to see that the non-initial cases assume that `prev` and
`curr` are set, and all operate on the same prev/curr references.
2023-10-16 21:05:46 +11:00
Zalathar
9bb27f3adf coverage: Remove redundant field prev_expn_span
This span can always be retrieved from `prev`, so there is no need to store it
separately.
2023-10-16 21:05:45 +11:00
Zalathar
7bbe4be568 coverage: Flatten guard logic in maybe_flush_pending_dups 2023-10-16 21:05:45 +11:00
Zalathar
97d1a9120e coverage: Flatten guard logic in maybe_push_macro_name_span 2023-10-16 21:05:33 +11:00
klensy
83425967cb opt-dist: disable unused features for tabled crate 2023-10-16 12:59:15 +03:00
Zalathar
5f1e8f9950 coverage: Simplify push_refined_span
It turns out that all of the `len` manipulation here was just reimplementing
`last_mut`.
2023-10-16 20:54:36 +11:00
Zalathar
fa2e26285c coverage: Use DUMMY_SP instead of creating a dummy span manually
This patch also sorts the constructor fields into declaration order.
2023-10-16 20:54:36 +11:00
Zalathar
d928d3e5d8 coverage: Rename hold_pending_dups_unless_dominated to update_pending_dups 2023-10-16 20:54:16 +11:00
Zalathar
9b6ce4fb3c coverage: Rename check_pending_dups to maybe_flush_pending_dups
This method's main responsibility is to flush the pending dups into refined
spans, if appropriate.
2023-10-16 20:53:41 +11:00
Zalathar
46c545c1ba coverage: Rename check_invoked_macro_name_span to maybe_push_macro_name_span 2023-10-16 20:52:20 +11:00
bors
9ace9da2e0 Auto merge of #116782 - matthiaskrgr:rollup-t3yrgku, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #115196 (Suggest adding `return` if the for semi which can coerce to the fn return type)
 - #115955 (Stabilize `{IpAddr, Ipv6Addr}::to_canonical`)
 - #116776 (Enable `review-requested` feature for rustbot)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-16 06:02:25 +00:00
Matthias Krüger
8feb7c55fe
Rollup merge of #116776 - WaffleLapkin:hell-yeah-review-requested, r=Mark-Simulacrum
Enable `review-requested` feature for rustbot

See https://github.com/rust-lang/triagebot/pull/1733.

r? `@Mark-Simulacrum`
2023-10-16 06:26:21 +02:00
Matthias Krüger
17113f7db6
Rollup merge of #115955 - tgross35:ip-to-canonical, r=dtolnay
Stabilize `{IpAddr, Ipv6Addr}::to_canonical`

Make `IpAddr::to_canonical` and `IpV6Addr::to_canonical` stable (+const), as well as const stabilize `Ipv6Addr::to_ipv4_mapped`.

Newly stable API:

```rust
impl IpAddr {
    // Newly stable under `ip_to_canonical`
    const fn to_canonical(&self) -> IpAddr;
}

impl Ipv6Addr {
    // Newly stable under `ip_to_canonical`
    const fn to_canonical(&self) -> IpAddr;

    // Already stable, this makes it const stable under
    // `const_ipv6_to_ipv4_mapped`
    const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr>
}
```

These stabilize a subset of the following tracking issues:

- https://github.com/rust-lang/rust/issues/27709
- https://github.com/rust-lang/rust/issues/76205

Stabilization of all methods under the `ip` gate was attempted once at https://github.com/rust-lang/rust/pull/66584 then again at https://github.com/rust-lang/rust/pull/76098. These were not successful because there are still unknowns about `is_documentation` `is_benchmarking` and similar; `to_canonical` is much more straightforward.

I have looked and could not find any known issues with `to_canonical`. These were added in 2021 in https://github.com/rust-lang/rust/pull/87708

cc implementor ``@the8472``

r? libs-api
``@rustbot`` label +T-libs-api +needs-fcp
2023-10-16 06:26:20 +02:00
Matthias Krüger
1de910fc0d
Rollup merge of #115196 - chenyukang:yukang-fix-86094, r=estebank
Suggest adding `return` if the for semi which can coerce to the fn return type

Fixes #86094
r? `@estebank`
2023-10-16 06:26:20 +02:00
bors
99592fdfa1 Auto merge of #116775 - nnethercote:inline-Bytes-next, r=the8472
Inline `Bytes::next` and `Bytes::size_hint`.

This greatly increases its speed. On one small test program using `Bytes::next` to iterate over a large file, execution time dropped from ~330ms to ~220ms.

r? `@the8472`
2023-10-16 04:05:32 +00:00