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
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.
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 — 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.
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
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
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
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.
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.
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.
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" 🤷
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.
Combine three generalizer implementations
Fixes#111092Fixes#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`
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`
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
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.
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.
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.