Commit Graph

224298 Commits

Author SHA1 Message Date
Matthias Krüger
426dbcdf92
Rollup merge of #111533 - clubby789:drop-tracking-error, r=oli-obk
Handle error body in generator layout

Fixes #111468

I feel like making this query return `Option<GeneratorLayout>` might be better but had some issues with that approach
2023-05-16 20:12:16 +02:00
Matthias Krüger
c78a67b710
Rollup merge of #111488 - compiler-errors:error-term, r=lcnr
Use error term in projection if missing associated item in new solver

We were previously delaying a bug but not bailing, leading to an ICE in the `tcx.type_of(assoc_def.item.def_id)` call below.
2023-05-16 20:12:16 +02:00
Matthias Krüger
8d162fb150
Rollup merge of #107680 - dtolnay:docrepr, r=Amanieu
Hide repr attribute from doc of types without guaranteed repr

Rustdoc has an undesirable behavior of blindly copying `repr` into the documentation of structs and enums, even when there is no particular repr that the type guarantees to its users. This is a source of confusion for standard library users who assume the fact that a repr is documented means it must be something the standard library promises they can rely on (in transmutes, or FFI).

Some issues on the topic of rustdoc's incorrect handling of `repr`:

- https://github.com/rust-lang/rust/issues/66401
- https://github.com/rust-lang/rust/issues/90435

In places, the standard library currently works around this confusing rustdoc behavior by just omitting `repr(transparent)` altogether even where it should be required if equivalent code were being written outside of the standard library. See #61969.

IMO that is even more confusing, even for standard library maintainers &mdash; see https://github.com/rust-lang/rust/pull/105018#discussion_r1058400997. It's also not something that works for other reprs like `C` or `u8` which cannot just be omitted even in standard library code.

This PR tries a different approach for some types that are being currently incorrectly documented with a repr.

> **Warning**
> This PR does not imply that every type that still has a `repr` attribute in its docs after this PR is now public for users to rely on. This PR only tries to reduce harm from this longstanding rustdoc issue.
2023-05-16 20:12:16 +02:00
David Tolnay
e7963a65ed
Hide repr attribute from doc of types without guaranteed repr 2023-05-16 10:00:52 -07:00
Michael Goulet
8921391a12 Use error term if missing associated item in new solver 2023-05-16 16:02:17 +00:00
bors
9239760da8 Auto merge of #105750 - oli-obk:valtrees, r=lcnr
Always fall back to PartialEq when a constant in a pattern is not recursively structural-eq

Right now we destructure the constant as far as we can, but with this PR we just don't take it apart anymore. This is preparatory work for moving to always using valtrees, as these will just do a single conversion of the constant to a valtree at the start, and if that fails, fall back to `PartialEq`.

This removes a few cases where we emitted the `unreachable pattern` lint, because we stop looking into the constant deeply enough to detect that a constant is already covered by another pattern.

Previous work: https://github.com/rust-lang/rust/pull/70743

This is groundwork towards fixing https://github.com/rust-lang/rust/issues/83085 and https://github.com/rust-lang/rust/issues/105047
2023-05-16 13:10:24 +00:00
bors
a673ad6b57 Auto merge of #111639 - Nilstrieb:rollup-vg149lm, r=Nilstrieb
Rollup of 10 pull requests

Successful merges:

 - #111428 (refactor(resolve): clean up the early error return caused by non-call)
 - #111449 (Recover `impl<T ?Sized>` correctly)
 - #111572 (Document that `missing_copy_implementations` and `missing_debug_implementations` only apply to public items.)
 - #111602 (Suppress "erroneous constant used" for constants tainted by errors)
 - #111605 (fixup version placeholder for `cfi_encoding` feature)
 - #111607 (Add clubby789 to the bootstrap review rotation)
 - #111614 (Add more interesting nonsense to weird-exprs.rs)
 - #111617 (Fixed typo)
 - #111620 (Add eholk back to compiler-contributors reviewers)
 - #111621 (Fix release date of 1.58.1 in release notes.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-16 10:16:26 +00:00
Oli Scherer
228225842b Document how constants as opaque patterns behave differently. 2023-05-16 09:45:56 +00:00
Nilstrieb
5c0b8f164e
Rollup merge of #111621 - ehuss:relnotes-1.58.1-date, r=Mark-Simulacrum
Fix release date of 1.58.1 in release notes.

This fixes the release notes to have the correct release date for 1.58.1. The [blog announcement](https://blog.rust-lang.org/2022/01/20/Rust-1.58.1.html) has the correct date and link (which is otherwise broken without this change).

Closes #94278
2023-05-16 11:39:42 +02:00
Nilstrieb
607ed89a33
Rollup merge of #111620 - eholk:eholk-back-from-vacation, r=wesleywiser
Add eholk back to compiler-contributors reviewers

```@eholk``` is back from vacation so he can review things again.

r? ```@wesleywiser```
2023-05-16 11:39:41 +02:00
Nilstrieb
0db9de843d
Rollup merge of #111617 - kesleta:master, r=Dylan-DPC
Fixed typo

Fixed typo in BTree Curser.
2023-05-16 11:39:41 +02:00
Nilstrieb
87e25f7855
Rollup merge of #111614 - aDotInTheVoid:nonsense, r=cjgillot
Add more interesting nonsense to weird-exprs.rs

Some cursed things rust allows that I've ran into.

[The second is taken from here](https://twitter.com/Lucretiel/status/1638929955751964679)
2023-05-16 11:39:40 +02:00
Nilstrieb
6e48dcf77f
Rollup merge of #111607 - jyn514:clubby-reviews, r=clubby789
Add clubby789 to the bootstrap review rotation

r? `````@clubby789````` - thank you for volunteering!

I have been meaning for a very long time now to write up how to do reviews, but I haven't gotten around to it yet :( here is a short summary:

1. If you're not sure what the changes does or if it's ok, always feel free to ping someone else on the team, especially in the first few weeks. You can use `r? bootstrap` to get triagebot to assign someone else.
2. Bootstrap unfortunately has very few tests. Things that touch CLI or toml parsing should likely have a test in `src/bootstrap/config/tests.rs`; things that touch "core" build logic should have a test in `builder/tests.rs`, anything else kinda just slips in :( see https://github.com/rust-lang/rust/issues/102563 for ideas on how to improve the situation here.
3. "Major" changes should be documented in `src/bootstrap/CHANGELOG.md`. "Major" is up to you, but if it breaks a config option or otherwise is likely to break *someone's* build, it's probably major. If it breaks nearly *everyone*'s build, it should also update `VERSION` in `lib.rs`; this should be very rare. Please also ping me or Mark-Simulacrum for major changes (I might set up a triagebot ping for this so you don't have to remember).
4. Once you've approved the PR, tell bors it's ok - you've been contributing for a while so you know how bors works, but here's a cheatsheet just in case: https://bors.rust-lang.org

Documentation about how to use bootstrap lives at https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html; internal docs live in `src/bootstrap/README.md`. The latter unfortunately is not very complete.
2023-05-16 11:39:40 +02:00
Nilstrieb
ecdf373826
Rollup merge of #111605 - klensy:fixup_version, r=compiler-errors
fixup version placeholder for `cfi_encoding` feature

Mentioned https://github.com/rust-lang/rust/pull/105452#discussion_r1184772529
2023-05-16 11:39:39 +02:00
Nilstrieb
3e34be004e
Rollup merge of #111602 - tmiasko:erroneous-constant-used, r=oli-obk
Suppress "erroneous constant used" for constants tainted by errors

When constant evaluation fails because its MIR is tainted by errors,
suppress note indicating that erroneous constant was used, since those
errors have to be fixed regardless of the constant being used or not.

Fixes #110891.
2023-05-16 11:39:39 +02:00
Nilstrieb
f6da357016
Rollup merge of #111572 - kpreid:mdi, r=compiler-errors
Document that `missing_copy_implementations` and `missing_debug_implementations` only apply to public items.

I encountered #111359 (fixed) and noticed that the documentation didn't say that it was _intended_ that `missing_debug_implementations` only applies to public items. This PR fixes that, and makes the same wording change to `missing_copy_implementations` which has the same condition.

I chose the words to also be similar to `missing_docs` which already had such a remark.
2023-05-16 11:39:39 +02:00
Nilstrieb
87a0cd9a41
Rollup merge of #111449 - compiler-errors:recover-impl-generics-correctly, r=Nilstrieb
Recover `impl<T ?Sized>` correctly

Fixes #111327

r? ````@Nilstrieb```` but you can re-roll

Alternatively, happy to close this if we're okay with just saying "sorry #111327 is just a poor side-effect of parser ambiguity" 🤷
2023-05-16 11:39:38 +02:00
Nilstrieb
f65281534f
Rollup merge of #111428 - bvanjoi:fix-109250, r=Nilstrieb
refactor(resolve): clean up the early error return caused by non-call

closes https://github.com/rust-lang/rust/issues/109250

It seems no bad happened, r? ``@Nilstrieb``
2023-05-16 11:39:38 +02:00
bors
72b2716246 Auto merge of #111472 - djkoloski:compiletest_cfg_current_target, r=compiler-errors
Get current target config from` --print=cfg`

Compiletest was switched to querying all targets using `--print=all-target-specs-json` and `--print=target-spec-json` in #108905. This unintentionally prevented codegen flags like `-Cpanic` from being reflected in the current target configuration. This change gets the current compiletest target config using `--print=cfg` like it was previously while still using the faster prints for getting information on all other targets.

Fixes #110850.

`@jyn514` might be interested in reviewing since they commented on the issue.
cc `@tmandry` since this issue is affecting Fuchsia.
2023-05-16 07:20:46 +00:00
bors
3ea9ad5324 Auto merge of #111134 - GilShoshan94:remove-send-bound-on-error, r=dtolnay
Remove unnecessary Send bound

Hi,

While working on a [PR on Tokio](https://github.com/tokio-rs/tokio/pull/5666), I took inspiration from the std channel mpsc and stumbled on a `Send` bound for a `Error` impl.

Tokio's maintainer `@Darksonn` pointed out to me that `Error` used to required the `Send` bound long time ago (here https://github.com/rust-lang/rust/pull/23541).

In the meantime, the `Send` bound `Error` got removed (see https://github.com/rust-lang/rust/pull/21312 and https://github.com/rust-lang/rust/pull/23799).

So here a PR to removed this bound for `SendError<T>`, `TrySendError<T>` and `SendTimeoutError<T>`.
2023-05-16 04:03:26 +00:00
bors
76e79ca026 Auto merge of #111044 - jmillikin:nonzero-negation, r=dtolnay
Stabilize feature `nonzero_negation_ops`

Fixes #102443

ACP: https://github.com/rust-lang/libs-team/issues/105
2023-05-16 01:07:42 +00:00
bors
ea54255501 Auto merge of #111221 - compiler-errors:yeet-generalizer, r=lcnr
Combine three generalizer implementations

Fixes #111092
Fixes #109505

This code is a bit delicate and there were subtle changes between them, so I'll leave inline comments where further inspection is needed.

Regarding this comment from #109813 -- "add tests triggering all codepaths: at least the combine and the const generalizer", can't really do that now, and I don't really know how we'd get a higher-ranked const error since non-lifetime binders doesn't *really* support `for<const ..>` (it errors out when you try to use it).

r? `@lcnr`
2023-05-15 22:16:50 +00:00
Eric Huss
eeeb70e31e Fix release date of 1.58.1 in release notes. 2023-05-15 14:08:51 -07:00
Eric Holk
c11fd9297a
Add eholk back to compiler-contributors reviewers
@eholk is back from vacation so he can review things again.
2023-05-15 13:35:00 -07:00
Alona Enraght-Moony
65f9603a4e Add more interesting nonsense to weird-exprs.rs 2023-05-15 21:22:13 +01:00
Benjamin Atelsek
9688a6cebb Fixed typo 2023-05-15 15:13:21 -04:00
bors
ce5919fcef Auto merge of #107707 - calebzulawski:remove-features, r=Amanieu
Remove misleading target feature aliases

Fixes #100752.  This is a follow up to #103750. These aliases could not be completely removed until rust-lang/stdarch#1355 landed.

cc `@Amanieu`
2023-05-15 18:47:52 +00:00
Michael Goulet
a5763ff8d3 Recover impl<T ?Sized> correctly 2023-05-15 17:14:59 +00:00
Michael Goulet
a2678e15e5 Replace RelationDir with Variance 2023-05-15 17:00:16 +00:00
jyn
29a81f5436 Add clubby789 to the bootstrap review rotation 2023-05-15 11:48:15 -05:00
Michael Goulet
41501c7449 Rename super_relate_* to structurally_relate_* 2023-05-15 16:40:42 +00:00
Michael Goulet
6d0b6c0d2c Tweaks and a test 2023-05-15 16:40:42 +00:00
Michael Goulet
4ce2123ecc yeet ConstInferUnifier 2023-05-15 16:40:42 +00:00
Michael Goulet
c270b0a8a8 Simplify delegate 2023-05-15 16:40:42 +00:00
Michael Goulet
338e7642fb Combine TypeGeneralizer and Generalizer 2023-05-15 16:40:42 +00:00
klensy
9799fb1ddc fixup version placeholder for cfi_encoding feature 2023-05-15 19:19:13 +03:00
bors
63b2ee0faf Auto merge of #111601 - matthiaskrgr:rollup-e5dguzb, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #108291 (Fix more benchmark test with black_box)
 - #108356 (improve doc test for UnsafeCell::raw_get)
 - #110049 (Don't claim `LocalKey::with` prevents a reference to be sent across threads)
 - #111525 (Stop checking for the absence of something that doesn't exist)
 - #111538 (Make sure the build.rustc version is either the same or 1 apart)
 - #111578 (Move expansion of query macros in rustc_middle to rustc_middle::query)
 - #111584 (Number lexing tweaks)
 - #111587 (Custom MIR: Support `Rvalue::CopyForDeref`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-15 15:18:09 +00:00
Matthias Krüger
eeebb6590a
Rollup merge of #111587 - cbeuw:copy-for-deref, r=oli-obk
Custom MIR: Support `Rvalue::CopyForDeref`

r? `@oli-obk` or `@tmiasko` or `@JakobDegen`
2023-05-15 17:12:47 +02:00
Matthias Krüger
119b72289b
Rollup merge of #111584 - nnethercote:number-lexing-tweaks, r=matklad
Number lexing tweaks

A couple of improvements to things that puzzled me when I was looking at this code.

r? `@matklad`
2023-05-15 17:12:46 +02:00
Matthias Krüger
2f0b456903
Rollup merge of #111578 - Zoxc:query-macro-move, r=cjgillot
Move expansion of query macros in rustc_middle to rustc_middle::query

This moves the expansion of `define_callbacks!` and `define_feedable!` from `rustc_middle::ty::query` to `rustc_middle::query`.

This means that types used in queries are both imported and used in `rustc_middle::query` instead of being split between these modules. It also decouples `rustc_middle::ty::query` further from `rustc_middle` which is helpful since we want to move `rustc_middle::ty::query` to the query system crates.
2023-05-15 17:12:46 +02:00
Matthias Krüger
9267843e72
Rollup merge of #111538 - chenyukang:yukang-fix-110067-version-issue, r=jyn514
Make sure the build.rustc version is either the same or 1 apart

Fixes #110067
r? `@jyn514`
2023-05-15 17:12:45 +02:00
Matthias Krüger
e52fbff5e8
Rollup merge of #111525 - scottmcm:slice-position-tweak, r=Mark-Simulacrum
Stop checking for the absence of something that doesn't exist

A couple of codegen tests are doing
```
// CHECK-NOT: slice_index_len_fail
```

However, that function no longer exists: [the only places](https://github.com/search?q=repo%3Arust-lang%2Frust+slice_index_len_fail&type=code) it occurs in the repo are in those tests.

So this PR updates the tests to check for the absense of the functions that are actually used today to panic for out-of-bounds indexing.
2023-05-15 17:12:45 +02:00
Matthias Krüger
c93c2985d8
Rollup merge of #110049 - SkiFire13:localkey-with-docs-fix, r=workingjubilee
Don't claim `LocalKey::with` prevents a reference to be sent across threads

The documentation for `LocalKey` claims that `with` yields a reference that cannot be sent across threads, but this is false since you can easily do that with scoped threads. What it actually prevents is the reference from outliving the current thread.
2023-05-15 17:12:44 +02:00
Matthias Krüger
1063548a1a
Rollup merge of #108356 - gftea:master, r=workingjubilee
improve doc test for UnsafeCell::raw_get

improve docs of public API `UnsafeCell::raw_get`
2023-05-15 17:12:44 +02:00
Matthias Krüger
fc30207b16
Rollup merge of #108291 - chenyukang:yukang/fix-benchmarks, r=workingjubilee
Fix more benchmark test with black_box

Follow up fix for https://github.com/rust-lang/rust/issues/107590
2023-05-15 17:12:43 +02:00
Oli Scherer
87f9f99f9c Update some comments 2023-05-15 14:20:31 +00:00
Oli Scherer
ad424e65d8 Always fall back to PartialEq when a constant in a pattern is not recursively structural-eq 2023-05-15 14:20:31 +00:00
Oli Scherer
8d00f762dd Unnest a variable in prep for the next commit which needs access to the place 2023-05-15 14:20:31 +00:00
bors
2913ad6db0 Auto merge of #111585 - matthiaskrgr:rollup-468pykj, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #102673 (Update doc for `PhantomData` to match code example)
 - #111531 (Fix ice caused by shorthand fields in NoFieldsForFnCall)
 - #111547 (Start node has no immediate dominator)
 - #111548 (add util function to TokenStream to eliminate some clones)
 - #111560 (Simplify find_width_of_character_at_span.)
 - #111569 (Appease lints)
 - #111581 (Fix some misleading and copy-pasted `Pattern` examples)
 - #111582 ((docs) Change "wanting" to "want")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-15 11:56:07 +00:00
Andy Wang
3d938ddb39
Documentation 2023-05-15 12:08:16 +02:00