Commit Graph

227266 Commits

Author SHA1 Message Date
Guillaume Gomez
b858a4745c Update existing snapshot and add more snapshots of where clause indentation 2023-06-22 17:39:23 +02:00
Guillaume Gomez
9202caaec5 Fix indentation for where clause in rustdoc pages 2023-06-22 17:38:19 +02:00
Guillaume Gomez
805edb0a4a Add test to prevent regression for fields display 2023-06-21 17:42:53 +02:00
Guillaume Gomez
6f48526963 Fix union fields display 2023-06-21 17:25:19 +02:00
bors
6fc0273b5a Auto merge of #112320 - compiler-errors:do-not-impl-via-obj, r=lcnr
Add `implement_via_object` to `rustc_deny_explicit_impl` to control object candidate assembly

Some built-in traits are special, since they are used to prove facts about the program that are important for later phases of compilation such as codegen and CTFE. For example, the `Unsize` trait is used to assert to the compiler that we are able to unsize a type into another type. It doesn't have any methods because it doesn't actually *instruct* the compiler how to do this unsizing, but this is later used (alongside an exhaustive match of combinations of unsizeable types) during codegen to generate unsize coercion code.

Due to this, these built-in traits are incompatible with the type erasure provided by object types. For example, the existence of `dyn Unsize<T>` does not mean that the compiler is able to unsize `Box<dyn Unsize<T>>` into `Box<T>`, since `Unsize` is a *witness* to the fact that a type can be unsized, and it doesn't actually encode that unsizing operation in its vtable as mentioned above.

The old trait solver gets around this fact by having complex control flow that never considers object bounds for certain built-in traits:
2f896da247/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs (L61-L132)

However, candidate assembly in the new solver is much more lovely, and I'd hate to add this list of opt-out cases into the new solver. Instead of maintaining this complex and hard-coded control flow, instead we can make this a property of the trait via a built-in attribute. We already have such a build attribute that's applied to every single trait that we care about: `rustc_deny_explicit_impl`. This PR adds `implement_via_object` as a meta-item to that attribute that allows us to opt a trait out of object-bound candidate assembly as well.

r? `@lcnr`
2023-06-20 08:42:37 +00:00
bors
b9d608c979 Auto merge of #112821 - calebcartwright:rustfmt-sync, r=calebcartwright
update rustfmt

changes described in https://github.com/rust-lang/rustfmt/blob/master/CHANGELOG.md#153-2023-06-20

r? `@ghost`

cc `@rust-lang/rustfmt`
2023-06-20 05:58:16 +00:00
Michael Goulet
ca68cf0d46 Merge attrs, better validation 2023-06-20 04:38:55 +00:00
Michael Goulet
91e5c3f2e5 Make rustc_deny_explicit_impl only local as well 2023-06-20 04:38:46 +00:00
Michael Goulet
657d3f43a9 Add rustc_do_not_implement_via_object 2023-06-20 04:38:46 +00:00
Caleb Cartwright
aca66a20c6 update lockfile for rustfmt sync 2023-06-19 23:19:48 -05:00
Caleb Cartwright
08384b854f Merge commit '3f7c366fc0464e01ddcaefbd70647cb3da4202be' into rustfmt-sync 2023-06-19 23:13:56 -05:00
Caleb Cartwright
3f7c366fc0 chore: release v1.5.3 2023-06-19 22:54:36 -05:00
bors
d7dcadc597 Auto merge of #112817 - compiler-errors:rollup-0eqomra, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #112232 (Better error for non const `PartialEq` call generated by `match`)
 - #112499 (Fix python linting errors)
 - #112596 (Suggest correct signature on missing fn returning RPITIT/AFIT)
 - #112606 (Alter `Display` for `Ipv6Addr` for IPv4-compatible addresses)
 - #112781 (Don't consider TAIT normalizable to hidden ty if it would result in impossible item bounds)
 - #112787 (Add gha problem matcher)
 - #112799 (Clean up "doc(hidden)" check)
 - #112803 (Format the examples directory of cg_clif)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-20 02:58:53 +00:00
Caleb Cartwright
ec8a4d41f1
Merge pull request #5788 from calebcartwright/subtree-sync-2023-06-19
sync subtree in prep for next release
2023-06-19 21:57:03 -05:00
Caleb Cartwright
0b17d7ea46 chore: address merge and bump toolchain 2023-06-19 21:29:15 -05:00
Caleb Cartwright
312a86b46b Merge remote-tracking branch 'upstream/master' into subtree-sync-2023-06-19 2023-06-19 20:56:20 -05:00
Lukasz Anforowicz
f4201ef2cb Handling of numbered markdown lists.
Fixes issue #5416
2023-06-19 20:50:01 -05:00
Michael Goulet
0ca3252310
Rollup merge of #112803 - bjorn3:more_formatting, r=compiler-errors
Format the examples directory of cg_clif

Formatting has been enforced in cg_clif's CI for a while now.
2023-06-19 17:53:37 -07:00
Michael Goulet
22c1971142
Rollup merge of #112799 - GuillaumeGomez:clean-up-doc-hidden-check, r=notriddle
Clean up "doc(hidden)" check

It makes the code reading a bit better but putting away the logic inside a common method.

r? `@notriddle`
2023-06-19 17:53:36 -07:00
Michael Goulet
780826577e
Rollup merge of #112787 - oli-obk:gha_tinder_for_problems, r=jyn514
Add gha problem matcher

These regexes capture rustfmt errors, panics and regular Rust errors in CI and automatically add messages in the diff view. This should make it simpler to quickly see what went wrong without having to scroll through CI logs.

We can fine tune the regexes or add more matchers after having a look at how it actually works in practice

The relevant documentation can be found at https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md

r? `@jyn514`
2023-06-19 17:53:36 -07:00
Michael Goulet
3171c989ef
Rollup merge of #112781 - compiler-errors:new-solver-tait-overlaps-hidden, r=lcnr
Don't consider TAIT normalizable to hidden ty if it would result in impossible item bounds

See test for example where we shouldn't consider it possible to alias-relate a TAIT and hidden type.

r? `@lcnr`
2023-06-19 17:53:35 -07:00
Michael Goulet
e24fe97bd9
Rollup merge of #112606 - clarfonthey:ip-display, r=thomcc
Alter `Display` for `Ipv6Addr` for IPv4-compatible addresses

ACP: rust-lang/libs-team#239
2023-06-19 17:53:35 -07:00
Michael Goulet
be68e9e336
Rollup merge of #112596 - compiler-errors:missing-sig-with-rpitit, r=b-naber
Suggest correct signature on missing fn returning RPITIT/AFIT

Add `async` and unpeel the future's output type if the function is async

Fixes #108195
2023-06-19 17:53:34 -07:00
Michael Goulet
935452b619
Rollup merge of #112499 - tgross35:py-ruff-fixes, r=Mark-Simulacrum
Fix python linting errors

These were flagged by `ruff`, run using the config in https://github.com/rust-lang/rust/pull/112482
2023-06-19 17:53:34 -07:00
Michael Goulet
31d1fbf8d2
Rollup merge of #112232 - fee1-dead-contrib:match-eq-const-msg, r=b-naber
Better error for non const `PartialEq` call generated by `match`

Resolves #90237
2023-06-19 17:53:33 -07:00
bors
14803bda0e Auto merge of #111849 - eholk:uniquearc, r=Mark-Simulacrum
Add `alloc::rc::UniqueRc`

This PR implements `UniqueRc` as described in https://github.com/rust-lang/libs-team/issues/90.

I've tried to stick to the API proposed there, incorporating the feedback from the ACP review. For now I've just implemented `UniqueRc`, but we'll want `UniqueArc` as well. I wanted to get feedback on this implementation first since the `UniqueArc` version should be mostly a copy/paste/rename job.
2023-06-20 00:11:57 +00:00
bors
fe7454bf43 Auto merge of #112805 - matthiaskrgr:rollup-r5yrefu, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #109970 ([doc] `poll_fn`: explain how to `pin` captured state safely)
 - #112705 (Simplify `Span::source_callee` impl)
 - #112757 (Use BorrowFlag instead of explicit isize)
 - #112768 (Rewrite various resolve/diagnostics errors as translatable diagnostics)
 - #112777 (Continue folding in query normalizer on weak aliases)
 - #112780 (Treat TAIT equation as always ambiguous in coherence)
 - #112783 (Don't ICE on bound var in `reject_fn_ptr_impls`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-19 20:01:50 +00:00
Eric Holk
53003cdd86
Introduce alloc::::UniqueRc
This is an `Rc` that is guaranteed to only have one strong reference.
Because it is uniquely owned, it can safely implement `DerefMut`, which
allows programs to have an initialization phase where structures inside
the `Rc` can be mutated.

The `UniqueRc` can then be converted to a regular `Rc`, allowing sharing
and but read-only access.

During the "initialization phase," weak references can be created, but
attempting to upgrade these will fail until the `UniqueRc` has been
converted to a regular `Rc`. This feature can be useful to create
cyclic data structures.

This API is an implementation based on the feedback provided to the ACP
at https://github.com/rust-lang/libs-team/issues/90.
2023-06-19 12:24:06 -07:00
Matthias Krüger
68d3e0e3bd
Rollup merge of #112783 - compiler-errors:nlb-fnptr-reject-ice, r=fee1-dead
Don't ICE on bound var in `reject_fn_ptr_impls`

We may try to use an impl like `impl<T: FnPtr> PartialEq {}` to satisfy a predicate like `for<T> T: PartialEq` -- don't ICE in that case.

Fixes #112735
2023-06-19 19:26:28 +02:00
Matthias Krüger
263635b917
Rollup merge of #112780 - compiler-errors:tait-is-ambig, r=lcnr
Treat TAIT equation as always ambiguous in coherence

Not sure why we weren't treating all TAIT equality as ambiguous -- this behavior combined with `DefineOpaqueTypes::No` leads to coherence overlap failures, since we incorrectly consider impls as not overlapping because the obligation `T: From<Foo>` doesn't hold.

Fixes #112765
2023-06-19 19:26:28 +02:00
Matthias Krüger
68f2f1e32c
Rollup merge of #112777 - compiler-errors:normalize-weak-more, r=oli-obk
Continue folding in query normalizer on weak aliases

Fixes #112752
Fixes #112731 (same root cause, so didn't make a test for it)
fixes #112776

r? ```@oli-obk```
2023-06-19 19:26:27 +02:00
Matthias Krüger
6de869fd23
Rollup merge of #112768 - NotStirred:translatable_diag/resolve1, r=WaffleLapkin
Rewrite various resolve/diagnostics errors as translatable diagnostics

additional question:

For trivial strings is it ever accepted to use `fluent_generated::foo` in a `label` for example? Or is an empty struct `Diagnostic` preferred?
2023-06-19 19:26:27 +02:00
Matthias Krüger
7d072fa8fb
Rollup merge of #112757 - Danvil:patch-1, r=Mark-Simulacrum
Use BorrowFlag instead of explicit isize

The integer type tracking borrow count has a typedef called `BorrowFlag`. This type should be used instead of explicit `isize`.
2023-06-19 19:26:26 +02:00
Matthias Krüger
af348a81a0
Rollup merge of #112705 - WaffleLapkin:simplify_source_callee_impl, r=cjgillot
Simplify `Span::source_callee` impl

Imo the iterator impl is easier to grasp.
2023-06-19 19:26:26 +02:00
Matthias Krüger
663fb5a0e9
Rollup merge of #109970 - danielhenrymantilla:add-poll-fn-pin-clarifications, r=thomcc
[doc] `poll_fn`: explain how to `pin` captured state safely

Usage of `Pin::new_unchecked(&mut …)` is dangerous with `poll_fn`, even though the `!Unpin`-infectiousness has made things smoother. Nonetheless, there are easy ways to avoid the need for any `unsafe` altogether, be it through `Box::pin`ning, or the `pin!` macro. Since the latter only works within an `async` context, showing an example artificially introducing one ought to help people navigate this subtlety with safety and confidence.

## Preview

https://user-images.githubusercontent.com/9920355/230092494-da22fdcb-0b8f-4ff4-a2ac-aa7d9ead077a.mov

```@rustbot``` label +A-docs
2023-06-19 19:26:25 +02:00
bors
4051305389 Auto merge of #112238 - scottmcm:mir-add-unchecked, r=cjgillot
Promote unchecked integer math to MIR `BinOp`s

So slice indexing by a range gets down to one basic block, for example.

r? cjgillot
2023-06-19 17:14:21 +00:00
bjorn3
86b7750ada Format the examples directory of cg_clif
Formatting has been enforced in cg_clif's CI for a while now.
2023-06-19 16:54:28 +00:00
KaDiWa
66b9951dcd update some dependencies 2023-06-19 11:20:51 -05:00
Oli Scherer
13aa0dc1c7 Add gha problem matcher 2023-06-19 15:34:31 +00:00
Tom Martin
2027e989bc
Remove unreachable and untested suggestion for invalid span enum derive(Default) 2023-06-19 16:22:21 +01:00
Tom Martin
db613750a9
Reformatting 2023-06-19 16:21:33 +01:00
Yacin Tmimi
2c30fa5a82 Adjust enum variant spans to exclude any explicit discriminant
Fixes 5686

For reference, explicit discriminants were proposed in [RFC-2363].

`ast::Variant` spans extend to include explicit discriminants when they
are present.

Now we'll adjust the span of enum variants to exclude any explicit
discriminant.

[RFC-2363]: https://rust-lang.github.io/rfcs/2363-arbitrary-enum-discriminant.html
2023-06-19 10:12:19 -05:00
Guillaume Gomez
75e236375a Clean up "doc(hidden)" check 2023-06-19 17:09:13 +02:00
Yacin Tmimi
ac2ebd3a78 Prevent ICE when calling parse_attribute without an attribute
Fixes 5729

`parse_attribute` will panic if the first token is not a `#`. To prevent
this we return early instead of trying to parse an invalid attribute.
2023-06-19 09:58:12 -05:00
Michael Goulet
2e8af07a8a Don't consider TAIT normalizable to hidden ty if it would result in impossible item bounds 2023-06-19 14:49:56 +00:00
Deadbeef
a463f231f5 remove derive_new dependency 2023-06-19 09:46:37 -05:00
Deadbeef
7d48be355a bump deps to new versions that use syn 2.0 2023-06-19 09:46:37 -05:00
Deadbeef
8d95c269ed update config_proc_macro to use syn 2.0 2023-06-19 09:46:37 -05:00
xxchan
c9ebd6ce26 doc: remove installing from source
also add "run from source" in contributing.md
2023-06-19 09:42:40 -05:00
Yacin Tmimi
0441cc21e3 Add release notes for closed PRs with release-notes label 2023-06-19 09:40:46 -05:00