Commit graph

169015 commits

Author SHA1 Message Date
klensy 678059f7d0 fix simple clippy lints 2022-05-24 12:24:41 -04:00
bors fa70b89d19 Auto merge of #97356 - Dylan-DPC:rollup-bhceawj, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #97288 (Lifetime variance fixes for rustdoc)
 - #97298 (Parse expression after `else` as a condition if followed by `{`)
 - #97308 (Stabilize `cell_filter_map`)
 - #97321 (explain how to turn integers into fn ptrs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-24 16:23:32 +00:00
David Wood ce9901fcee typeck: use typed fluent identifiers for diags
Use new typed Fluent identifiers for the "missing type parameters"
diagnostic in the typeck crate which was manually creating
`DiagnosticMessage`s previously.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-24 16:48:17 +01:00
David Wood 552eb3295a macros: introduce fluent_messages macro
Adds a new `fluent_messages` macro which performs compile-time
validation of the compiler's Fluent resources (i.e. that the resources
parse and don't multiply define the same messages) and generates
constants that make using those messages in diagnostics more ergonomic.

For example, given the following invocation of the macro..

```ignore (rust)
fluent_messages! {
    typeck => "./typeck.ftl",
}
```
..where `typeck.ftl` has the following contents..

```fluent
typeck-field-multiply-specified-in-initializer =
    field `{$ident}` specified more than once
    .label = used more than once
    .label-previous-use = first use of `{$ident}`
```
...then the macro parse the Fluent resource, emitting a diagnostic if it
fails to do so, and will generate the following code:

```ignore (rust)
pub static DEFAULT_LOCALE_RESOURCES: &'static [&'static str] = &[
    include_str!("./typeck.ftl"),
];

mod fluent_generated {
    mod typeck {
        pub const field_multiply_specified_in_initializer: DiagnosticMessage =
            DiagnosticMessage::fluent("typeck-field-multiply-specified-in-initializer");
        pub const field_multiply_specified_in_initializer_label_previous_use: DiagnosticMessage =
            DiagnosticMessage::fluent_attr(
                "typeck-field-multiply-specified-in-initializer",
                "previous-use-label"
            );
    }
}
```

When emitting a diagnostic, the generated constants can be used as
follows:

```ignore (rust)
let mut err = sess.struct_span_err(
    span,
    fluent::typeck::field_multiply_specified_in_initializer
);
err.span_default_label(span);
err.span_label(
    previous_use_span,
    fluent::typeck::field_multiply_specified_in_initializer_label_previous_use
);
err.emit();
```

Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-24 16:48:17 +01:00
David Wood 6e85efda22 macros: change code block language
With `ignore (rust)` rather than `ignore (pseudo-Rust)` my editor
highlights the code in the block, which is nicer.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-24 16:48:17 +01:00
Oli Scherer 0fdaaadb36 Remove the check_mod_intrinsics query 2022-05-24 15:46:23 +00:00
Ralf Jung 9808073674 update Miri 2022-05-24 17:44:11 +02:00
Oli Scherer cb886cc164 move intrinsicck to typeck 2022-05-24 15:37:33 +00:00
Oli Scherer 31e0bf7891 trait selection errors should poison the typeck results, too, so that const eval can avoid running at all 2022-05-24 15:37:33 +00:00
est31 2a8b60f915 Emit weird lint name lints after expansion
Previously, we were emitting weird name lints (for renamed or unknown lints)
before expansion, most importantly before cfg expansion.
This meant that the weird name lints would not fire
for lint attributes hidden inside cfg_attr. The same applied
for lint level specifications of those lints.

By moving the lints for the lint names to the post-expansion
phase, these issues are resolved.
2022-05-24 17:27:34 +02:00
Guillaume Gomez 00a380c235 Update minifier-rs version to 0.1.0 2022-05-24 16:55:29 +02:00
Dylan DPC 4bd40186db
Rollup merge of #97321 - RalfJung:int-to-fnptr, r=Dylan-DPC
explain how to turn integers into fn ptrs

(with an intermediate raw ptr, not a direct transmute)
Direct int2ptr transmute, under the semantics I am imagining, will produce a ptr with "invalid" provenance that is invalid to deref or call. We cannot give it the same semantics as int2ptr casts since those do [something complicated](https://www.ralfj.de/blog/2022/04/11/provenance-exposed.html).

To my great surprise, that is already what the example in the `transmute` docs does. :)  I still added a comment to say that that part is important, and I added a section explicitly talking about this to the `fn()` type docs.

With https://github.com/rust-lang/miri/pull/2151, Miri will start complaining about direct int-to-fnptr transmutes (in the sense that it is UB to call the resulting pointer).
2022-05-24 15:58:26 +02:00
Dylan DPC af15e45e28
Rollup merge of #97308 - JohnTitor:stabilize-cell-filter-map, r=Mark-Simulacrum
Stabilize `cell_filter_map`

FCP has been completed: https://github.com/rust-lang/rust/issues/81061#issuecomment-1081806326
Closes #81061
2022-05-24 15:58:25 +02:00
Dylan DPC 0531521dbb
Rollup merge of #97298 - compiler-errors:if-else-stmt-braces, r=davidtwco
Parse expression after `else` as a condition if followed by `{`

Fixes #49361.

Two things:
1. This wording needs help. I can never find a natural/intuitive phrasing when I write diagnostics 😅
2. Do we even want to show the "wrap in braces" case? I would assume most of the time the "add an `if`" case is the right one.
2022-05-24 15:58:24 +02:00
Dylan DPC 3569a426b5
Rollup merge of #97288 - compiler-errors:tcxify-rustdoc, r=Dylan-DPC
Lifetime variance fixes for rustdoc

#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from #97287 so the rustdoc team can review independently.
2022-05-24 15:58:24 +02:00
Guillaume Gomez 6920361959 Remove unused brush image 2022-05-24 15:55:01 +02:00
Guillaume Gomez d4d1e23c69 Allow to pass more arguments to tester.js 2022-05-24 15:42:37 +02:00
bors ee9726cb10 Auto merge of #97291 - compiler-errors:lazy-is-actually-3-types-in-a-trenchcoat, r=cjgillot
Split out the various responsibilities of `rustc_metadata::Lazy`

`Lazy<T>` actually acts like three different types -- a pointer in the crate metadata to a single value, a pointer to a list/array of values, and an indexable pointer of a list of values (a table).

We currently overload `Lazy<T>` to work differently than `Lazy<[T]>` and the same for `Lazy<Table<I, T>>`. All is well with some helper adapter traits such as [`LazyQueryDecodable`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/trait.LazyQueryDecodable.html) and [`EncodeContentsForLazy`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/encoder/trait.EncodeContentsForLazy.html).

Well, changes in #97287 that make `Lazy` work with the now invariant lifetime `'tcx` make these adapters fall apart because of coherence reasons. So we split out these three types and rework some of the helper traits so it's both 1. more clear to understand, and 2. compatible with the changes later in that PR.

Split out from #97287 so it can be reviewed separately, since this PR stands on its own.
2022-05-24 13:42:33 +00:00
Guillaume Gomez b7838e9b1d Update browser-ui-test version to 0.9.5 2022-05-24 15:42:33 +02:00
Guillaume Gomez f4f14f6671 Update browser-ui-test version to 0.9.5 2022-05-24 15:41:24 +02:00
Guillaume Gomez cee58cb6b9 Allow to pass more arguments to tester.js 2022-05-24 15:40:50 +02:00
Guillaume Gomez fca1007ed3 Add GUI test for click on setting text 2022-05-24 15:40:50 +02:00
Guillaume Gomez 1ebf0d9c72 Allow to click on toggle text to update it 2022-05-24 15:40:50 +02:00
5225225 dd9f31d000 Add flag for stricter checks on uninit/zeroed 2022-05-24 14:26:52 +01:00
Loïc BRANSTETT b9ae3db4ac RFC3239: Add tests for compact cfg(target(..)) 2022-05-24 13:51:36 +02:00
Loïc BRANSTETT 8345571cd0 RFC3239: Implement compact cfg(target(..)) 2022-05-24 13:51:36 +02:00
Loïc BRANSTETT ae38533ed7 Clean up condition evaluation system 2022-05-24 13:43:08 +02:00
b-naber 86e8bbe4fd add and update tests 2022-05-24 13:01:34 +02:00
b-naber e2e425e8d2 give correct error message on structural match violation 2022-05-24 13:01:34 +02:00
bors b2eba058e6 Auto merge of #97121 - pvdrz:do-subdiagnostics-later, r=davidtwco
Avoid double binding of subdiagnostics inside `#[derive(SessionDiagnostic)]`

r? `@davidtwco`
2022-05-24 10:25:13 +00:00
bors 43d9f3859e Auto merge of #96098 - JakobDegen:always-return-place, r=oli-obk
Refactor call terminator to always include destination place

In #71117 people seemed to agree that call terminators should always have a destination place, even if the call was guaranteed to diverge. This implements that. Unsurprisingly, the diff touches a lot of code, but thankfully I had to do almost nothing interesting. The only interesting thing came up in const prop, where the stack frame having no return place was also used to indicate that the layout could not be computed (or similar). I replaced this with a ZST allocation, which should continue to do the right things.

cc `@RalfJung` `@eddyb` who were involved in the original conversation

r? rust-lang/mir-opt
2022-05-24 07:13:26 +00:00
kadmin ee8efc5c4a Coalesce branches
Move a bunch of branches together into one if block, for easier reading.

Resolve comments

Attempt to make some branches unreachable [tmp]

Revert unreachable branches
2022-05-24 05:33:34 +00:00
bors acb5c16fa8 Auto merge of #97342 - JohnTitor:rollup-zqxctaw, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #97240 (Typo suggestion for a variable with a name similar to struct fields)
 - #97289 (Lifetime variance fixes for clippy)
 - #97290 (Turn on `fast_submodules` unconditionally)
 - #97336 (typo)
 - #97337 (Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-24 04:32:42 +00:00
Michael Goulet 9be37b2d3f Parse expression after else as a condition if followed by { 2022-05-23 21:09:35 -07:00
Yuki Okushi a1cbf66ee4
Rollup merge of #97337 - tbu-:pr_fix_stabilization_ipv4_mapped, r=Mark-Simulacrum
Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`
2022-05-24 12:18:34 +09:00
Yuki Okushi 1b59db45d4
Rollup merge of #97336 - tshepang:typo, r=cjgillot
typo
2022-05-24 12:18:33 +09:00
Yuki Okushi 9845a41233
Rollup merge of #97290 - jyn514:fast-submodules, r=Mark-Simulacrum
Turn on `fast_submodules` unconditionally

I don't know why anyone would turn this off; doing so makes builds much slower (nearly a 60x slowdown according to #49057).
Remove the option to do so, which makes bootstrap a little easier to maintain.

Bootstrap continues to allow you to manage submodules manually by setting `submodules = false`.
2022-05-24 12:18:32 +09:00
Yuki Okushi 3157e1f4bd
Rollup merge of #97289 - compiler-errors:tcxify-clippy, r=Mark-Simulacrum
Lifetime variance fixes for clippy

#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be shortened to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from #97287 so the clippy team can review independently.
2022-05-24 12:18:31 +09:00
Yuki Okushi 8d9f258faa
Rollup merge of #97240 - TaKO8Ki:improve-errors-about-typos-on-variables, r=compiler-errors
Typo suggestion for a variable with a name similar to struct fields

closes #97133
2022-05-24 12:18:30 +09:00
Michael Goulet 2b5e592b7a Fix iterator implementation, add some inlines 2022-05-23 19:50:29 -07:00
Michael Goulet 14e5816f1b refine comments, disambiguate len for array and tables 2022-05-23 19:39:10 -07:00
Michael Goulet ca5e60b7fb split out the various responsibilities of Lazy 2022-05-23 19:39:10 -07:00
Joshua Nelson 5df276eef5 Turn on fast_submodules unconditionally
I don't know why anyone would turn this off; doing so makes builds much slower (nearly a 60x slowdown according to #49057).
Remove the option to do so, which makes bootstrap a little easier to maintain.

Bootstrap continues to allow you to manage submodules manually by setting `submodules = false`.
2022-05-23 21:17:09 -05:00
bors b8d0cd8de0 Auto merge of #97272 - jackh726:ban-compare-mode-nll, r=Mark-Simulacrum
Disallow compare-mode=nll test differences

This ensures that new tests don't get added not as revisions if they have nll output. This will make stabilization PR easier.

r? `@Mark-Simulacrum`
2022-05-24 01:52:00 +00:00
Tobias Bucher 328c84327b Fix stabilization version of Ipv6Addr::to_ipv4_mapped 2022-05-24 01:05:06 +02:00
Jakob Degen 09b0936db2 Refactor call terminator to always hold a destination place 2022-05-23 17:49:04 -04:00
Tshepang Lekhonkhobe b96e5c6463 typo 2022-05-23 22:51:34 +02:00
bors ee160f2f5e Auto merge of #97120 - Kobzol:rustc-pgo-expansion, r=Mark-Simulacrum
Update `rustc` PGO benchmark list

I noticed that the `rustc` PGO crates do not contain any crate that would stress the trait system. I tried adding and removing various crates to the PGO benchmark list here. Here's what I found:

- Removing [`externs` and `match-stress`](https://perf.rust-lang.org/compare.html?start=c0672870491e84362f76ddecd50fa229f9b06dff&end=b056963e0324fa76c721d79f12658a64cfa4cb5e&stat=instructions:u) regresses these two benchmarks by up to 15 % and removing them doesn't improve anything else, so we should keep them.
- Adding [`keccak`](https://perf.rust-lang.org/compare.html?start=52cc7795245347500ddf6dc959cf58a7abe2d935&end=6fd27b23fd7860c79752479173b4a1b877cba490) regresses `diesel`, otherwise it doesn't do much.
- Adding [`tt-muncher`](https://perf.rust-lang.org/compare.html?start=c0672870491e84362f76ddecd50fa229f9b06dff&end=2ab5994d9cdfb098344895f7d8d5aee3cf3d6eff&stat=instructions:u) improves it very slightly, not worth it to include it IMO.
- Adding just [`diesel`](https://perf.rust-lang.org/compare.html?start=00755e4ca68f12ed200e921276788ab19975e85f&end=cd37706ad459ee8ddfda4631be71120cb7eda19d) improves it by up to 1.5 % and others crate slightly, but regresses `bitmaps`.
- Adding [`bitmaps`](https://perf.rust-lang.org/compare.html?start=67a9bcb31b85e87cc8bb327022632e48a0ca64a8&end=0cd80ba74425e6614cd52c4ea2bf6b0191c6dbc4&stat=instructions:u) improves both it and diesel, no other regressions.
- Adding [both](https://perf.rust-lang.org/compare.html?start=77972d2d0134fb597249b3b64dcf9510a790c34e&end=f968d7af511d750db96cfdc04f844fb017c079ce) `bitmaps` and `diesel` produces quite nice improvements and almost no regressions.
- Adding [ucd](https://perf.rust-lang.org/compare.html?start=b5caa5a8421f84cb7664f999b7635801bcf3f96a&end=327cc09917311f65cf427e6c0bf5f7424af9fd05&stat=instructions:u) did not have a large effect on primary benchmarks.

r? `@lqd`
2022-05-23 20:50:23 +00:00
bors 222c5724ec Auto merge of #94053 - GuillaumeGomez:fields-stripped, r=notriddle
rustdoc: Remove fields_stripped fields (and equivalents)

Fixes #90588.

r? `@camelid`
2022-05-23 18:26:42 +00:00
Vadim Petrochenkov c82a3706f7 rustc: Fix ICE in native library error reporting 2022-05-23 20:56:38 +03:00