Commit graph

160192 commits

Author SHA1 Message Date
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
Tomoaki Kawada
874514c7b4 kmc-solid: Add std::sys::solid::fs::File::read_buf
Catching up with commit 3b263ceb5c
2021-12-21 11:18:35 +09: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
Ralf Jung
56b7d5fc49 better name for AdjustForForeignAbiError error variant in InterpError 2021-12-20 22:37:15 +01:00
Ralf Jung
a97f41fd69 don't ICE on variadic function calls 2021-12-20 22:37:14 +01:00
Ralf Jung
b815532674 try to fix ICE in fn_abi_of_instance 2021-12-20 22:37:14 +01:00
Ralf Jung
90d7dada69 also compare ArgAttributes 2021-12-20 22:37:14 +01:00
Ralf Jung
b5c7530fcf compare calling convention instead of call ABI 2021-12-20 22:37:14 +01:00
Ralf Jung
fcc5fd6135 const_eval machine: use original instance for replaced MIR bodies 2021-12-20 22:37:14 +01:00
Ralf Jung
11fb22d83a CTFE eval_fn_call: use FnAbi to determine argument skipping and compatibility 2021-12-20 22:37:12 +01:00
David Tolnay
a2fd84a125
Bump insert_entry stabilization to Rust 1.59 2021-12-20 13:14:06 -08:00
David Tolnay
984b10da16
Change Backtrace::enabled atomic from SeqCst to Relaxed 2021-12-20 12:34:10 -08:00
David Tolnay
91161ed110
impl RefUnwindSafe for Once 2021-12-20 11:49:47 -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
Ralf Jung
5994990088 disable test with self-referential generator on Miri 2021-12-20 12:33:55 +01: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
Simonas Kazlauskas
2b821f211b Backport LLVM changes to disable deferred inlining 2021-12-19 23:49:03 +02: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