Commit Graph

159990 Commits

Author SHA1 Message Date
bors
23f69235ad Auto merge of #92108 - r00ster91:patch-6, r=jyn514
paniced -> panicked
2021-12-20 14:53:48 +00:00
bors
84f962a89b Auto merge of #91924 - Aaron1011:serialize-adt-def, r=michaelwoerister
Fully serialize AdtDef

This avoids needing to invoke the `adt_def` query during
the decoding of another query's result.

Split out from https://github.com/rust-lang/rust/pull/91919
See https://github.com/rust-lang/rust/issues/91696#issuecomment-993043710
2021-12-20 10:35:48 +00:00
bors
60f3bd78ee Auto merge of #92041 - Aaron1011:remove-speculative-evaluation, r=jackh726
Remove 'speculative evaluation' of predicates

Performing 'speculative evaluation' introduces caching bugs that
cannot be fixed without invasive changes to projection.

Hopefully, we can win back most of the performance lost by
re-adding 'cache completion'

Fixes #90662
2021-12-20 07:30:16 +00:00
bors
940a97a910 Auto merge of #91900 - pitaj:fix-91714, r=jyn514
rustdoc: make `--passes` and `--no-defaults` have no effect

Fixes #91714

One potential issue is that currently there is no stable way to achieve `--document-hidden-items`. This affects test `issue-15347`.

I also had to modify the tests `issue-42875` and `no-compiler-export`. Regardless of combinations of `--document-hidden-items` and `--document-private-items`, I was unable to get these to pass without the modifications. I left behind a comment noting the change.
2021-12-20 04:21:12 +00:00
bors
ed7a206843 Auto merge of #91844 - nnethercote:rm-ObligationCauseData-2, r=Mark-Simulacrum
Eliminate `ObligationCauseData`

This makes `Obligation` two words bigger, but avoids allocating a lot of the time.

I previously tried this in #73983 and it didn't help much, but local timings look more promising now.

r? `@ghost`
2021-12-20 00:40:58 +00:00
Nicholas Nethercote
f09b1facd0 Eliminate ObligationCauseData.
This makes `Obligation` two words bigger, but avoids allocating a lot of
the time.

I previously tried this in #73983 and it didn't help much, but local
timings look more promising now.
2021-12-20 09:29:20 +11:00
r00ster
8fb9a8570b
paniced -> panicked 2021-12-19 21:08:19 +01:00
bors
e95e084a14 Auto merge of #92106 - matthiaskrgr:rollup-zw6t1mu, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #91791 (Fix an ICE when lowering a float with missing exponent magnitude)
 - #91878 (Remove `in_band_lifetimes` from `rustc_infer`)
 - #91895 (Remove `in_band_lifetimes` for `rustc_monomorphize`)
 - #92029 (Explicitly set no ELF flags for .rustc section)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-19 17:14:12 +00:00
Matthias Krüger
9415c67ae5
Rollup merge of #92029 - nikic:section-flags-fix, r=davidtwco
Explicitly set no ELF flags for .rustc section

For a data section, the object crate will set the SHF_ALLOC by default, which is exactly what we don't want. Explicitly set sh_flags to zero to avoid this.

I checked with `objdump -h` that this produces the right flags for ELF.

Fixes #92013.
2021-12-19 17:38:35 +01:00
Matthias Krüger
fba0d04d30
Rollup merge of #91895 - pitaj:91867-monomorphize, r=Aaron1011
Remove `in_band_lifetimes` for `rustc_monomorphize`

#91867
2021-12-19 17:38:34 +01:00
Matthias Krüger
d576f7d42d
Rollup merge of #91878 - LegionMammal978:less-inband-infer, r=Aaron1011
Remove `in_band_lifetimes` from `rustc_infer`

See #91867 for more information.

This crate actually had a typo `'ctx` in one of its functions:
```diff
-pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool {
+pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
```
Also, I wasn't entirely sure about the lifetimes in `suggest_new_region_bound`:
```diff
 pub fn suggest_new_region_bound(
-    tcx: TyCtxt<'tcx>,
+    tcx: TyCtxt<'_>,
     err: &mut DiagnosticBuilder<'_>,
     fn_returns: Vec<&rustc_hir::Ty<'_>>,
```
Should all of those lifetimes really be distinct?
2021-12-19 17:38:33 +01:00
Matthias Krüger
c088e5092b
Rollup merge of #91791 - terrarier2111:fix-float-ice, r=nagisa
Fix an ICE when lowering a float with missing exponent magnitude

This fixes: https://github.com/rust-lang/rust/issues/91434
2021-12-19 17:38:33 +01:00
bors
41c3017c82 Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #91141 (Revert "Temporarily rename int_roundings functions to avoid conflicts")
 - #91984 (Remove `in_band_lifetimes` from `rustc_middle`)
 - #92028 (Sync portable-simd to fix libcore build for AVX-512 enabled targets)
 - #92042 (Enable `#[thread_local]` for all windows-msvc targets)
 - #92071 (Update example code for Vec::splice to change the length)
 - #92077 (rustdoc: Remove unused `collapsed` field)
 - #92081 (rustdoc: Remove unnecessary `need_backline` function)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-19 12:36:56 +00:00
threadexception
0003280b9b Fix an ICE when lowering a float with missing exponent magnitude
Co-authored-by: Simonas Kazlauskas <github@kazlauskas.me>
2021-12-19 11:52:33 +01:00
Matthias Krüger
3340666812
Rollup merge of #92081 - jyn514:need-backline, r=GuillaumeGomez
rustdoc: Remove unnecessary `need_backline` function

r? `@GuillaumeGomez`
2021-12-19 10:45:56 +01:00
Matthias Krüger
1f080f64ee
Rollup merge of #92077 - jyn514:remove-collapsed, r=GuillaumeGomez
rustdoc: Remove unused `collapsed` field

`render/context` always runs after `run_global_context`, so it was always set to `true`.

This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was
removed ages ago, and the ability to configure passes is about to be removed.

Found while reviewing https://github.com/rust-lang/rust/pull/91305.
2021-12-19 10:45:55 +01:00
Matthias Krüger
690d6b0958
Rollup merge of #92071 - ajtribick:patch-1, r=the8472
Update example code for Vec::splice to change the length

The current example for `Vec::splice` illustrates the replacement of a section of length 2 with a new section of length 2. This isn't a particularly interesting case for splice, and makes it look a bit like a shorthand for the kind of manipulations that could be done with a mutable slice.

In order to provide a stronger example, this updates the example to use different lengths for the source and destination regions, and uses a slice from the middle of the vector to illustrate that this does not necessarily have to be at the beginning or the end.

Resolves #92067
2021-12-19 10:45:54 +01:00
Matthias Krüger
4dbe966fdd
Rollup merge of #92042 - ChrisDenton:msvc-static-tls, r=nagisa
Enable `#[thread_local]` for all windows-msvc targets

As it stands, `#[thread_local]` is enabled haphazardly for msvc. It seems all 64-bit targets have it enabled, but not 32-bit targets unless they're also UWP targets (perhaps because UWP was added more recently?). So this PR simply enables it for 32-bit targets as well. I can't think of a reason not to and I've confirmed by running tests locally which pass.

See also #91659
2021-12-19 10:45:53 +01:00
Matthias Krüger
a2db9004cb
Rollup merge of #92028 - petrochenkov:psimd, r=Mark-Simulacrum
Sync portable-simd to fix libcore build for AVX-512 enabled targets

Fixes https://github.com/rust-lang/rust/pull/91484#issuecomment-989933534
cc ``@workingjubilee``
2021-12-19 10:45:52 +01:00
Matthias Krüger
4d5ffc4870
Rollup merge of #91984 - Aaron1011:rustc-middle-lifetime, r=oli-obk
Remove `in_band_lifetimes` from `rustc_middle`

See #91867

This was mostly straightforward. In several places, I take advantage
of the fact that lifetimes are non-hygenic: a macro declares the
'tcx' lifetime, which is then used in types passed in as macro
arguments.
2021-12-19 10:45:51 +01:00
Matthias Krüger
6d2689526b
Rollup merge of #91141 - jhpratt:int_roundings, r=joshtriplett
Revert "Temporarily rename int_roundings functions to avoid conflicts"

This reverts commit 3ece63b64e.

This should be okay because #90329 has been merged.

r? `@joshtriplett`
2021-12-19 10:45:50 +01:00
bors
a41a6925ba Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`
2021-12-19 09:31:37 +00:00
bors
8f54061900 Auto merge of #91871 - camelid:urlpartsbuilder, r=GuillaumeGomez
rustdoc: Add `UrlPartsBuilder`

This is a type for efficiently and easily constructing the part of a URL
after the domain: `nightly/core/str/struct.Bytes.html`.

It allows simplifying some code and avoiding some allocations in the
`href_*` functions.

It will also allow making `Cache.paths` et al. use `Symbol` without
having to allocate `String`s in the `href_*` functions. `String`s would
be necessary otherwise because `Symbol::as_str()` returns `SymbolStr`,
whose `Deref<Target = str>` impl requires the `str` to not outlive it.
This is the primary motivation for the addition of `UrlPartsBuilder`.
2021-12-19 06:26:07 +00:00
bors
d6cffe41b5 Auto merge of #89831 - Aaron1011:project-caching-speedup, r=jackh726
Re-introduce concept of projection cache 'completion'

Instead of clearing out the cache entirely, we store
the intermediate evaluation result into the cache entry.
This accomplishes several things:

* We avoid the performance hit associated with re-evaluating
  the sub-obligations
* We avoid causing issues with incremental compilation, since
  the final evaluation result is always the same
* We avoid affecting other uses of the same `InferCtxt` which
  might care about 'side effects' from processing the sub-obligations
  (e,g. region constraints). Only code that is specifically aware
   of the new 'complete' code is affected
2021-12-19 03:33:19 +00:00
bors
df2f45c1d3 Auto merge of #92090 - matthiaskrgr:rollup-pbyqddi, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #91834 (Update browser-ui-test version and improve rustdoc-gui tests readability)
 - #91894 (Remove `in_band_lifetimes` from `rustc_incremental`)
 - #91932 (Add user seed to `-Z randomize-layout`)
 - #91956 (fix(rustc_lint): better detect when parens are necessary)
 - #92020 (Remove P: Unpin bound on impl Stream for Pin)
 - #92063 (docs: fix typo)
 - #92082 (rustdoc: Write doc-comments directly instead of using FromIterator)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-19 00:24:56 +00:00
Aaron Hill
40ef1d3223
Re-introduce concept of projection cache 'completion'
Instead of clearing out the cache entirely, we store
the intermediate evaluation result into the cache entry.
This accomplishes several things:

* We avoid the performance hit associated with re-evaluating
  the sub-obligations
* We avoid causing issues with incremental compilation, since
  the final evaluation result is always the same
* We avoid affecting other uses of the same `InferCtxt` which
  might care about 'side effects' from processing the sub-obligations
  (e,g. region constraints). Only code that is specifically aware
   of the new 'complete' code is affected
2021-12-18 19:07:14 -05:00
Matthias Krüger
d486e68ab2
Rollup merge of #92082 - jyn514:remove-from-iterator, r=jyn514
rustdoc: Write doc-comments directly instead of using FromIterator

The FromIterator impl made the code much harder to understand. The types
don't make sense until you realize there's a custom FromIterator impl.

This is the first commit from https://github.com/rust-lang/rust/pull/91305; since ``@camelid`` wrote it originally I don't feel bad unilaterally approving it.

r? ``@ghost``
``@bors`` r+

Note that this will conflict with https://github.com/rust-lang/rust/pull/92078.
2021-12-19 00:38:44 +01:00
Matthias Krüger
74c3ce9207
Rollup merge of #92063 - OverOrion:patch-1, r=jyn514
docs: fix typo

Add missing `'s` to ` Let check it out.`
2021-12-19 00:38:43 +01:00
Matthias Krüger
e22aae009f
Rollup merge of #92020 - Folyd:stream-unpin, r=m-ou-se
Remove P: Unpin bound on impl Stream for Pin

Similar to https://github.com/rust-lang/rust/pull/81363.
2021-12-19 00:38:42 +01:00
Matthias Krüger
48915315d2
Rollup merge of #91956 - notriddle:notriddle/unused-parens-range, r=nagisa
fix(rustc_lint): better detect when parens are necessary

Fixes #90807
2021-12-19 00:38:41 +01:00
Matthias Krüger
6b62bf3814
Rollup merge of #91932 - Kixiron:randomize-seed, r=nagisa
Add user seed to `-Z randomize-layout`

Allows users of -`Z randomize-layout` to provide `-Z layout-seed=<seed>` in order to further randomizing type layout randomization. Extension of [compiler-team/#457](https://github.com/rust-lang/compiler-team/issues/457), allows users to change struct layouts without changing code and hoping that item path hashes change, aiding in detecting layout errors
2021-12-19 00:38:41 +01:00
Matthias Krüger
80390871af
Rollup merge of #91894 - pitaj:91867-incremental, r=Aaron1011
Remove `in_band_lifetimes` from `rustc_incremental`

#91867
2021-12-19 00:38:40 +01:00
Matthias Krüger
3f4013d449
Rollup merge of #91834 - GuillaumeGomez:improve-gui-test-readability, r=jsha
Update browser-ui-test version and improve rustdoc-gui tests readability

Since the `0.5.1`, we can use trailing commas. I also used the opportunity to clean up the existing tests.

r? `@notriddle`
2021-12-19 00:38:39 +01:00
bors
daf2204aa4 Auto merge of #91837 - Kobzol:stable-hash-map-avoid-sort, r=the8472
Avoid sorting in hash map stable hashing

Suggested by `@the8472` [here](https://github.com/rust-lang/rust/pull/89404#issuecomment-991813333). I hope that I understood it right, I replaced the sort with modular multiplication, which should be commutative.

Can I ask for a perf. run? However, locally it didn't help at all. Creating the `StableHasher` all over again is probably slowing it down quite a lot. And using `FxHasher` is not straightforward, because the keys and values only implement `HashStable` (and probably they shouldn't be just hashed via `Hash` anyway for it to actually be stable).

Maybe the `StableHash` interface could be changed somehow to better suppor these scenarios where the hasher is short-lived. Or the `StableHasher` implementation could have variants with e.g. a shorter buffer for these scenarios.
2021-12-18 21:23:37 +00:00
bors
91a0600a5c Auto merge of #92065 - matthiaskrgr:rollup-qmpcsuj, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #91566 (Apply path remapping to DW_AT_GNU_dwo_name when producing split DWARF)
 - #91926 (Remove `in_band_lifetimes` from `rustc_metadata`)
 - #91931 (Remove `in_band_lifetimes` from `rustc_codegen_llvm`)
 - #92024 (rustc_codegen_llvm: Give each codegen unit a unique DWARF name on all platforms, not just Apple ones.)
 - #92037 (Use a const ParamEnv when in default_method_body_is_const)
 - #92047 (Set `RUST_BACKTRACE=0` when running location-detail tests)
 - #92050 (Add a space and 2 grave accents )

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-18 18:08:51 +00:00
Nikita Popov
79d5309604 Explicitly set no ELF flags for .rustc section
For a data section, the object crate will set the SHF_ALLOC by
default, which is exactly what we don't want. Explicitly set
sh_flags to zero to avoid this.
2021-12-18 18:44:03 +01:00
Noah Lev
7f383c3aaf Write code directly instead of using FromIterator
The FromIterator impl made the code much harder to understand. The types
don't make sense until you realize there's a custom FromIterator impl.
2021-12-18 11:38:21 -06:00
Joshua Nelson
1f1f7214ca Remove unnecessary need_backline function 2021-12-18 11:32:40 -06:00
Joshua Nelson
dea1c68614 Remove collapsed field
`render/context` always runs after `run_global_context`, so it was always set to `true`.

This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was
removed ages ago, and the ability to configure passes is about to be removed.
2021-12-18 10:47:54 -06:00
ajtribick
574bc67736 Update example code for Vec::splice to change the length 2021-12-18 16:10:00 +01:00
bors
d3848cb659 Auto merge of #92064 - matthiaskrgr:rollup-tgj2pai, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #91858 (pass -Wl,-z,origin to set DF_ORIGIN when using rpath)
 - #91923 (Remove `in_band_lifetimes` from `rustc_query_impl`)
 - #91925 (Remove `in_band_lifetimes` from `rustc_privacy`)
 - #91977 (Clean up search code and unify function returned values)
 - #92018 (Fix typo in "new region bound" suggestion)
 - #92022 (Eliminate duplicate codes of expected_found_bool)
 - #92032 (hir: Do not introduce dummy type names for `extern` blocks in def paths)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-18 15:01:32 +00:00
Matthias Krüger
1ac1f24ddd
Rollup merge of #92050 - r00ster91:patch-5, r=camelid
Add a space and 2 grave accents

I only noticed this because I have this implementation copy pasted in some places in my code and I really can't wait for this to be stabilized...
2021-12-18 14:49:45 +01:00
Matthias Krüger
fd259040d9
Rollup merge of #92047 - Aaron1011:location-detail-backtrace, r=Mark-Simulacrum
Set `RUST_BACKTRACE=0` when running location-detail tests

This ensures that the output does not depend on environment variables
set in the shell.
2021-12-18 14:49:44 +01:00
Matthias Krüger
cc043aa75f
Rollup merge of #92037 - fee1-dead:fix_env_dmbic, r=oli-obk
Use a const ParamEnv when in default_method_body_is_const

r? `@oli-obk`

This PR fixes the param_env function to return `constness: Const` correctly for trait methods marked with `#[default_method_body_is_const]`. The snippet below is erroneously accepted by the compiler and has been fixed by this change. ([Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=12dc6681b2eeee5f604203d96259eeb4))

```rust
#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]

trait Tr {}
impl Tr for () {}

const fn foo<T>() where T: ~const Tr {}

pub trait Foo {
    #[default_method_body_is_const]
    fn foo() {
        foo::<()>();
    }
}
```
2021-12-18 14:49:42 +01:00
Matthias Krüger
53a95ea289
Rollup merge of #92024 - pcwalton:per-codegen-unit-names, r=davidtwco
rustc_codegen_llvm: Give each codegen unit a unique DWARF name on all platforms, not just Apple ones.

To avoid breaking split DWARF, we need to ensure that each codegen unit has a
unique `DW_AT_name`. This is because there's a remote chance that different
codegen units for the same module will have entirely identical DWARF entries
for the purpose of the DWO ID, which would violate Appendix F ("Split Dwarf
Object Files") of the DWARF 5 specification. LLVM uses the algorithm specified
in section 7.32 "Type Signature Computation" to compute the DWO ID, which does
not include any fields that would distinguish compilation units. So we must
embed the codegen unit name into the `DW_AT_name`.

Closes #88521.
2021-12-18 14:49:41 +01:00
Matthias Krüger
ca3d129ee3
Rollup merge of #91931 - LegionMammal978:less-inband-codegen_llvm, r=davidtwco
Remove `in_band_lifetimes` from `rustc_codegen_llvm`

See #91867 for more information.

This one took a while. This crate has dozens of functions not associated with any type, and most of them were using in-band lifetimes for `'ll` and `'tcx`.
2021-12-18 14:49:40 +01:00
Matthias Krüger
9e720a8aae
Rollup merge of #91926 - SylvanB:remove_in_band_lifetimes_from_rustc_metadata, r=nagisa
Remove `in_band_lifetimes` from `rustc_metadata`

Another for #91867
2021-12-18 14:49:39 +01:00
Matthias Krüger
1c42199c8f
Rollup merge of #91566 - cbeuw:remap-dwo-name, r=davidtwco
Apply path remapping to DW_AT_GNU_dwo_name when producing split DWARF

`--remap-path-prefix` doesn't apply to paths to `.o` (in case of packed) or `.dwo` (in case of unpacked) files in `DW_AT_GNU_dwo_name`. GCC also has this bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91888
2021-12-18 14:49:38 +01:00
Matthias Krüger
5e8f934149
Rollup merge of #92032 - petrochenkov:extblockpath, r=oli-obk
hir: Do not introduce dummy type names for `extern` blocks in def paths

Use a separate nameless `DefPathData` variant instead.

Extracted from https://github.com/rust-lang/rust/pull/91795.
2021-12-18 11:28:07 +01:00
Matthias Krüger
a391d545cf
Rollup merge of #92022 - woodenarrow:br_expected_bool, r=estebank
Eliminate duplicate codes of expected_found_bool

The function expected_found_bool is the same as ExpectedFound::new. So use ExpectedFound::new to replace expected_found_bool to eliminate duplicate codes.

![image](https://user-images.githubusercontent.com/95843988/146486722-c910eccd-a36c-4dc5-8b36-214aab058e38.png)
2021-12-18 11:28:06 +01:00