Commit Graph

160130 Commits

Author SHA1 Message Date
Vadim Petrochenkov
337ced2ef0 rustc_metadata: Merge get_ctor_def_id and get_ctor_kind
Also avoid decoding the whole `ty::AssocItem` to get a `has_self` flag
2021-12-22 11:05:54 +08:00
bors
e100ec5bc7 Auto merge of #92095 - vacuus:master, r=jyn514
rustdoc: Remove 'need_backline' field from `DocFragment`

Fixes [#92084](https://github.com/rust-lang/rust/issues/92084)
2021-12-21 16:04:54 +00:00
bors
8ad3c1dd1d Auto merge of #92149 - fee1-dead:cache-fix, r=oli-obk
Fix bad caching of `~const Drop` bounds

Fixes #92111.
2021-12-21 12:49:10 +00:00
bors
3d57c61a9e Auto merge of #92152 - matthiaskrgr:rollup-nmskpw6, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #90345 (Stabilise entry_insert)
 - #91412 (Improve suggestions for importing out-of-scope traits reexported as `_`)
 - #91770 (Suggest adding a `#[cfg(test)]` to to a test module)
 - #91823 (Make `PTR::as_ref` and similar methods `const`.)
 - #92127 (Move duplicates removal when generating results instead of when displaying them)
 - #92129 (JoinHandle docs: add missing 'the')
 - #92131 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-21 09:01:25 +00:00
Matthias Krüger
ee45a532f3
Rollup merge of #92131 - bjorn3:sync_cg_clif-2021-12-20, r=bjorn3
Sync rustc_codegen_cranelift

The main highlight this sync is improved support for inline assembly. Thanks `@nbdd0121!` Inline assembly is still disabled by default for builds in the main rust repo though. Cranelift will now also be built from the crates.io releases rather than the git repo. Git repos are incompatible with vendoring.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2021-12-21 08:33:43 +01:00
Matthias Krüger
55b494445a
Rollup merge of #92129 - RalfJung:join-handle-docs, r=jyn514
JoinHandle docs: add missing 'the'
2021-12-21 08:33:42 +01:00
Matthias Krüger
b9c3243801
Rollup merge of #92127 - GuillaumeGomez:search-results-duplicate-removal, r=jsha
Move duplicates removal when generating results instead of when displaying them

Currently, we store 200 results per tab and then display them. However, it was possible to have duplicates which is why we have this check. However, instead of doing it when displaying the results, it's much better instead to do it even before to simplify the display part a bit.

r? `@jsha`
2021-12-21 08:33:41 +01:00
Matthias Krüger
4d840a6e45
Rollup merge of #91823 - woppopo:const_ptr_as_ref, r=lcnr
Make `PTR::as_ref` and similar methods `const`.

Tracking issue: #91822
Feature gate: `#![feature(const_ptr_as_ref)]`

```rust
// core::ptr
impl<T: ?Sized> *const T {
    pub const unsafe fn as_ref<'a>(self) -> Option<&'a T>;
    pub const unsafe fn as_uninit_ref<'a>(self) -> Option<&'a MaybeUninit<T>>
    where
        T: Sized;
    pub const unsafe fn as_uninit_slice<'a>(self) -> Option<&'a [MaybeUninit<T>]>;
}

impl<T: ?Sized> *mut T {
    pub const unsafe fn as_ref<'a>(self) -> Option<&'a T>;
    pub const unsafe fn as_uninit_ref<'a>(self) -> Option<&'a MaybeUninit<T>>
    where
        T: Sized;
    pub const unsafe fn as_mut<'a>(self) -> Option<&'a mut T>;
    pub const unsafe fn as_uninit_mut<'a>(self) -> Option<&'a mut MaybeUninit<T>>
    where
        T: Sized;
    pub const unsafe fn as_uninit_slice<'a>(self) -> Option<&'a [MaybeUninit<T>]>;
    pub const unsafe fn as_uninit_slice_mut<'a>(self) -> Option<&'a mut [MaybeUninit<T>]>;
}

impl<T: Sized> NonNull<T> {
    pub const unsafe fn as_uninit_ref<'a>(&self) -> &'a MaybeUninit<T>;
    pub const unsafe fn as_uninit_mut<'a>(&mut self) -> &'a mut MaybeUninit<T>;
}

impl<T: ?Sized> NonNull<T> {
    pub const unsafe fn as_ref<'a>(&self) -> &'a T;
    pub const unsafe fn as_mut<'a>(&mut self) -> &'a mut T;
    pub const unsafe fn as_uninit_slice<'a>(&self) -> &'a [MaybeUninit<T>];
    pub const unsafe fn as_uninit_slice_mut<'a>(&self) -> &'a mut [MaybeUninit<T>];
}
```
2021-12-21 08:33:40 +01:00
Matthias Krüger
790950a530
Rollup merge of #91770 - TaKO8Ki:suggest-adding-cfg-test, r=joshtriplett
Suggest adding a `#[cfg(test)]` to to a test module

closes #88138
2021-12-21 08:33:39 +01:00
Matthias Krüger
af09d24ff6
Rollup merge of #91412 - compiler-errors:issue-86035, r=oli-obk
Improve suggestions for importing out-of-scope traits reexported as `_`

1. Fix up the `parent_map` query to prefer visible parents that _don't_ export items with the name `_`.
    * I'm not sure if I modified this query properly. Not sure if we want to check for other idents than `kw::Underscore`.
    * This also has the side-effect of not doing BFS on any modules re-exported as `_`, but I think that's desirable here too (or else we get suggestions for paths like `a::_::b` like in [this doctest example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d9505ea45bb80adf40bb991298f952be)).
2. Bail in `try_print_visible_def_path` if the `def_id` is re-exported as `_`, which will fall back to printing the def-id's real (definition) path.
    * Side-effect of this is that we print paths that are not actually public, but it seems we already sometimes suggest `use`ing paths that are private anyways. See [this doctest example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=bad513ed3241f8ff87579eed8046ad10) for demonstration of current behavior.
3. Suggest a glob-import (for example `my_library::prelude::*`) if the trait in question is only pub-exported as `_`, as a fallback.
    ```
    use foo::bar::prelude::*; // trait MyTrait
    ```
    * I think this is good fallback behavior to suggest instead of doing nothing. Thanks to the original issue filer for suggesting this.

I was somewhat opinionated about behaviors in this PR, and I'm totally open to limiting the impact of my changes or only landing parts of this. Happy to receive feedback if there are better ways to the same end.

Fixes #86035
2021-12-21 08:33:37 +01:00
Matthias Krüger
3009dd7c5a
Rollup merge of #90345 - passcod:entry-insert, r=dtolnay
Stabilise entry_insert

This stabilises `HashMap:Entry::insert_entry` etc. Tracking issue #65225. It will need an FCP.

This was implemented in #64656 two years ago.

This PR includes the rename and change discussed in https://github.com/rust-lang/rust/issues/65225#issuecomment-910652430, happy to split if needed.
2021-12-21 08:33:37 +01:00
bors
87e8639d8d Auto merge of #91903 - tmiasko:bit-set-hash, r=jackh726
Implement StableHash for BitSet and BitMatrix via Hash

This fixes an issue where bit sets / bit matrices the same word
content but a different domain size would receive the same hash.
2021-12-21 05:42:10 +00:00
Deadbeef
aaaad5b46b
Fix bad caching of ~const Drop bounds 2021-12-21 13:25:43 +08:00
Michael Goulet
682a3428a3 Fixup tests for issue-86035 2021-12-20 19:53:31 -08:00
Michael Goulet
f83508592b Suggest glob-import if we need to import a trait, but it has no visible name 2021-12-20 19:50:15 -08:00
Michael Goulet
c327627a68 Bail if printing item named _ in try_print_visible_def_path 2021-12-20 19:50:15 -08:00
Michael Goulet
1f2cf1e9b7 Prefer visibility paths where items are not named _ 2021-12-20 19:50:15 -08:00
Michael Goulet
48dab5c960 Test for issue-86035 2021-12-20 19:50:06 -08:00
bors
46171fa96c Auto merge of #92126 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/92101
r? `@ghost`
2021-12-21 02:28:46 +00:00
bors
99b0799608 Auto merge of #92144 - rust-lang:tmandry-patch-1, r=Mark-Simulacrum
Add tmandry to .mailmap
2021-12-20 23:19:14 +00:00
Tyler Mandry
d38f68e806
Add tmandry to .mailmap 2021-12-20 15:16:44 -08:00
David Tolnay
a2fd84a125
Bump insert_entry stabilization to Rust 1.59 2021-12-20 13:14:06 -08:00
bjorn3
3426a730ff Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into sync_cg_clif-2021-12-20 2021-12-20 18:56:35 +01:00
bjorn3
97e5045493 Fix taking address of truly unsized type field of unsized adt 2021-12-20 18:49:43 +01:00
Ralf Jung
fbceb7ac3b JoinHandle docs: add missing 'the' 2021-12-20 18:30:29 +01:00
bjorn3
f557a7effb Rustup to rustc 1.59.0-nightly (e95e084a1 2021-12-19) 2021-12-20 18:21:55 +01:00
bjorn3
bb6d83dac9 Sync from rust 84f962a89b 2021-12-20 18:12:18 +01:00
Guillaume Gomez
879d28d3c1 Move duplicates removal when generating results instead of when displaying them 2021-12-20 18:01:04 +01:00
Ralf Jung
c6382869de update Miri 2021-12-20 17:02:29 +01:00
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
Roc Yu
386ab1ed5c
Remove 'need_backline' field of DocFragment 2021-12-19 19:38:59 -05:00
vacuus
38167a806c
Omit check of a successive line in loop
I think that s == "" is the only edge case (as it makes iter.next() return None the first time). The early return is necessary so that the last character of 'out' isn't popped if s == "" && !frag.need_backline
2021-12-19 17:30:37 -05: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