Commit graph

151620 commits

Author SHA1 Message Date
Aaron Hill
ddd544856e
Compute a better lint_node_id during expansion
When we need to emit a lint at a macro invocation, we currently use the
`NodeId` of its parent definition (e.g. the enclosing function). This
means that any `#[allow]` / `#[deny]` attributes placed 'closer' to the
macro (e.g. on an enclosing block or statement) will have no effect.

This commit computes a better `lint_node_id` in `InvocationCollector`.
When we visit/flat_map an AST node, we assign it a `NodeId` (earlier
than we normally would), and store than `NodeId` in current
`ExpansionData`. When we collect a macro invocation, the current
`lint_node_id` gets cloned along with our `ExpansionData`, allowing it
to be used if we need to emit a lint later on.

This improves the handling of `#[allow]` / `#[deny]` for
`SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` and some `asm!`-related lints.
The 'legacy derive helpers' lint retains its current behavior
(I've inlined the now-removed `lint_node_id` function), since
there isn't an `ExpansionData` readily available.
2021-07-17 23:03:56 -05:00
bors
eb0b95b55a Auto merge of #87129 - FabianWolff:issue-75356, r=varkor
Warn about useless assignments of variables/fields to themselves

This PR fixes #75356. Following `@varkor's` suggestion in https://github.com/rust-lang/rust/issues/75356#issuecomment-700339154, I have implemented this warning as part of the `dead_code` lint. Unlike the `-Wself-assign` implementation in [Clang](56e6d4742e/clang/lib/Sema/SemaExpr.cpp (L13875-L13909)), my implementation also warns about self-assignments of struct fields (`s.x = s.x`).

r? `@varkor`
2021-07-17 22:51:07 +00:00
bors
c7331d65bd Auto merge of #87203 - jackh726:logging, r=nikomatsakis
Some perf optimizations and logging

Various bits of (potential) perf optimizations and some logging additions/changes pulled out from #85499

The only not extremely straightforward change is adding `needs_normalization` in `trait::project`. This is just a perf optimization to avoid fold through a type with *only* opaque types in `UserFacing` mode (as they aren't replaced).

This should be a simple PR for *anyone* to review, so I'm going to let highfive assign. But I'll go ahead and cc `@nikomatsakis` in case he has time today.
2021-07-17 20:23:58 +00:00
jackh726
fa839b1194 Add needs_normalization 2021-07-17 16:09:22 -04:00
jackh726
d954a8ee8e Some perf optimizations and logging 2021-07-17 16:09:17 -04:00
bors
68511b574f Auto merge of #86676 - cjgillot:localexpn, r=petrochenkov
Make expansions stable for incr. comp.

This PR aims to make expansions stable for incr. comp. by using the same architecture as definitions:
- the interned identifier `ExpnId` contains a `CrateNum` and a crate-local id;
- bidirectional maps `ExpnHash <-> ExpnId` are setup;
- incr. comp. on-disk cache saves and reconstructs expansions using their `ExpnHash`.

I tried to use as many `LocalExpnId` as I could in the resolver code, but I may have missed a few opportunities.

All this will allow to use an `ExpnId` as a query key, and to force this query without recomputing caller queries. For instance, this will be used to implement #85999.

r? `@petrochenkov`
2021-07-17 17:56:46 +00:00
Camille GILLOT
b35ceeeec7 Simplify Expn creation. 2021-07-17 19:41:14 +02:00
Camille GILLOT
dddaa6d068 Rename expn_info -> expn_data. 2021-07-17 19:41:13 +02:00
Camille GILLOT
0f8573e57b Pass ExpnData by reference. 2021-07-17 19:41:12 +02:00
Camille GILLOT
a51b131fd1 Always hash spans in expn. 2021-07-17 19:41:11 +02:00
Camille GILLOT
41c1f39fa8 Drop ExpnData::krate. 2021-07-17 19:41:10 +02:00
Camille GILLOT
dbd2d77641 Drop orig_id. 2021-07-17 19:41:09 +02:00
Camille GILLOT
37a13def48 Encode ExpnId using ExpnHash for incr. comp. 2021-07-17 19:41:08 +02:00
Camille GILLOT
2fe37c5bd1 Choose encoding format in caller code. 2021-07-17 19:41:07 +02:00
Camille GILLOT
078dd37f88 Use LocalExpnId where possible. 2021-07-17 19:41:02 +02:00
Camille GILLOT
6e78d6c9d6 Make the CrateNum part of the ExpnId. 2021-07-17 19:35:33 +02:00
bors
c78ebb7bdc Auto merge of #87123 - RalfJung:miri-provenance-overhaul, r=oli-obk
CTFE/Miri engine Pointer type overhaul

This fixes the long-standing problem that we are using `Scalar` as a type to represent pointers that might be integer values (since they point to a ZST). The main problem is that with int-to-ptr casts, there are multiple ways to represent the same pointer as a `Scalar` and it is unclear if "normalization" (i.e., the cast) already happened or not. This leads to ugly methods like `force_mplace_ptr` and `force_op_ptr`.
Another problem this solves is that in Miri, it would make a lot more sense to have the `Pointer::offset` field represent the full absolute address (instead of being relative to the `AllocId`). This means we can do ptr-to-int casts without access to any machine state, and it means that the overflow checks on pointer arithmetic are (finally!) accurate.

To solve this, the `Pointer` type is made entirely parametric over the provenance, so that we can use `Pointer<AllocId>` inside `Scalar` but use `Pointer<Option<AllocId>>` when accessing memory (where `None` represents the case that we could not figure out an `AllocId`; in that case the `offset` is an absolute address). Moreover, the `Provenance` trait determines if a pointer with a given provenance can be cast to an integer by simply dropping the provenance.

I hope this can be read commit-by-commit, but the first commit does the bulk of the work. It introduces some FIXMEs that are resolved later.
Fixes https://github.com/rust-lang/miri/issues/841
Miri PR: https://github.com/rust-lang/miri/pull/1851
r? `@oli-obk`
2021-07-17 15:26:27 +00:00
bors
f502bd3abd Auto merge of #86761 - Alexhuszagh:master, r=estebank
Update Rust Float-Parsing Algorithms to use the Eisel-Lemire algorithm.

# Summary

Rust, although it implements a correct float parser, has major performance issues in float parsing. Even for common floats, the performance can be 3-10x [slower](https://arxiv.org/pdf/2101.11408.pdf) than external libraries such as [lexical](https://github.com/Alexhuszagh/rust-lexical) and [fast-float-rust](https://github.com/aldanor/fast-float-rust).

Recently, major advances in float-parsing algorithms have been developed by Daniel Lemire, along with others, and implement a fast, performant, and correct float parser, with speeds up to 1200 MiB/s on Apple's M1 architecture for the [canada](0e2b5d163d/data/canada.txt) dataset, 10x faster than Rust's 130 MiB/s.

In addition, [edge-cases](https://github.com/rust-lang/rust/issues/85234) in Rust's [dec2flt](868c702d0c/library/core/src/num/dec2flt) algorithm can lead to over a 1600x slowdown relative to efficient algorithms. This is due to the use of Clinger's correct, but slow [AlgorithmM and Bellepheron](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.45.4152&rep=rep1&type=pdf), which have been improved by faster big-integer algorithms and the Eisel-Lemire algorithm, respectively.

Finally, this algorithm provides substantial improvements in the number of floats the Rust core library can parse. Denormal floats with a large number of digits cannot be parsed, due to use of the `Big32x40`, which simply does not have enough digits to round a float correctly. Using a custom decimal class, with much simpler logic, we can parse all valid decimal strings of any digit count.

```rust
// Issue in Rust's dec2fly.
"2.47032822920623272088284396434110686182e-324".parse::<f64>();   // Err(ParseFloatError { kind: Invalid })
```

# Solution

This pull request implements the Eisel-Lemire algorithm, modified from [fast-float-rust](https://github.com/aldanor/fast-float-rust) (which is licensed under Apache 2.0/MIT), along with numerous modifications to make it more amenable to inclusion in the Rust core library. The following describes both features in fast-float-rust and improvements in fast-float-rust for inclusion in core.

**Documentation**

Extensive documentation has been added to ensure the code base may be maintained by others, which explains the algorithms as well as various associated constants and routines. For example, two seemingly magical constants include documentation to describe how they were derived as follows:

```rust
    // Round-to-even only happens for negative values of q
    // when q ≥ −4 in the 64-bit case and when q ≥ −17 in
    // the 32-bitcase.
    //
    // When q ≥ 0,we have that 5^q ≤ 2m+1. In the 64-bit case,we
    // have 5^q ≤ 2m+1 ≤ 2^54 or q ≤ 23. In the 32-bit case,we have
    // 5^q ≤ 2m+1 ≤ 2^25 or q ≤ 10.
    //
    // When q < 0, we have w ≥ (2m+1)×5^−q. We must have that w < 2^64
    // so (2m+1)×5^−q < 2^64. We have that 2m+1 > 2^53 (64-bit case)
    // or 2m+1 > 2^24 (32-bit case). Hence,we must have 2^53×5^−q < 2^64
    // (64-bit) and 2^24×5^−q < 2^64 (32-bit). Hence we have 5^−q < 2^11
    // or q ≥ −4 (64-bit case) and 5^−q < 2^40 or q ≥ −17 (32-bitcase).
    //
    // Thus we have that we only need to round ties to even when
    // we have that q ∈ [−4,23](in the 64-bit case) or q∈[−17,10]
    // (in the 32-bit case). In both cases,the power of five(5^|q|)
    // fits in a 64-bit word.
    const MIN_EXPONENT_ROUND_TO_EVEN: i32;
    const MAX_EXPONENT_ROUND_TO_EVEN: i32;
```

This ensures maintainability of the code base.

**Improvements for Disguised Fast-Path Cases**

The fast path in float parsing algorithms attempts to use native, machine floats to represent both the significant digits and the exponent, which is only possible if both can be exactly represented without rounding. In practice, this means that the significant digits must be 53-bits or less and the then exponent must be in the range `[-22, 22]` (for an f64). This is similar to the existing dec2flt implementation.

However, disguised fast-path cases exist, where there are few significant digits and an exponent above the valid range, such as `1.23e25`. In this case, powers-of-10 may be shifted from the exponent to the significant digits, discussed at length in https://github.com/rust-lang/rust/issues/85198.

**Digit Parsing Improvements**

Typically, integers are parsed from string 1-at-a-time, requiring unnecessary multiplications which can slow down parsing. An approach to parse 8 digits at a time using only 3 multiplications is described in length [here](https://johnnylee-sde.github.io/Fast-numeric-string-to-int/). This leads to significant performance improvements, and is implemented for both big and little-endian systems.

**Unsafe Changes**

Relative to fast-float-rust, this library makes less use of unsafe functionality and clearly documents it. This includes the refactoring and documentation of numerous unsafe methods undesirably marked as safe. The original code would look something like this, which is deceptively marked as safe for unsafe functionality.

```rust
impl AsciiStr {
    #[inline]
    pub fn step_by(&mut self, n: usize) -> &mut Self {
        unsafe { self.ptr = self.ptr.add(n) };
        self
    }
}

...

#[inline]
fn parse_scientific(s: &mut AsciiStr<'_>) -> i64 {
    // the first character is 'e'/'E' and scientific mode is enabled
    let start = *s;
    s.step();
    ...
}
```

The new code clearly documents safety concerns, and does not mark unsafe functionality as safe, leading to better safety guarantees.

```rust
impl AsciiStr {
    /// Advance the view by n, advancing it in-place to (n..).
    pub unsafe fn step_by(&mut self, n: usize) -> &mut Self {
        // SAFETY: same as step_by, safe as long n is less than the buffer length
        self.ptr = unsafe { self.ptr.add(n) };
        self
    }
}

...

/// Parse the scientific notation component of a float.
fn parse_scientific(s: &mut AsciiStr<'_>) -> i64 {
    let start = *s;
    // SAFETY: the first character is 'e'/'E' and scientific mode is enabled
    unsafe {
        s.step();
    }
    ...
}
```

This allows us to trivially demonstrate the new implementation of dec2flt is safe.

**Inline Annotations Have Been Removed**

In the previous implementation of dec2flt, inline annotations exist practically nowhere in the entire module. Therefore, these annotations have been removed, which mostly does not impact [performance](https://github.com/aldanor/fast-float-rust/issues/15#issuecomment-864485157).

**Fixed Correctness Tests**

Numerous compile errors in `src/etc/test-float-parse` were present, due to deprecation of `time.clock()`, as well as the crate dependencies with `rand`. The tests have therefore been reworked as a [crate](https://github.com/Alexhuszagh/rust/tree/master/src/etc/test-float-parse), and any errors in `runtests.py` have been patched.

**Undefined Behavior**

An implementation of `check_len` which relied on undefined behavior (in fast-float-rust) has been refactored, to ensure that the behavior is well-defined. The original code is as follows:

```rust
    #[inline]
    pub fn check_len(&self, n: usize) -> bool {
        unsafe { self.ptr.add(n) <= self.end }
    }
```

And the new implementation is as follows:

```rust
    /// Check if the slice at least `n` length.
    fn check_len(&self, n: usize) -> bool {
        n <= self.as_ref().len()
    }
```

Note that this has since been fixed in [fast-float-rust](https://github.com/aldanor/fast-float-rust/pull/29).

**Inferring Binary Exponents**

Rather than explicitly store binary exponents, this new implementation infers them from the decimal exponent, reducing the amount of static storage required. This removes the requirement to store [611 i16s](868c702d0c/library/core/src/num/dec2flt/table.rs (L8)).

# Code Size

The code size, for all optimizations, does not considerably change relative to before for stripped builds, however it is **significantly** smaller prior to stripping the resulting binaries. These binary sizes were calculated on x86_64-unknown-linux-gnu.

**new**

Using rustc version 1.55.0-dev.

opt-level|size|size(stripped)
|:-:|:-:|:-:|
0|400k|300K
1|396k|292K
2|392k|292K
3|392k|296K
s|396k|292K
z|396k|292K

**old**

Using rustc version 1.53.0-nightly.

opt-level|size|size(stripped)
|:-:|:-:|:-:|
0|3.2M|304K
1|3.2M|292K
2|3.1M|284K
3|3.1M|284K
s|3.1M|284K
z|3.1M|284K

# Correctness

The dec2flt implementation passes all of Rust's unittests and comprehensive float parsing tests, along with numerous other tests such as Nigel Toa's comprehensive float [tests](https://github.com/nigeltao/parse-number-fxx-test-data) and Hrvoje Abraham  [strtod_tests](https://github.com/ahrvoje/numerics/blob/master/strtod/strtod_tests.toml). Therefore, it is unlikely that this algorithm will incorrectly round parsed floats.

# Issues Addressed

This will fix and close the following issues:

- resolves #85198
- resolves #85214
- resolves #85234
- fixes #31407
- fixes #31109
- fixes #53015
- resolves #68396
- closes https://github.com/aldanor/fast-float-rust/issues/15
2021-07-17 12:56:22 +00:00
bors
64d171b8a4 Auto merge of #87124 - Andy-Python-Programmer:code_model_uefi_patch, r=petrochenkov
Use small code model for UEFI targets

* Since the code model only applies to the code and not the data and the code model
only applies to functions you call through using `call`, `jmp` and data with `lea`, etc…

  If you are calling functions using the function pointers from the UEFI structures the code
  model does not apply in that case. It’s just related to the address space size of your own binary.
  Since UEFI (uefi is all relocatable) uses relocatable PEs (relocatable code does not care about the
  code model) so, we use the small code model here.

* Since applications don't usually take gigabytes of memory, setting the
target to use the small code model should result in better codegen (comparable
with majority of other targets).

  Large code models are also known for generating horrible code, for
  example 16 bytes of code to load a single 8-byte value.

Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2021-07-17 10:15:33 +00:00
bors
153df0f6ef Auto merge of #86062 - nagisa:nagisa/what-a-lie, r=estebank
Do not allow JSON targets to set is-builtin: true

Note that this will affect (and make builds fail for) all of the projects out there that have target files invalid in this way. Crater, however, does not really cover these kinds of the codebases, so it is quite difficult to measure the impact. That said, the target files invalid in this way can start causing build failures each time LLVM is upgraded, anyway, so it is probably a good opportunity to disallow this property, entirely.

Another approach considered was to simply not parse this field anymore, which would avoid making the builds explicitly fail, but it wasn't clear to me if `is-builtin` was always set unintentionally… In case this was the case, I'd expect people to file a feature request stating specifically for what purpose they were using `is-builtin`.

Fixes #86017
2021-07-17 07:54:03 +00:00
Alex Huszagh
8752b40369 Changed dec2flt to use the Eisel-Lemire algorithm.
Implementation is based off fast-float-rust, with a few notable changes.

- Some unsafe methods have been removed.
- Safe methods with inherently unsafe functionality have been removed.
- All unsafe functionality is documented and provably safe.
- Extensive documentation has been added for simpler maintenance.
- Inline annotations on internal routines has been removed.
- Fixed Python errors in src/etc/test-float-parse/runtests.py.
- Updated test-float-parse to be a library, to avoid missing rand dependency.
- Added regression tests for #31109 and #31407 in core tests.
- Added regression tests for #31109 and #31407 in ui tests.
- Use the existing slice primitive to simplify shared dec2flt methods
- Remove Miri ignores from dec2flt, due to faster parsing times.

- resolves #85198
- resolves #85214
- resolves #85234
- fixes #31407
- fixes #31109
- fixes #53015
- resolves #68396
- closes https://github.com/aldanor/fast-float-rust/issues/15
2021-07-17 00:30:34 -05:00
Andy-Python-Programmer
db1e49257e
Use small code model for UEFI targets
* Since the code model only applies to the code and not the data and the code model
only applies to functions you call through using `call`, `jmp` and data with `lea`, etc…

If you are calling functions using the function pointers from the UEFI structures the code
model does not apply in that case. It’s just related to the address space size of your own binary.
Since UEFI (uefi is all relocatable) uses relocatable PEs (relocatable code does not care about the
code model) so, we use the small code model here.

* Since applications don't usually take gigabytes of memory, setting the
target to use the small code model should result in better codegen (comparable
with majority of other targets).

Large code models are also known for generating horrible code, for
example 16 bytes of code to load a single 8-byte value.

* Use the LLVM default code model for the architecture for the
x86_64-unknown-uefi targets. For reference small is the default
code model on x86 in LLVM: <7de2173c2a/llvm/lib/Target/X86/X86TargetMachine.cpp (L204)>

* Remove the comments too as they are not UEFI-specific and applies
to pretty much any target. I added them before as I was explicitily
setting the code model to small.

Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2021-07-17 14:08:40 +10:00
bors
0cd12d649e Auto merge of #87195 - yaahc:move-assert_matches-again, r=oli-obk
rename assert_matches module

Fixes nightly breakage introduced in https://github.com/rust-lang/rust/pull/86947
2021-07-17 00:35:36 +00:00
bors
32c447e179 Auto merge of #83898 - Aaron1011:feature/hir-wf, r=estebank
Add initial implementation of HIR-based WF checking for diagnostics

During well-formed checking, we walk through all types 'nested' in
generic arguments. For example, WF-checking `Option<MyStruct<u8>>`
will cause us to check `MyStruct<u8>` and `u8`. However, this is done
on a `rustc_middle::ty::Ty`, which has no span information. As a result,
any errors that occur will have a very general span (e.g. the
definintion of an associated item).

This becomes a problem when macros are involved. In general, an
associated type like `type MyType = Option<MyStruct<u8>>;` may
have completely different spans for each nested type in the HIR. Using
the span of the entire associated item might end up pointing to a macro
invocation, even though a user-provided span is available in one of the
nested types.

This PR adds a framework for HIR-based well formed checking. This check
is only run during error reporting, and is used to obtain a more precise
span for an existing error. This is accomplished by individually
checking each 'nested' type in the HIR for the type, allowing us to
find the most-specific type (and span) that produces a given error.

The majority of the changes are to the error-reporting code. However,
some of the general trait code is modified to pass through more
information.

Since this has no soundness implications, I've implemented a minimal
version to begin with, which can be extended over time. In particular,
this only works for HIR items with a corresponding `DefId` (e.g. it will
not work for WF-checking performed within function bodies).
2021-07-16 21:54:42 +00:00
Aaron Hill
a765333738
Add initial implementation of HIR-based WF checking for diagnostics
During well-formed checking, we walk through all types 'nested' in
generic arguments. For example, WF-checking `Option<MyStruct<u8>>`
will cause us to check `MyStruct<u8>` and `u8`. However, this is done
on a `rustc_middle::ty::Ty`, which has no span information. As a result,
any errors that occur will have a very general span (e.g. the
definintion of an associated item).

This becomes a problem when macros are involved. In general, an
associated type like `type MyType = Option<MyStruct<u8>>;` may
have completely different spans for each nested type in the HIR. Using
the span of the entire associated item might end up pointing to a macro
invocation, even though a user-provided span is available in one of the
nested types.

This PR adds a framework for HIR-based well formed checking. This check
is only run during error reporting, and is used to obtain a more precise
span for an existing error. This is accomplished by individually
checking each 'nested' type in the HIR for the type, allowing us to
find the most-specific type (and span) that produces a given error.

The majority of the changes are to the error-reporting code. However,
some of the general trait code is modified to pass through more
information.

Since this has no soundness implications, I've implemented a minimal
version to begin with, which can be extended over time. In particular,
this only works for HIR items with a corresponding `DefId` (e.g. it will
not work for WF-checking performed within function bodies).
2021-07-16 16:29:02 -05:00
Jane Lusby
d0e8de68c4 i sweat to god 2021-07-16 13:25:11 -07:00
Jane Lusby
085d52c588 pls this time 2021-07-16 12:16:39 -07:00
bors
74ef0c3e40 Auto merge of #87201 - GuillaumeGomez:rollup-4loi2q9, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #87107 (Loop over all opaque types instead of looking at just the first one with the same DefId)
 - #87158 (Suggest full enum variant for local modules)
 - #87174 (Stabilize `[T; N]::map()`)
 - #87179 (Mark `const_trait_impl` as active)
 - #87180 (feat(rustdoc): open sidebar menu when links inside it are focused)
 - #87188 (Add GUI test for auto-hide-trait-implementations setting)
 - #87200 (TAIT: Infer all inference variables in opaque type substitutions via InferCx)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-16 19:04:16 +00:00
Jane Lusby
e3dd616911 fix ui tests 2021-07-16 11:26:20 -07:00
Ralf Jung
efbee50600 avoid manual Debug impls by adding extra Provenance bounds to types
I wish the derive macro would support adding extra where clauses...
2021-07-16 20:02:14 +02:00
Guillaume Gomez
7d36d69b4a
Rollup merge of #87200 - oli-obk:fixup_fixup_opaque_types, r=nikomatsakis
TAIT: Infer all inference variables in opaque type substitutions via InferCx

The previous algorithm was correct for the example given in its
documentation, but when the TAIT was declared as a free item
instead of an associated item, the generic parameters were the
wrong ones.

cc `@spastorino`

r? `@nikomatsakis`
2021-07-16 19:54:12 +02:00
Guillaume Gomez
e596aa294b
Rollup merge of #87188 - GuillaumeGomez:gui-test-auto-hide-trait-impl, r=notriddle
Add GUI test for auto-hide-trait-implementations setting

Fixes #85592.

r? ``@notriddle``
2021-07-16 19:54:10 +02:00
Guillaume Gomez
12ed22ffe4
Rollup merge of #87180 - notriddle:notriddle/sidebar-keyboard-mobile, r=GuillaumeGomez
feat(rustdoc): open sidebar menu when links inside it are focused

Fixes #87172

Based on #87167 (which should be merged first)

r? ``@GuillaumeGomez``

Preview it at https://notriddle.com/notriddle-rustdoc-test/std/index.html
2021-07-16 19:54:08 +02:00
Guillaume Gomez
4fbac2994f
Rollup merge of #87179 - fee1-dead:active-const-impl, r=oli-obk
Mark `const_trait_impl` as active

See [this zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/implementation.20path.20for.20const.20trait.20impls).

r? ``@oli-obk``
2021-07-16 19:54:06 +02:00
Guillaume Gomez
7c5cabe30f
Rollup merge of #87174 - inquisitivecrystal:array-map, r=kennytm
Stabilize `[T; N]::map()`

This stabilizes the `[T; N]::map()` function, gated by the `array_map` feature. The FCP has [already completed.](https://github.com/rust-lang/rust/issues/75243#issuecomment-878448138)

Closes #75243.
2021-07-16 19:54:04 +02:00
Guillaume Gomez
effea681c0
Rollup merge of #87158 - In-line:suggest-full-enum-variant-for-local-module, r=estebank
Suggest full enum variant for local modules
2021-07-16 19:54:02 +02:00
Guillaume Gomez
8273567a71
Rollup merge of #87107 - oli-obk:tait_double, r=nikomatsakis
Loop over all opaque types instead of looking at just the first one with the same DefId

This exposed a bug in VecMap and is needed for https://github.com/rust-lang/rust/pull/86410 anyway

r? ``@spastorino``

cc ``@nikomatsakis``
2021-07-16 19:53:59 +02:00
Oli Scherer
ebe21ac23a Infer all inference variables via InferCx
The previous algorithm was correct for the example given in its
documentation, but when the TAIT was declared as a free item
instead of an associated item, the generic parameters were the
wrong ones.
2021-07-16 17:37:28 +00:00
Oli Scherer
24a8d3bce3 Add some more tracing instrumentation 2021-07-16 17:34:17 +00:00
bors
c49895d904 Auto merge of #84623 - jackh726:gats-incomplete, r=nikomatsakis
Make GATs no longer an incomplete feature

Blocked on ~#84622~, ~#82272~, ~#76826~

r? `@nikomatsakis`
2021-07-16 16:23:15 +00:00
Jane Lusby
93b7aee2da rename assert_matches module 2021-07-16 09:18:14 -07:00
Michael Howell
0ea2980ae5 feat(rustdoc): open sidebar menu when links inside it are focused
Fixes #87172

Based on #87167 (which should be merged first)

Preview it at https://notriddle.com/notriddle-rustdoc-test/std/index.html

Co-authored-by: Guillaume Gomez <guillaume.gomez@huawei.com>
2021-07-16 08:32:20 -07:00
bors
2119976c49 Auto merge of #87140 - camsteffen:pat-slice-refs, r=oli-obk
Remove refs from Pat slices

Changes `PatKind::Or(&'hir [&'hir Pat<'hir>])` to `PatKind::Or(&'hir [Pat<'hir>])` and others. This is more consistent with `ExprKind`, saves a little memory, and is a little easier to use.
2021-07-16 13:35:48 +00:00
Guillaume Gomez
f6efa33566 Add GUI test for auto-hide-trait-implementations setting 2021-07-16 15:15:23 +02:00
Ralf Jung
a5299fb688 add some comments regarding the two major quirks of our memory model 2021-07-16 13:16:09 +02:00
bors
59d92bd017 Auto merge of #87182 - GuillaumeGomez:rollup-whwohua, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #86983 (Add or improve natvis definitions for common standard library types)
 - #87069 (ExprUseVisitor: Treat ByValue use of Copy types as ImmBorrow)
 - #87138 (Correct invariant documentation for `steps_between`)
 - #87145 (Make --cap-lints and related options leave crate hash alone)
 - #87161 (RFC2229: Use the correct place type)
 - #87162 (Fix type decl layout "overflow")
 - #87167 (Fix sidebar display on small devices)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-16 09:28:22 +00:00
Ralf Jung
7c720ce612 get rid of incorrect erase_for_fmt 2021-07-16 10:09:56 +02:00
Guillaume Gomez
b19f37ca54
Rollup merge of #87167 - GuillaumeGomez:sidebar-display-mobile, r=notriddle
Fix sidebar display on small devices

Part of #87059.

Instead of hiding the sidebar on small devices, we instead move it out of the viewport so that it remains "visible" to our text only users.

Could you confirm it works for you `@ahicks92` and `@DataTriny` please? You can give it a try at [this URL](https://guillaume-gomez.fr/rustdoc-test/test_docs/index.html).

r? `@notriddle`
2021-07-16 10:08:11 +02:00
Guillaume Gomez
a547abe929
Rollup merge of #87162 - GuillaumeGomez:type-decl-overflow, r=notriddle
Fix type decl layout "overflow"

Before:

![Screenshot from 2021-07-15 17-56-12](https://user-images.githubusercontent.com/3050060/125822644-c4595211-d75e-4dd7-ba44-183197ee836c.png)

After:

![Screenshot from 2021-07-15 17-56-17](https://user-images.githubusercontent.com/3050060/125822648-7b363847-e153-4ff3-9fba-59478e32eced.png)

cc ```@SergioBenitez```

r? ```@notriddle```
2021-07-16 10:08:09 +02:00
Guillaume Gomez
41433795e7
Rollup merge of #87161 - sexxi-goose:fix-issue-87097, r=nikomatsakis
RFC2229: Use the correct place type

Closes https://github.com/rust-lang/rust/issues/87097

The ICE occurred because instead of looking at the type of the place after all the projections are applied, we instead looked at the `base_ty` of the Place to decide whether a discriminant should be read of not. This lead to two issues:

1. the kind of the type is not necessarily `Adt` since we only look at the `base_ty`, it could be instead `Ref` for example
2. if the kind of the type is `Adt` you could still be looking at the wrong variant to make a decision on whether the discriminant should be read or not

r? `@nikomatsakis`
2021-07-16 10:08:08 +02:00