bors [Tue, 13 Dec 2022 00:29:28 +0000 (00:29 +0000)]
Auto merge of #105644 - matthiaskrgr:rollup-qc6hlzq, r=matthiaskrgr
Rollup of 8 pull requests
Successful merges:
- #104864 (Account for item-local in inner scope for E0425)
- #105332 (Point out the type of associated types in every method call of iterator chains)
- #105620 (Remove unnecessary uses of `clone`)
- #105625 (minor code cleanups)
- #105629 (rustdoc: stop treating everything in a trait item as a method)
- #105636 (Add check for local-storage value when changing "display line numbers" settings)
- #105639 (rustdoc: remove `type="text/css" from stylesheet links)
- #105640 (Adjust miri to still be optional)
Matthias Krüger [Tue, 13 Dec 2022 00:17:12 +0000 (01:17 +0100)]
Rollup merge of #105639 - notriddle:notriddle/text-css, r=GuillaumeGomez
rustdoc: remove `type="text/css" from stylesheet links
MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>, since "CSS is the only stylesheet language used on the web."
Matthias Krüger [Tue, 13 Dec 2022 00:17:09 +0000 (01:17 +0100)]
Rollup merge of #105332 - estebank:iterator-chains, r=oli-obk
Point out the type of associated types in every method call of iterator chains
Partially address #105184 by pointing out the type of associated types in every method call of iterator chains:
```
note: the expression is of type `Map<std::slice::Iter<'_, {integer}>, [closure@src/test/ui/iterators/invalid-iterator-chain.rs:12:18: 12:21]>`
--> src/test/ui/iterators/invalid-iterator-chain.rs:12:14
|
10 | vec![0, 1]
| ---------- this expression has type `Vec<{integer}>`
11 | .iter()
| ------ associated type `std::iter::Iterator::Item` is `&{integer}` here
12 | .map(|x| { x; })
| ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `()` here
```
We also reduce the number of impls we mention when any of the candidates is an "exact match". This benefits the output of cases with numerics greatly.
Outstanding work would be to provide a structured suggestion for appropriate changes, like in this case detecting the spurious `;` in the closure.
Mark Rousskov [Tue, 1 Nov 2022 00:52:55 +0000 (20:52 -0400)]
Adjust miri to still be optional
We don't distribute a miri build for beta/stable so it needs to be kept
optional. In the future it likely makes sense to switch the miri
*artifacts* to always be built, but the rustup component to not be
included -- this will avoid some of this pain.
Michael Howell [Mon, 12 Dec 2022 22:17:49 +0000 (15:17 -0700)]
rustdoc: remove `type="text/css" from stylesheet links
MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>,
since "CSS is the only stylesheet language used on the web."
bors [Mon, 12 Dec 2022 10:38:31 +0000 (10:38 +0000)]
Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa
Use struct types during codegen in less places
This makes it easier to use cg_ssa from a backend like Cranelift that doesn't have any struct types at all. After this PR struct types are still used for function arguments and return values. Removing those usages is harder but should still be doable.
bors [Mon, 12 Dec 2022 02:17:08 +0000 (02:17 +0000)]
Auto merge of #105485 - nnethercote:fix-lint-perf-regressions, r=cjgillot
Fix lint perf regressions
#104863 caused small but widespread regressions in lint performance. I tried to improve things in #105291 and #105416 with minimal success, before fully understanding what caused the regression. This PR effectively reverts all of #105291 and part of #104863 to fix the perf regression.
Matthias Krüger [Sun, 11 Dec 2022 22:36:47 +0000 (23:36 +0100)]
Rollup merge of #105555 - krasimirgg:llvm-int-opt-2, r=cuviper
llvm-wrapper: adapt for LLVM API changes
This is a follow-up of https://github.com/rust-lang/rust/commit/75aec4703dea7ef8e13924ccfa3a3d2e8c5c7cff. There, I updated the wrapper to only include llvm/ADT/Optional.h for LLVM version below 16. But I missed updating some of the None references.
Found by our experimental rust + llvm at HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15587#0185006b-e0af-49e5-8b06-280ed125ff0d/200-539
Matthias Krüger [Sun, 11 Dec 2022 22:36:46 +0000 (23:36 +0100)]
Rollup merge of #105472 - spastorino:make-encoder-use-queries, r=oli-obk
Make encode_info_for_trait_item use queries instead of accessing the HIR
This change avoids accessing the HIR on `encode_info_for_trait_item` and uses queries. We will need to execute this function for elements that have no HIR and by using queries we will be able to feed for definitions that have no HIR.
Matthias Krüger [Sun, 11 Dec 2022 22:36:44 +0000 (23:36 +0100)]
Rollup merge of #101648 - Timmmm:home_dir_docs, r=joshtriplett
Better documentation for env::home_dir()'s broken behaviour
This improves the documentation to say *why* it was deprecated. The reason was because it reads `HOME` on Windows which is meaningless there. Note that the PR that deprecated it stated that returning an empty string if `HOME` is set to an empty string was a problem, however I can find no evidence that this is the case. `cd` handles it fine whereas if `HOME` is unset it gives an explicit `HOME not set` error.
* Original deprecation reason: https://internals.rust-lang.org/t/deprecate-or-break-fix-std-env-home-dir/7315
* Original deprecation PR: https://github.com/rust-lang/rust/pull/51656
This commit partly undoes #104863, which combined the builtin lints pass
with other lints. This caused a slowdown, because often there are no
other lints, and it's faster to do a pass with a single lint directly
than it is to do a combined pass with a `passes` vector containing a
single lint.
I removed these in #105291, and subsequently learned they are necessary
for performance.
This commit reinstates them with the new and more descriptive names
`RuntimeCombined{Early,Late}LintPass`, similar to the existing passes
like `BuiltinCombinedEarlyLintPass`. It also adds some comments,
particularly emphasising how we have ways to combine passes at both
compile-time and runtime. And it moves some comments around.
bors [Sun, 11 Dec 2022 20:38:34 +0000 (20:38 +0000)]
Auto merge of #103647 - lqd:osx-x64-lto, r=Mark-Simulacrum
Enable ThinLTO for rustc on `x86_64-apple-darwin`
Local measurements seemed to show an improvement on a couple benchmarks, so I'd like to test real CI builds, and see if the builder doesn't timeout with the expected slight increase in build times.
Let's start with x64 rustc ThinLTO, and then figure out the file structure to configure LLVM ThinLTO. Maybe we'll then try `aarch64` builds since that also looked good locally.
Michael Goulet [Tue, 6 Dec 2022 17:34:24 +0000 (17:34 +0000)]
Provide associated type information in method chains
When encountering an unmet obligation that affects a method chain, like
in iterator chains where one of the links has the wrong associated
type, we point at every method call and mention their evaluated
associated type at that point to give context to the user of where
expectations diverged from the code as written.
```
note: the expression is of type `Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/invalid-iterator-chain.rs:12:18: 12:21]>`
--> $DIR/invalid-iterator-chain.rs:12:14
|
LL | vec![0, 1]
| ---------- this expression has type `Vec<{integer}>`
LL | .iter()
| ------ associated type `std::iter::Iterator::Item` is `&{integer}` here
LL | .map(|x| { x; })
| ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `()` here
```
bors [Sun, 11 Dec 2022 14:42:45 +0000 (14:42 +0000)]
Auto merge of #102900 - abrachet:master, r=bjorn3
Don't internalize __llvm_profile_counter_bias
Currently, LLVM profiling runtime counter relocation cannot be used by rust during LTO because symbols are being internalized before all symbol information is known.
This mode makes LLVM emit a __llvm_profile_counter_bias symbol which is referenced by the profiling initialization, which itself is pulled in by the rust driver here [1].
It is enabled with -Cllvm-args=-runtime-counter-relocation for platforms which are opt-in to this mode like Linux. On these platforms there will be no link error, rather just surprising behavior for a user which request runtime counter relocation. The profiling runtime will not see that symbol go on as if it were never there. On Fuchsia, the profiling runtime must have this symbol which will cause a hard link error.
As an aside, I don't have enough context as to why rust's LTO model is how it is. AFAICT, the internalize pass is only safe to run at link time when all symbol information is actually known, this being an example as to why. I think special casing this symbol as a known one that LLVM can emit which should not have it's visbility de-escalated should be fine given how seldom this pattern of defining an undefined symbol to get initilization code pulled in is. From a quick grep, __llvm_profile_runtime is the only symbol that rustc does this for.
This is a follow-up of
https://github.com/rust-lang/rust/commit/75aec4703dea7ef8e13924ccfa3a3d2e8c5c7cff.
There, I updated the wrapper to only include llvm/ADT/Optional.h for
LLVM version below 16. But I missed updating some of the None references.
Found by our experimental rust + llvm at HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15587#0185006b-e0af-49e5-8b06-280ed125ff0d/200-539
bors [Sun, 11 Dec 2022 09:01:37 +0000 (09:01 +0000)]
Auto merge of #105554 - matthiaskrgr:rollup-ir60gc7, r=matthiaskrgr
Rollup of 6 pull requests
Successful merges:
- #105411 (Introduce `with_forced_trimmed_paths`)
- #105532 (Document behaviour of `--remap-path-prefix` with several matches)
- #105537 (compiler: remove unnecessary imports and qualified paths)
- #105539 (rustdoc: Only hide lines starting with `#` in rust code blocks )
- #105546 (Add some regression tests for #44454)
- #105547 (Add regression test for #104582)
So before approving, this is a big question: in rust code blocks, in a line starts with a `#`, we hide it in the output. However, should we do the same for non-rust code blocks too? I think it's a bit problematic to do it because `#` can be used for many things but I prefer to check first with everyone (might also be worth updating documentation too).
I'm not sure happy about this fix but since it's how passes work (ie, even if there are errors, it runs all passes), I think it's fine as is.
Just as a sidenote: I also gave a try to prevent running all passes in case there were compiler errors but then a lot of rustdoc tests were failing so I went for this fix instead.
Matthias Krüger [Sat, 10 Dec 2022 23:30:21 +0000 (00:30 +0100)]
Rollup merge of #105542 - compiler-errors:confirm-nits, r=jackh726
Some method confirmation code nits
1. Make some pick methods take `&self` instead of `&mut` to avoid some cloning
2. Pass some values by reference to avoid some cloning
3. Rename a few variables here and there
Matthias Krüger [Sat, 10 Dec 2022 23:30:18 +0000 (00:30 +0100)]
Rollup merge of #105459 - jyn514:proc-macro-default, r=Mark-Simulacrum
Build rust-analyzer proc-macro server by default
This allows getting rid of some documentation and an extra step when building a custom toolchain: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#creating-a-rustup-toolchain and it seems likely that people will want to do this if they want rustdoc (which is also built by default).
bors [Sat, 10 Dec 2022 16:37:36 +0000 (16:37 +0000)]
Auto merge of #105531 - matthiaskrgr:rollup-7y7zbgl, r=matthiaskrgr
Rollup of 6 pull requests
Successful merges:
- #104460 (Migrate parts of `rustc_expand` to session diagnostics)
- #105192 (Point at LHS on binop type err if relevant)
- #105234 (Remove unneeded field from `SwitchTargets`)
- #105239 (Avoid heap allocation when truncating thread names)
- #105410 (Consider `parent_count` for const param defaults)
- #105482 (Fix invalid codegen during debuginfo lowering)