Matthias Krüger [Sat, 15 Jan 2022 01:25:15 +0000 (02:25 +0100)]
Rollup merge of #92625 - inquisitivecrystal:mirbug-caller, r=michaelwoerister
Add `#[track_caller]` to `mirbug`
When a "'no errors encountered even though `delay_span_bug` issued" error results from the `mirbug` function, the file location information points to the `mirbug` function itself, rather than its caller. This doesn't make sense, since the caller is the real source of the bug. Adding `#[track_caller]` will produce diagnostics that are more useful to anyone fixing the ICE.
Matthias Krüger [Sat, 15 Jan 2022 01:25:14 +0000 (02:25 +0100)]
Rollup merge of #92382 - clarfonthey:const_convert, r=scottmcm
Extend const_convert to rest of blanket core::convert impls
This adds constness to all the blanket impls in `core::convert` under the existing `const_convert` feature, tracked by #88674.
Existing impls under that feature:
```rust
impl<T> const From<T> for T;
impl<T, U> const Into<U> for T where U: ~const From<T>;
impl<T> const ops::Try for Option<T>;
impl<T> const ops::FromResidual for Option<T>;
impl<T, E> const ops::Try for Result<T, E>;
impl<T, E, F> const ops::FromResidual<Result<convert::Infallible, E>> for Result<T, F> where F: ~const From<E>;
```
Additional impls:
```rust
impl<T: ?Sized, U: ?Sized> const AsRef<U> for &T where T: ~const AsRef<U>;
impl<T: ?Sized, U: ?Sized> const AsRef<U> for &mut T where T: ~const AsRef<U>;
impl<T: ?Sized, U: ?Sized> const AsMut<U> for &mut T where T: ~const AsMut<U>;
impl<T, U> const TryInto<U> for T where U: ~const TryFrom<T>;
impl<T, U> const TryFrom<U> for T where U: ~const Into<T>;
```
Matthias Krüger [Sat, 15 Jan 2022 01:25:14 +0000 (02:25 +0100)]
Rollup merge of #92191 - jackh726:issue-89352, r=nikomatsakis
Prefer projection candidates instead of param_env candidates for Sized predicates
Fixes #89352
Also includes some drive by logging and verbose printing changes that I found useful when debugging this, but I can remove this if needed.
This is a little hacky - but imo no more than the rest of `candidate_should_be_dropped_in_favor_of`. Importantly, in a Chalk-like world, both candidates should be completely compatible.
Noah Lev [Mon, 10 Jan 2022 20:24:20 +0000 (12:24 -0800)]
Make `AVG_PART_LENGTH` a power of 2
I seem to recall that in general, it's best to request an allocation
with a size that's a power of 2. The low estimate of 5 was probably a
little too low as well.
bors [Fri, 14 Jan 2022 17:31:28 +0000 (17:31 +0000)]
Auto merge of #92883 - matthiaskrgr:rollup-uoudywx, r=matthiaskrgr
Rollup of 9 pull requests
Successful merges:
- #92045 (Don't fall back to crate-level opaque type definitions.)
- #92381 (Suggest `return`ing tail expressions in async functions)
- #92768 (Partially stabilize `maybe_uninit_extra`)
- #92810 (Deduplicate box deref and regular deref suggestions)
- #92818 (Update documentation for doc_cfg feature)
- #92840 (Fix some lints documentation)
- #92849 (Clippyup)
- #92854 (Use the updated Rust logo in rustdoc)
- #92864 (Fix a missing dot in the main item heading)
PS: This was introduce yesterday by https://github.com/rust-lang/rust/pull/92526 (the migration from Tera to Askama) and is not currently observable in the nightly doc.
It does not cover the const-ness of `write` under `const_maybe_uninit_write` nor the const-ness of `assume_init_read` (this commit adds `const_maybe_uninit_assume_init_read` for that).
Matthias Krüger [Fri, 14 Jan 2022 06:47:32 +0000 (07:47 +0100)]
Rollup merge of #92381 - ThePuzzlemaker:issue-92308, r=estebank
Suggest `return`ing tail expressions in async functions
This PR fixes #92308.
Previously, the suggestion to `return` tail expressions (introduced in #81769) did not apply to `async` functions, as the suggestion checked whether the types were equal disregarding `impl Future<Output = T>` syntax sugar for `async` functions. This PR changes that in order to fix a potential papercut.
I'm not sure if this is the "right" way to do this, so if there is a better way then please let me know.
I amended an existing test introduced in #81769 to add a regression test for this, if you think I should make a separate test I will.
bors [Fri, 14 Jan 2022 03:17:11 +0000 (03:17 +0000)]
Auto merge of #92844 - matthiaskrgr:rollup-z5wb6yi, r=matthiaskrgr
Rollup of 9 pull requests
Successful merges:
- #90001 (Make rlib metadata strip works with MIPSr6 architecture)
- #91687 (rustdoc: do not emit tuple variant fields if none are documented)
- #91938 (Add `std::error::Report` type)
- #92006 (Welcome opaque types into the fold)
- #92142 ([code coverage] Fix missing dead code in modules that are never called)
- #92277 (rustc_metadata: Stop passing `CrateMetadataRef` by reference (step 1))
- #92334 (rustdoc: Preserve rendering of macro_rules matchers when possible)
- #92807 (Update cargo)
- #92832 (Update RELEASES for 1.58.)
Matthias Krüger [Thu, 13 Jan 2022 07:11:23 +0000 (08:11 +0100)]
Rollup merge of #92832 - ehuss:1.58-releases, r=Mark-Simulacrum
Update RELEASES for 1.58.
From what I can tell:
* `NonZero{unsigned}::is_power_of_two` was stabilized in 1.59: https://github.com/rust-lang/rust/pull/91301
* `MaybeUninit` const was added in 1.59: https://github.com/rust-lang/rust/pull/90896
Matthias Krüger [Thu, 13 Jan 2022 07:11:22 +0000 (08:11 +0100)]
Rollup merge of #92807 - ehuss:update-cargo, r=ehuss
Update cargo
6 commits in 358e79fe56fe374649275ca7aebaafd57ade0e8d..06b9d31743210b788b130c8a484c2838afa6fc27
2022-01-04 18:39:45 +0000 to 2022-01-11 23:47:29 +0000
- Port cargo to clap3 (rust-lang/cargo#10265)
- feat: support rustflags per profile (rust-lang/cargo#10217)
- Make bors ignore the PR template so it doesn't end up in merge messages (rust-lang/cargo#10267)
- Be resilient to most IO error and filesystem loop while walking dirs (rust-lang/cargo#10214)
- Remove the option to disable pipelining (rust-lang/cargo#10258)
- Always ask rustc for messages about artifacts, and always process them (rust-lang/cargo#10255)
Matthias Krüger [Thu, 13 Jan 2022 07:11:22 +0000 (08:11 +0100)]
Rollup merge of #92334 - dtolnay:rustdocmatcher, r=camelid,GuillaumeGomez
rustdoc: Preserve rendering of macro_rules matchers when possible
Fixes #92331. This approach restores the behavior prior to #86282 **if** the matcher token held by the compiler **and** the matcher token found in the source code are identical TokenTrees. Thus #86208 remains fixed, but without regressing formatting for the vast majority of macros which are not macro-generated.
Matthias Krüger [Thu, 13 Jan 2022 07:11:21 +0000 (08:11 +0100)]
Rollup merge of #92277 - petrochenkov:cmrval2, r=jackh726
rustc_metadata: Stop passing `CrateMetadataRef` by reference (step 1)
It's already a (fat) reference.
Double referencing it creates lifetime issues for its methods that want to return iterators.
---
Extracted from https://github.com/rust-lang/rust/pull/92245 for a perf run.
The PR changes a lot of symbol names due to function signature changes, so it's hard to do differential profiling, let's spend some machine time instead.
Matthias Krüger [Thu, 13 Jan 2022 07:11:20 +0000 (08:11 +0100)]
Rollup merge of #92142 - wesleywiser:fix_codecoverage_partitioning, r=tmandry
[code coverage] Fix missing dead code in modules that are never called
The issue here is that the logic used to determine which CGU to put the dead function stubs in doesn't handle cases where a module is never assigned to a CGU (which is what happens when all of the code in the module is dead).
The partitioning logic also caused issues in #85461 where inline functions were duplicated into multiple CGUs resulting in duplicate symbols.
This commit fixes the issue by removing the complex logic used to assign dead code stubs to CGUs and replaces it with a much simpler model: we pick one CGU to hold all the dead code stubs. We pick a CGU which has exported items which increases the likelihood the linker won't throw away our dead functions and we pick the smallest to minimize the impact on compilation times for crates with very large CGUs.
Matthias Krüger [Thu, 13 Jan 2022 07:11:19 +0000 (08:11 +0100)]
Rollup merge of #92006 - oli-obk:welcome_opaque_types_into_the_fold, r=nikomatsakis
Welcome opaque types into the fold
r? ```@nikomatsakis``` because idk who else to bug on the type_op changes
The commits have explanations in them. The TLDR is that
* 5c4600227329a273c0c6c844e4a10ce650ead601 stops the "recurse and replace" scheme that replaces opaque types with their canonical inference var by just doing that ahead of time
* bdeeb07bf6400622074f04ca2523dac1512ab662 does not affect anything on master afaict, but since opaque types generate obligations when instantiated, and lazy TAIT instantiates opaque types *everywhere*, we need to properly handle obligations here instead of just hoping no problematic obligations ever come up.
Matthias Krüger [Thu, 13 Jan 2022 07:11:18 +0000 (08:11 +0100)]
Rollup merge of #91938 - yaahc:error-reporter, r=m-ou-se
Add `std::error::Report` type
This is a continuation of https://github.com/rust-lang/rust/pull/90174, split into a separate PR since I cannot push to ```````@seanchen1991``````` 's fork
Matthias Krüger [Thu, 13 Jan 2022 07:11:16 +0000 (08:11 +0100)]
Rollup merge of #90001 - Fearyncess:master, r=alexcrichton
Make rlib metadata strip works with MIPSr6 architecture
Because MIPSr6 has many differences with previous MIPSr2 arch, the previous rlib metadata stripping code in `rustc_codegen_ssa` is only for MIPSr2/r3/r5 (which share the same elf e_flags).
This commit fixed this problem. It makes `rustc_codegen_ssa` happy when compiling rustc for MIPSr6 target or hosts.
bors [Wed, 12 Jan 2022 18:44:34 +0000 (18:44 +0000)]
Auto merge of #8226 - Jarcho:manual_memcpy_8160, r=flip1995
`manual_memcpy` fix
fixes #8160
Ideally this would work with `VecDeque`, but the current interface is unsuitable for it. At a minimum something like `range_as_slices` would be needed.
changelog: Don't lint `manual_memcpy` on `VecDeque`
changelog: Suggest `copy_from_slice` for `manual_memcpy` when applicable
bors [Wed, 12 Jan 2022 17:57:50 +0000 (17:57 +0000)]
Auto merge of #92811 - matthiaskrgr:rollup-wrctcef, r=matthiaskrgr
Rollup of 14 pull requests
Successful merges:
- #92328 (Tweak sentence in `transmute` docs)
- #92432 (Error when selected impl is not const in constck)
- #92506 (Document Box<T> FFI guarantee in 1.41.0 release notes)
- #92699 (rustdoc: Display "private fields" instead of "fields omitted")
- #92703 (RELEASES.md: Add 1.58 release note for `File::options` stabilization)
- #92707 (Extended the note on the use of `no_run` attribute)
- #92709 (Improve documentation for File::options to give a more likely example)
- #92720 (Fix doc formatting for time.rs)
- #92732 (Add note about upstream commit musl-patch-configure.diff is derived from)
- #92742 (Add missing suffix for sidebar-items script path)
- #92748 (Eliminate "boxed" wording in `std::error::Error` documentation)
- #92754 (Update AsmArgs field visibility for rustfmt)
- #92756 (:arrow_up: rust-analyzer)
- #92764 (Fix rust logo style)
Matthias Krüger [Wed, 12 Jan 2022 06:12:15 +0000 (07:12 +0100)]
Rollup merge of #92748 - david-perez:eliminate-boxed-wording-std-error, r=Mark-Simulacrum
Eliminate "boxed" wording in `std::error::Error` documentation
In commit 29403ee, documentation for the methods on `std::any::Any` was
modified so that they referred to the concrete value behind the trait
object as the "inner" value. This is a more accurate wording than
"boxed": while putting trait objects inside boxes is arguably the most
common use, they can also be placed behind other pointer types like
`&mut` or `std::sync::Arc`.
This commit does the same documentation changes for `std::error::Error`.
Matthias Krüger [Wed, 12 Jan 2022 06:12:12 +0000 (07:12 +0100)]
Rollup merge of #92709 - joshtriplett:file-options-docs, r=Mark-Simulacrum
Improve documentation for File::options to give a more likely example
`File::options().read(true).open(...)` is equivalent to just
`File::open`. Change the example to set the `append` flag instead, and
then change the filename to something more likely to be written in
append mode.
Matthias Krüger [Wed, 12 Jan 2022 06:12:09 +0000 (07:12 +0100)]
Rollup merge of #92699 - camelid:private-fields, r=jsha
rustdoc: Display "private fields" instead of "fields omitted"
Also:
* Always use `/* */` block comments
* Use the same message everywhere, rather than sometimes prefixing
with "some"
When I first read rustdoc docs, I was confused why the fields were being
omitted. It was only later that I realized it was because they were
private. It's also always bothered me that rustdoc sometimes uses `//`
and sometimes uses `/*` comments for these messages, so this change
makes them all use `/*`.
Technically, I think fields can be omitted if they are public but
`doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's
really just used to emulate "doc privacy" when -- because of technical
limitations -- an item has to be public. So I think it's fine to include
this under the category of "private fields".
bors [Tue, 11 Jan 2022 21:02:01 +0000 (21:02 +0000)]
Auto merge of #92533 - Aaron1011:variant-symbol, r=petrochenkov
Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`
The field is also renamed from `ident` to `name`. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.
This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.
bors [Tue, 11 Jan 2022 17:31:07 +0000 (17:31 +0000)]
Auto merge of #90948 - oli-obk:🧹, r=nikomatsakis
Actually instantiate the opaque type when checking bounds
Before this change, `instantiate_opaque_types` was a no-op, because it only works relative to the defined opaque type inference anchor. If it is a no-op, the for loop will not actually have anything to iterate over, and thus nothing is checked at all.
It does not cover the const-ness of `write` under
`const_maybe_uninit_write` nor the const-ness of
`assume_init_read` (this commit adds
`const_maybe_uninit_assume_init_read` for that).
Aaron Hill [Mon, 3 Jan 2022 03:37:05 +0000 (22:37 -0500)]
Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`
The field is also renamed from `ident` to `name. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.
This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.
Aaron Hill [Mon, 3 Jan 2022 03:37:05 +0000 (22:37 -0500)]
Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`
The field is also renamed from `ident` to `name. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.
This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.
bors [Tue, 11 Jan 2022 14:23:24 +0000 (14:23 +0000)]
Auto merge of #92070 - rukai:replace_vec_into_iter_with_array_into_iter, r=Mark-Simulacrum
Replace usages of vec![].into_iter with [].into_iter
`[].into_iter` is idiomatic over `vec![].into_iter` because its simpler and faster (unless the vec is optimized away in which case it would be the same)
So we should change all the implementation, documentation and tests to use it.
I skipped:
* `src/tools` - Those are copied in from upstream
* `src/test/ui` - Hard to tell if `vec![].into_iter` was used intentionally or not here and not much benefit to changing it.
* any case where `vec![].into_iter` was used because we specifically needed a `Vec::IntoIter<T>`
* any case where it looked like we were intentionally using `vec![].into_iter` to test it.