Commit Graph

228003 Commits

Author SHA1 Message Date
Michael Goulet
8ad5ea7b01 Adapt tests from #105258 2023-06-30 02:39:07 +00:00
Michael Goulet
473c88dfb6 Flip the order of binder instantiation for better diagnostics 2023-06-30 02:17:07 +00:00
Michael Goulet
d567e4f8b6 Error for RPITIT hidden tys that capture more than their trait defn 2023-06-30 02:17:07 +00:00
bors
330727467b Auto merge of #112682 - spastorino:new-rpitit-21, r=compiler-errors
Add bidirectional where clauses on RPITIT synthesized GATs

Given the following:

```rust
struct MyStruct<'a, T>(&'a T);

trait MyTrait<'a, T> {
    fn my_fn<'b, 'c, 'd, V>(item: &'c String) -> impl Sized + 'a + 'b + 'c where V: 'b, V: 'd;
}

impl<'a, T> MyTrait<'a, T> for MyStruct<'a, T> {
    fn my_fn<'b, 'c, 'd, V>(_: &'c String) -> impl Sized + 'a + 'b + 'c
    where
        V: 'b,
        V: 'd,
    {
        unimplemented!();
    }
}
```

We need the desugaring to be:

```rust
trait MyTrait<'a, T> {
    type MyFn<'bf, 'df, Vf, 'a2, 'b2, 'c2>: Sized + 'a2 + 'b2 + 'c2 where Vf: 'b2, 'a2: 'a, 'a: 'a2, 'b2: 'bf, 'bf: 'b2;

    fn my_fn<'b, 'c, 'd, V>(item: &'c String) -> MyStruct<'a>::MyFn<'b, 'd, V, 'a, 'b, 'c> where V: 'b, V: 'd {
        type opaque<'a3, 'b3, 'c3>;
    };
}

impl<'a, T> MyIter<'a, T> for MyStruct<'a, T> {
    type MyFn<'bf, 'df, Vf, 'a2, 'b2, 'c2> = impl Sized + 'a2 + 'b2 + 'c2 where Vf: b2, 'a2: 'a, 'a: 'a2, 'b2: 'bf, 'bf: 'b2;

    fn my_fn<'b, 'c, 'd, V>(_: &'c String) -> MyStruct<'a>::MyFn<'a, 'b, 'c, V> where V: 'b, V: 'd {
        type opaque<'a3, 'b3, 'c3>;
        unimplemented!();
    }
}
```

This PR adds the where clauses for the `MyFn` generated GATs.

This is a draft with a very ugly solution so we can make comments over concrete code.

r? `@compiler-errors`
2023-06-29 21:24:51 +00:00
bors
b23a5add09 Auto merge of #113059 - Kobzol:ci-concurrency-fix, r=pietroalbini
CI: do not cancel concurrent builds on the same branch

Do not cancel concurrent builds on the same branch (outside of PRs).

Instead, only cancel them if the builds have the same commit SHA.

From the [documentation](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context):
> The commit SHA that triggered the workflow. The value of this commit SHA depends on the event that triggered the workflow. For more information, see "[Events that trigger workflows](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows)." For example, ffac537e6cbbf934b08745a378932722df287a53.

Fixes: https://github.com/rust-lang/rust/pull/112955#discussion_r1242273658

r? `@pietroalbini`
2023-06-29 18:18:52 +00:00
Santiago Pastorino
6f4a51e80e
Do not generate lifetime_mapping for RPIT no in_trait 2023-06-29 14:26:28 -03:00
Santiago Pastorino
4925b57782
Add bidirectional where clauses on RPITIT synthesized GATs 2023-06-29 14:26:26 -03:00
Santiago Pastorino
d70deac161
Intern OpaqueTy on ItemKind::OpaqueTy 2023-06-29 14:05:10 -03:00
Santiago Pastorino
72a32583d1
Reorganize opaque lowering code 2023-06-29 14:04:37 -03:00
Santiago Pastorino
33d21e62d0
Do not remove previously added predicates in param_env, extend them instead 2023-06-29 14:04:29 -03:00
Santiago Pastorino
373293c3ca
Extract compute_bidirectional_outlives_predicates fn 2023-06-29 14:04:26 -03:00
bors
a20a04e5d6 Auto merge of #113108 - compiler-errors:normalize-opaques-with-late-bound-vars-again, r=jackh726
Normalize opaques with late-bound vars again

We have a hack in the compiler where if an opaque has escaping late-bound vars, we skip revealing it even though we *could* reveal it from a technical perspective. First of all, this is weird, since we really should be revealing all opaques in `Reveal::All` mode. Second of all, it causes subtle bugs (linked below).

I attempted to fix this in #100980, which was unfortunately reverted due to perf regressions on codebases that used really deeply nested futures in some interesting ways. The worst of which was #103423, which caused the project to hang on build. Another one was #104842, which was just a slow-down, but not a hang. I took some time afterwards to investigate how to rework `normalize_erasing_regions` to take advantage of better caching, but that effort kinda fizzled out (#104133).

However, recently, I was made aware of more bugs whose root cause is not revealing opaques during codegen. That made me want to fix this again -- in the process, interestingly, I took the the minimized example from https://github.com/rust-lang/rust/issues/103423#issuecomment-1292947043, and it doesn't seem to hang any more...

Thinking about this harder, there have been some changes to the way we lower and typecheck async futures that may have reduced the pathologically large number of outlives obligations (see description of #103423) that we were encountering when normalizing opaques with bound vars the last time around:
* #104321 (lower `async { .. }` directly as a generator that implements `Future`, removing the `from_generator` shim)
* #104833 (removing an `identity_future` fn that was wrapping desugared future generators)

... so given that I can see:
* No significant regression on rust perf bot (https://github.com/rust-lang/rust/pull/107620#issuecomment-1600070317)
* No timeouts in crater run I did (https://github.com/rust-lang/rust/pull/107620#issuecomment-1605428952, rechecked failing crates in https://github.com/rust-lang/rust/pull/107620#issuecomment-1605973434)

... and given that this PR:
* Fixes #104601
* Fixes #107557
* Fixes #109464
* Allows us to remove a `DefiningAnchor::Bubble` from codegen (75a8f68183)

I'm inclined to give this another shot at landing this. Best case, it just works -- worst case, we get more examples to study how we need to improve the compiler to make this work.

r? types
2023-06-29 15:37:11 +00:00
Jakub Beránek
32428ab5f3
CI: do not cancel concurrent builds on the same branch
Add an exception for try and try-perf branches to enable concurrent try builds and unrolled rollup builds.
2023-06-29 14:52:52 +02:00
bors
e69c7306e2 Auto merge of #113151 - RalfJung:miri, r=RalfJung,oli-obk
update Miri

r? `@ghost`
2023-06-29 10:55:40 +00:00
Oli Scherer
78f58f96aa Use a valid target directory in miri ui tests 2023-06-29 10:43:49 +00:00
Ralf Jung
a3cea7f179 update lockfile 2023-06-29 09:31:47 +02:00
bors
de22388873 Auto merge of #113134 - TaKO8Ki:rollup-4hvqzf6, r=TaKO8Ki
Rollup of 5 pull requests

Successful merges:

 - #112946 (Improve cgu naming and ordering)
 - #113048 (Fix build on Solaris where fd-lock cannot be used.)
 - #113100 (Fix display of long items in search results)
 - #113107 (add check for ConstKind::Value(_) to in_operand())
 - #113119 (rustdoc: Reduce internal function visibility.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-29 07:07:37 +00:00
bors
feed376e15 Auto merge of #2946 - RalfJung:rustup, r=RalfJung
Rustup
2023-06-29 06:45:06 +00:00
Ralf Jung
cca0c81027 Merge from rustc 2023-06-29 08:43:01 +02:00
Ralf Jung
8d4b2bdf7b Preparing for merge from rustc 2023-06-29 08:42:56 +02:00
bors
0a32ca9831 Auto merge of #113146 - matthiaskrgr:rollup-bxtr51e, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #112670 (privacy: Type privacy lints fixes and cleanups)
 - #112929 (Test that we require implementing trait items whose bounds don't hold in the current impl)
 - #113054 (Make `rustc_on_unimplemented` std-agnostic)
 - #113137 (don't suggest `move` for borrows that aren't closures)
 - #113139 (style-guide: Clarify let-else further)
 - #113140 (style-guide: Add an example of formatting a multi-line attribute)
 - #113143 (style-guide: Narrow guidance about references and dereferencing)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-29 04:34:46 +00:00
Matthias Krüger
7a7ffced6a
Rollup merge of #113143 - joshtriplett:style-guide-narrow-dereference-guidance, r=calebcartwright
style-guide: Narrow guidance about references and dereferencing

The style guide advises "prefer dereferencing to taking references", but
doesn't give guidance on when that "preference" should get overridden by
other considerations. Give an example of when it's fine to ignore
that advice.
2023-06-29 05:48:41 +02:00
Matthias Krüger
c0e37ad127
Rollup merge of #113140 - joshtriplett:style-guide-example-multi-line-attribute, r=calebcartwright
style-guide: Add an example of formatting a multi-line attribute

We already say to format attributes like functions, but we didn't have
an example of formatting a multi-line attribute.
2023-06-29 05:48:41 +02:00
Matthias Krüger
c4dc70eb31
Rollup merge of #113139 - joshtriplett:style-clarify-let-else, r=calebcartwright
style-guide: Clarify let-else further

Give some additional examples with multi-line patterns.

Make it clearer to go on to the next case if the conditions aren't met.
2023-06-29 05:48:41 +02:00
Matthias Krüger
7e1869f9b4
Rollup merge of #113137 - lukas-code:no-moving-references, r=compiler-errors
don't suggest `move` for borrows that aren't closures

fixes https://github.com/rust-lang/rust/issues/113087
2023-06-29 05:48:40 +02:00
Matthias Krüger
f35f213d27
Rollup merge of #113054 - Rageking8:make-rustc_on_unimplemented-std-agnostic, r=WaffleLapkin
Make `rustc_on_unimplemented` std-agnostic

See #112923

r? `@WaffleLapkin`
2023-06-29 05:48:40 +02:00
Matthias Krüger
1963688f93
Rollup merge of #112929 - oli-obk:what_if_an_impl_item_just_doesnt_wanna_be_impld, r=compiler-errors
Test that we require implementing trait items whose bounds don't hold in the current impl

I initially tried to make most of these pass, but that's a big can of worms, so I'm just adding them as tests, considering we have no tests for these things.
2023-06-29 05:48:39 +02:00
Matthias Krüger
42a495da7e
Rollup merge of #112670 - petrochenkov:typriv, r=eholk
privacy: Type privacy lints fixes and cleanups

See individual commits.
Follow up to https://github.com/rust-lang/rust/pull/111801.
2023-06-29 05:48:39 +02:00
Josh Triplett
025dd3aef0 style-guide: Narrow guidance about references and dereferencing
The style guide advises "prefer dereferencing to taking references", but
doesn't give guidance on when that "preference" should get overridden by
other considerations. Give an example of when it's fine to ignore
that advice.
2023-06-28 17:10:03 -07:00
bors
75726cae37 Auto merge of #112629 - compiler-errors:atb-imply, r=jackh726
Make associated type bounds in supertrait position implied

`trait A: B<Assoc: C> {}` should be able to imply both `Self: B` and `<Self as B>::Assoc: C`. Adjust the way that we collect implied predicates to do so.

Fixes #112573
Fixes #112568
2023-06-28 23:58:28 +00:00
Josh Triplett
4cc80651b8 style-guide: Add an example of formatting a multi-line attribute
We already say to format attributes like functions, but we didn't have
an example of formatting a multi-line attribute.
2023-06-28 15:35:05 -07:00
Lukas Markeffsky
5e83ddd279 don't suggest move for borrows that aren't closures 2023-06-28 23:56:58 +02:00
Josh Triplett
5abeb801b8 syle-guide: Clarify let-else further
Give some additional examples with multi-line patterns.

Make it clearer to go on to the next case if the conditions aren't met.
2023-06-28 14:56:21 -07:00
bors
cec5ec44b1 Auto merge of #2936 - Vanille-N:unique, r=RalfJung
Optional semantics for `Unique`

Use with `-Zmiri-unique-is-unique`, makes `core::ptr::Unique` get a reborrow with its own permissions.
2023-06-28 21:21:42 +00:00
Takayuki Maeda
8a5272cb37
Rollup merge of #113119 - aDotInTheVoid:reduce-viz, r=notriddle
rustdoc: Reduce internal function visibility.

As suggested [here](1862fcb1df (r1211200570)).
2023-06-29 03:29:34 +09:00
Takayuki Maeda
74d6958297
Rollup merge of #113107 - mj10021:issue-113012-fix, r=oli-obk
add check for ConstKind::Value(_) to in_operand()

Added check for valtree value to close #113012 which fixes the issue, although I am not sure if adding the check there is sound or not cc `@oli-obk`
2023-06-29 03:29:33 +09:00
Takayuki Maeda
5871bc8486
Rollup merge of #113100 - GuillaumeGomez:search-result-long-name, r=notriddle
Fix display of long items in search results

Fixes https://github.com/rust-lang/rust/issues/113060.

You can test the result [here](https://rustdoc.crud.net/imperio/search-result-long-name/lib2/index.html).

To make it a bit better, I also reduced a bit the size of the short documentation from half to 2 fifth of the width.

r? `@notriddle`
2023-06-29 03:29:33 +09:00
Takayuki Maeda
376c944bd2
Rollup merge of #113048 - psumbera:solaris-bootstrap-cfgs, r=ozkanonur
Fix build on Solaris where fd-lock cannot be used.

This fixes build regression after e7e584b7d9.

Resolves #113085
2023-06-29 03:29:32 +09:00
Takayuki Maeda
bad0688563
Rollup merge of #112946 - nnethercote:improve-cgu-naming-and-ordering, r=wesleywiser
Improve cgu naming and ordering

Some quality of life improvements when debugging and profiling CGU formation.

r? `@wesleywiser`
2023-06-29 03:29:32 +09:00
Neven Villani
0671f14733
Unique gets special treatment when -Zmiri-unique-is-unique 2023-06-28 18:42:13 +02:00
bors
5bd28f5eac Auto merge of #98867 - cjgillot:metaloop, r=oli-obk
Refactor metadata emission to avoid visiting HIR

This PR refactors metadata emission to be based on tables and iteration over definitions.

In a first part, this PR moves information from the `EntryKind` enum to tables, until removing the `EntryKind` enum.
In a second part, the iteration scheme is refactored to avoid fetching HIR unless strictly necessary.

r? `@ghost`
2023-06-28 16:16:27 +00:00
bors
eb76764ea4 Auto merge of #113120 - Dylan-DPC:rollup-cz4qr3o, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #111571 (Implement proposed API for `proc_macro_span`)
 - #112236 (Simplify computation of killed borrows)
 - #112867 (More `ImplSource` nits)
 - #113019 (add note for non-exhaustive matches with guards)
 - #113094 (Fix invalid HTML DIV tag used in HEAD)
 - #113111 (add myself to review for t-types stuff)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-28 13:25:41 +00:00
bors
1ffe627f05 Auto merge of #2945 - oli-obk:gha_mk_pr, r=RalfJung
Try running a sync automatically

absolutely no clue if this works, but it happens after the zulip message, so worst case we'll see the failure after the cron job did everything it currently does.
2023-06-28 12:59:55 +00:00
Oli Scherer
e1b2951450 Try running a sync automatically 2023-06-28 12:59:29 +00:00
Dylan DPC
11c8dbf9f7
Rollup merge of #113111 - BoxyUwU:boxy_t_types_review, r=compiler-errors
add myself to review for t-types stuff

I think this is how the triagebot stuff works 😅 should mean that `r? types` can now assign me
2023-06-28 18:28:48 +05:30
Dylan DPC
a70842c7d1
Rollup merge of #113094 - GuillaumeGomez:fix-invalid-div-tag-in-head, r=notriddle,fmease
Fix invalid HTML DIV tag used in HEAD

Fixes https://github.com/rust-lang/rust/issues/113067.

The issue also nicely explains the whole problem.

r? ``@notriddle``
2023-06-28 18:28:48 +05:30
Dylan DPC
e4e1a995dc
Rollup merge of #113019 - ericmarkmartin:warning-for-guard-non-exhaustion, r=fee1-dead
add note for non-exhaustive matches with guards

Associated issue: #92197

When a match statement includes guards on every match arm (and is therefore necessarily non-exhaustive), add a note to the error E0004 diagnostic noting this.
2023-06-28 18:28:47 +05:30
Dylan DPC
fc2c587cd0
Rollup merge of #112867 - compiler-errors:more-impl-source-nits, r=lcnr
More `ImplSource` nits

Even more clean-ups, I'll put this up in parallel with the `select_in_new_trait_solver` PR.

r? ``@lcnr``
2023-06-28 18:28:47 +05:30
Dylan DPC
dabcbae535
Rollup merge of #112236 - cjgillot:interval-kill, r=davidtwco
Simplify computation of killed borrows

Follow-up to https://github.com/rust-lang/rust/pull/111759

Processing the first block manually once makes the pre-order walk simpler.
2023-06-28 18:28:46 +05:30
Dylan DPC
fa56e01b35
Rollup merge of #111571 - jhpratt:proc-macro-span, r=m-ou-se
Implement proposed API for `proc_macro_span`

As proposed in [#54725 (comment)](https://github.com/rust-lang/rust/issues/54725#issuecomment-1546918161). I have omitted the byte-level API as it's already available as [`Span::byte_range`](https://doc.rust-lang.org/nightly/proc_macro/struct.Span.html#method.byte_range).

`@rustbot` label +A-proc-macros

r? `@m-ou-se`
2023-06-28 18:28:46 +05:30