Commit Graph

167414 Commits

Author SHA1 Message Date
CAD97
09f758fe3b Remove ``` `ignore``` from E0705 test 2022-04-30 10:48:38 -05:00
Tomasz Miąsko
0e7d54c9e7 Fix -Zdump-mir-dataflow by implementing DebugWithContext for ChunkedBitSet 2022-04-30 16:40:54 +02:00
Tomasz Miąsko
cdfdb99c9e Add element iterator for ChunkedBitSet 2022-04-30 16:40:49 +02:00
bors
d201c812d4 Auto merge of #93803 - cjgillot:unify-bounds, r=oli-obk
Handle generic bounds in a uniform way in HIR

Generic bounds in HIR used to be split between bounds in the parameter definition and bounds in a where clause. This PR attempts to store all of those as where predicates.

This effectively desugars
```rust
fn foo<T: Default, U>(x: impl Copy) where U: Clone
```
into
```rust
fn foo<T, U, _V>(x: _V) where T: Default, U: Clone, _V: Copy
```
(where _V is actually hidden and called "impl Copy").

I managed to make compiler warnings more uniform.
About rustdoc: is making this desugaring user-visible acceptable?
About clippy: I don't understand the subtle logic in the `needless-lifetimes` lint.

r? `@estebank`
2022-04-30 13:52:29 +00:00
Camille GILLOT
b4e3e62c9c Bless nll tests. 2022-04-30 13:55:17 +02:00
Camille GILLOT
39c67b2133 Correct comment. 2022-04-30 13:55:17 +02:00
Camille GILLOT
74583852e8 Save colon span to suggest bounds. 2022-04-30 13:55:17 +02:00
Camille GILLOT
03bbb98019 Bless tests. 2022-04-30 13:55:17 +02:00
Camille GILLOT
94449e6101 Store all generic bounds as where predicates. 2022-04-30 13:55:13 +02:00
Camille GILLOT
05b29f9a92 Inline WhereClause into Generics. 2022-04-30 13:51:49 +02:00
Camille GILLOT
71b4e2d852 Box HIR Generics and Impl. 2022-04-30 13:51:49 +02:00
Guillaume Gomez
2f074dee42 Extend settings test to ensure settings text is as expected 2022-04-30 13:12:42 +02:00
Guillaume Gomez
e7d7d75c81 Add GUI test for settings menu 2022-04-30 13:12:42 +02:00
Guillaume Gomez
9625ed8be7 Move settings into full JS 2022-04-30 13:12:41 +02:00
Oli Scherer
91f422dfda Also report the call site of PME errors locally.
Note this does not produce a full stack all the way to the first call that specifies all monomorphic parameters, it's just shallowly mentioning the last call site.
2022-04-30 09:04:15 +00:00
bors
76d4862fdd Auto merge of #95776 - cjgillot:ast-lifetimes-static, r=petrochenkov
Enforce static lifetimes in consts during late resolution

This PR moves the handling of implicitly and explicitly static lifetimes in constants from HIR to the AST.
2022-04-30 07:52:18 +00:00
bors
9a98c63b30 Auto merge of #96500 - SparrowLii:rpo, r=tmiasko
Reduce duplication of RPO calculation of mir

Computing the RPO of mir is not a low-cost thing, but it is duplicate in many places. In particular the `iterate_to_fixpoint` method which is called multiple times when computing the data flow.
This PR reduces the number of times the RPO is recalculated as much as possible, which should save some compile time.
2022-04-30 05:06:47 +00:00
Thom Chiovoloni
dff97d5329
Add a bathroom stall to weird expressions test 2022-04-29 20:26:21 -07:00
bors
0c8e520b3e Auto merge of #90988 - estebank:binding-supposed-to-be-const, r=davidtwco
When encountering a binding that could be a const or unit variant, suggest the right path
2022-04-30 02:41:34 +00:00
Esteban Kuber
bce5ab2c78 Use newtype enums instead of bool 2022-04-30 02:40:36 +00:00
Esteban Kuber
09f3ea1692 When encountering a binding that could be a const or unit variant, suggest the right path 2022-04-30 02:27:25 +00:00
alexey semenyuk
6ee70bc6b3
Fix documentation for log functions int 2022-04-29 23:21:50 +00:00
alexey semenyuk
ec90f9dd33
Fix documentation for log functions unsigned int 2022-04-29 23:16:53 +00:00
Camille GILLOT
7d990a8c18 Bless tests. 2022-04-30 00:28:42 +02:00
Camille GILLOT
865d0fef2f Ban non-static lifetimes from AnonConst on AST.
The extra diagnostics come from the compiler no longer aborting before
typeck.
2022-04-30 00:28:42 +02:00
bors
05c07386b4 Auto merge of #96566 - Dylan-DPC:rollup-fo7rd98, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #96390 (Switch JS code to ES6 - part 2)
 - #96527 (RustWrapper: explicitly don't handle DXILPointerTyID)
 - #96536 (rustdoc: fix missing method list for primitive deref target)
 - #96559 (Use the correct lifetime binder for elided lifetimes in path.)
 - #96560 (Remove unnecessary environment variable in cf-protection documentation)
 - #96562 (Fix duplicate directory separator in --remap-path-prefix.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-29 22:27:10 +00:00
Dylan DPC
548fca6927
Rollup merge of #96562 - michaelwoerister:path-remapping-fixes, r=oli-obk
Fix duplicate directory separator in --remap-path-prefix.

The compiler will currently emit duplicate directory separators when `--remap-path-prefix` has an exact match of the working directory and it is invoked with a relative path to the main source file. For example

```bash
rustc src/main.rs -Cdebuginfo=2 --remap-path-prefix="$(pwd)=abc"
```

will produce the path `abc//src/main.rs` in debuginfo. This is because `some_path.join("")` will append a directory separator to `some_path` and then LLVM does not check if the working directory already ends a directory separator before concatenating it with the relative path.
2022-04-29 23:54:43 +02:00
Dylan DPC
2986bef534
Rollup merge of #96560 - abrown:update-docs, r=Dylan-DPC
Remove unnecessary environment variable in cf-protection documentation

Before merging the `cf-protection` flag, it was necessary to use a
locally-compiled version of `rustc`. This is no longer the case and the
documentation should reflect this.
2022-04-29 23:54:42 +02:00
Dylan DPC
2003d833a5
Rollup merge of #96559 - cjgillot:elided-path-fn, r=petrochenkov
Use the correct lifetime binder for elided lifetimes in path.

Fixes https://github.com/rust-lang/rust/issues/96540
2022-04-29 23:54:41 +02:00
Dylan DPC
0b96be79de
Rollup merge of #96536 - rust-lang:notriddle/deref-slice-core, r=GuillaumeGomez
rustdoc: fix missing method list for primitive deref target

This change makes it so that local impls count when listing primitives that need retained.

Fixes #95325
2022-04-29 23:54:40 +02:00
Dylan DPC
041f3b64dd
Rollup merge of #96527 - durin42:llvm-15-werror-wswitch, r=nikic
RustWrapper: explicitly don't handle DXILPointerTyID

This new enum entry was introduced in https://reviews.llvm.org/D122268,
and if I'm reading correctly there's no case where we'd ever encounter
it in our uses of LLVM. To preserve the ability to compile this file
with -Werror -Wswitch we add an explicit case for this entry.

r? nikic
2022-04-29 23:54:38 +02:00
Dylan DPC
bfb13ec691
Rollup merge of #96390 - GuillaumeGomez:es6-part2, r=notriddle
Switch JS code to ES6 - part 2

Part of #93058.

It's based on https://github.com/rust-lang/rust/pull/96361 so it needs to wait for it to be merged first.

r? `@notriddle`
2022-04-29 23:54:37 +02:00
Camille GILLOT
6e349c7f07 Remove error variable. 2022-04-29 22:26:22 +02:00
bors
a707f40107 Auto merge of #95819 - oli-obk:mir_can't_hold_all_these_lifetimes, r=estebank
Enforce Copy bounds for repeat elements while considering lifetimes

fixes https://github.com/rust-lang/rust/issues/95477

this is a breaking change in order to fix a soundness bug.

Before this PR we only checked whether the repeat element type had an `impl Copy`, but not whether that impl also had the appropriate lifetimes. E.g. if the impl was for `YourType<'static>` and not a general `'a`, then copying any type other than a `'static` one should have been rejected, but wasn't.

r? `@lcnr`
2022-04-29 20:00:47 +00:00
SparrowLii
7149bbcdc5 Eliminate duplication of RPO calculation for mir
add `postorder_cache` to mir Body

add `ReversePostorderCache` struct

correct struct name and comments
2022-04-30 03:42:57 +08:00
Michael Woerister
3614bd3c45 Fix duplicate directory separator in --remap-path-prefix. 2022-04-29 21:09:12 +02:00
Oli Scherer
67ce547f47 Refactor and document the repeat length check 2022-04-29 18:56:57 +00:00
Oli Scherer
be54947315 Extract copy bound check into a function 2022-04-29 18:49:02 +00:00
Andrew Brown
7704cf2c5d Remove unnecessary environment variable in cf-protection documentation
Before merging the `cf-protection` flag, it was necessary to use a
locally-compiled version of `rustc`. This is no longer the case and the
documentation should reflect this.
2022-04-29 10:32:37 -07:00
bors
1c8966e5e9 Auto merge of #96474 - SparrowLii:langcall, r=lcnr
Eliminate duplication code of building panic langcall during codegen

From the FIXME in the `codegen_panic_intrinsic` func.
2022-04-29 17:20:00 +00:00
Camille GILLOT
f66de50f8a Use the correct lifetime binder for elided lifetimes in path. 2022-04-29 18:51:21 +02:00
Michael Howell
8743ce8523 rustdoc: prevent B -> C -> B -> C loops from stack overflowing 2022-04-29 09:06:50 -07:00
Camille GILLOT
b711723d41 Bless tests. 2022-04-29 17:46:57 +02:00
ouz-a
4d4b0f140f remove and bless 2022-04-29 18:29:38 +03:00
bors
f1d8a7d662 Auto merge of #96489 - shepmaster:revert-vec-from-array-ref, r=yaahc
Revert "impl From<&[T; N]> and From<&mut [T; N]> for Vec<T>"

This reverts commit 5dd702763a.
2022-04-29 14:39:14 +00:00
bors
683c582c1e Auto merge of #96468 - davidtwco:diagnostic-translation-subdiagnostic, r=oli-obk
macros: subdiagnostic derive

Add a new macro, `#[derive(SessionSubdiagnostic)]`, which can be applied to structs that represent subdiagnostics, such as labels, notes, helps or suggestions.

`#[derive(SessionSubdiagnostic)]` can be used with the existing `#[derive(SessionDiagnostic)]`. All diagnostics implemented using either derive are translatable, and this new derive should make it easier to port existing diagnostics to using these derives.

For example, consider the following subdiagnostic types...

```rust
#[derive(SessionSubdiagnostic)]
pub enum ExpectedIdentifierLabel<'tcx> {
    #[label(slug = "parser-expected-identifier")]
    WithoutFound {
        #[primary_span]
        span: Span,
    }
    #[label(slug = "parser-expected-identifier-found")]
    WithFound {
        #[primary_span]
        span: Span,
        found: String,
    }
}

#[derive(SessionSubdiagnostic)]
#[suggestion_verbose(slug = "parser-raw-identifier")]
pub struct RawIdentifierSuggestion<'tcx> {
    #[primary_span]
    span: Span,
    #[applicability]
    applicability: Applicability,
    ident: Ident,
}
```

...and the corresponding Fluent messages:

```fluent
parser-expected-identifier = expected identifier

parser-expected-identifier-found = expected identifier, found {$found}

parser-raw-identifier = escape `{$ident}` to use it as an identifier
```

These can be emitted using the new `subdiagnostic` function on `Diagnostic`...

```rust
diag.subdiagnostic(ExpectedIdentifierLabel::WithoutFound { span });
diag.subdiagnostic(RawIdentifierSuggestion { span, applicability, ident });
```

...or as part of a larger `#[derive(SessionDiagnostic)]`:

```rust
#[derive(SessionDiagnostic)]
#[error(slug = "parser-expected-identifier")]
pub struct ExpectedIdentifier {
    #[primary_span]
    span: Span,
    token_descr: String,
    #[subdiagnostic]
    label: ExpectedIdentifierLabel,
    #[subdiagnostic]
    raw_identifier_suggestion: Option<RawIdentifierSuggestion>,
}
```

```rust
sess.emit_err(ExpectedIdentifier { ... });
```

r? `@oli-obk`
cc `@pvdrz`
2022-04-29 11:58:24 +00:00
ouz-a
f1c5f34f76 exp-stuff-dirty 2022-04-29 14:42:24 +03:00
bors
87937d3b6c Auto merge of #96548 - Dylan-DPC:rollup-m3xkqxg, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #96477 (Update data layout string for wasm64-unknown-unknown)
 - #96481 (HashMap doc: Don't use monospace font for 'Entry Api')
 - #96492 (Revert "Re-export core::ffi types from std::ffi")
 - #96516 (Revert diagnostic duplication and accidental stabilization)
 - #96523 (Add ``@feat.00`` symbol to symbols.o for COFF)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-29 09:33:29 +00:00
Dylan DPC
48199e0e3f
Rollup merge of #96523 - nbdd0121:windows, r=petrochenkov
Add `@feat.00` symbol to symbols.o for COFF

Fix #96498

This is based on top of #96444.

r? ``@petrochenkov``
2022-04-29 11:23:16 +02:00
Dylan DPC
109008a1c1
Rollup merge of #96516 - oli-obk:impl_trait_inference_accidental_permitted, r=jackh726
Revert diagnostic duplication and accidental stabilization

fixes #96460

this is an accidental stabilization that we should put into the beta. I believe it is low-risk, because it was literally what we had before #94081

The effect on tests is massive, but mostly deduplication of diagnostics and some minor span changes.
2022-04-29 11:23:15 +02:00