Commit Graph

166255 Commits

Author SHA1 Message Date
Jakob Degen
1d318e42e7 Improve MIR phases documentation with summaries of changes 2022-04-11 15:22:32 -04:00
Jakob Degen
f2d7908ff7 Adjust MIR validator to check a few more things for terminators 2022-04-11 15:22:32 -04:00
Jakob Degen
f1f25c0f81 Improve documentation for MIR terminators 2022-04-11 15:22:32 -04:00
Jakob Degen
8e01cd6127 Improve documentation for MIR statement kinds. 2022-04-11 15:22:29 -04:00
Jakob Degen
9ac5e986ed Extend the MIR validator to check many more things around rvalues. 2022-04-11 15:18:54 -04:00
Jakob Degen
634369170a Add documentation for the semantics of MIR rvalues 2022-04-11 15:18:54 -04:00
Jakob Degen
2f4a7a0742 Adjust computation of place types to detect more invalid places 2022-04-11 15:18:53 -04:00
Jakob Degen
dae5c842fc Improve documentation of Place and Operand 2022-04-11 15:18:53 -04:00
bors
625e4dd13a Auto merge of #95125 - JakobDegen:uninit-variant-rvalue, r=oli-obk
Add new `Deinit` statement

This rvalue replaces `SetDiscriminant` for ADTs. This PR is an alternative to #94590 , which only specifies that the behavior of `SetDiscriminant` is the same as what this rvalue would do. The motivation for this change are discussed in that PR and [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/SetDiscriminant.20and.20aggregate.20initialization.20.2394590)

r? `@oli-obk`
2022-04-11 14:49:30 +00:00
Jakob Degen
2f03767eef Remove inlining cost of Deinit statements 2022-04-11 10:23:33 -04:00
Jakob Degen
48b01a0d0e Add new MutatatingUseContexts for deinit and SetDiscriminant 2022-04-11 09:26:26 -04:00
Jakob Degen
f7ca97a209 Add const eval tests ensuring padding gets correctly marked as deinit on deaggregation 2022-04-11 09:26:26 -04:00
Jakob Degen
2a040284a5 Fix tests broken by deaggregation change 2022-04-11 09:26:26 -04:00
Jakob Degen
fe796cd0f6 Bless tests that broke in a trivial way due to change in deaggregation 2022-04-11 09:26:26 -04:00
Jakob Degen
4cbe13adab Document semantics of Deinit and SetDiscriminant MIR statements 2022-04-11 08:55:03 -04:00
Jakob Degen
9b6b1a625b Add new Deinit statement kind 2022-04-11 08:55:03 -04:00
bors
43998d5441 Auto merge of #95931 - matthiaskrgr:rollup-1c5zhit, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #95743 (Update binary_search example to instead redirect to partition_point)
 - #95771 (Update linker-plugin-lto.md to 1.60)
 - #95861 (Note that CI tests Windows 10)
 - #95875 (bootstrap: show available paths help text for aliased subcommands)
 - #95876 (Add a note for unsatisfied `~const Drop` bounds)
 - #95907 (address fixme for diagnostic variable name)
 - #95917 (thin_box test: import from std, not alloc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-11 11:12:26 +00:00
Matthias Krüger
5b8e2ea520
Rollup merge of #95917 - RalfJung:thin-box-test, r=dtolnay
thin_box test: import from std, not alloc

Importing from `alloc` makes [Miri fail](https://github.com/rust-lang/miri-test-libstd/runs/5964922742?check_suite_focus=true), probably due to the hack that we used to resolve https://github.com/rust-lang/miri-test-libstd/issues/4. There might be better ways around this, but for now this is the easiest thing to do -- no other alloc integration test is importing from `alloc::`.
2022-04-11 12:06:58 +02:00
Matthias Krüger
053f70332f
Rollup merge of #95907 - compiler-errors:diag, r=Dylan-DPC
address fixme for diagnostic variable name

quick rename
2022-04-11 12:06:57 +02:00
Matthias Krüger
7ed15fb584
Rollup merge of #95876 - fee1-dead:note-const-drop, r=oli-obk
Add a note for unsatisfied `~const Drop` bounds

r? ``@oli-obk``
2022-04-11 12:06:56 +02:00
Matthias Krüger
69fb8f6349
Rollup merge of #95875 - aswild:pr/alias-cmd-paths, r=Mark-Simulacrum
bootstrap: show available paths help text for aliased subcommands

Running `./x.py build -h -v` shows a list of available build targets,
but the short alias `./x.py b -h -v` does not. Fix so that the aliases
behave the same as their spelled out counterparts.
2022-04-11 12:06:55 +02:00
Matthias Krüger
361a0ec3ab
Rollup merge of #95861 - ChrisDenton:windows7-support, r=Dylan-DPC
Note that CI tests Windows 10

Currently being [discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Windows.207).

r? `````@joshtriplett`````
2022-04-11 12:06:54 +02:00
Matthias Krüger
021738751a
Rollup merge of #95771 - str4d:update-linker-plugin-lto.md-to-1.60, r=pietroalbini
Update linker-plugin-lto.md to 1.60

I remembered this table when I was looking into what version of LLVM 1.60.0 was using 🙂
2022-04-11 12:06:53 +02:00
Matthias Krüger
e25bc303f1
Rollup merge of #95743 - yaahc:binary-search-clarification, r=Mark-Simulacrum
Update binary_search example to instead redirect to partition_point

Inspired by discussion in the tracking issue for `Result::into_ok_or_err`: https://github.com/rust-lang/rust/issues/82223#issuecomment-1067098167

People are surprised by us not providing a `Result<T, T> -> T` conversion, and the main culprit for this confusion seems to be the `binary_search` API. We should instead redirect people to the equivalent API that implicitly does that `Result<T, T> -> T` conversion internally which should obviate the need for the `into_ok_or_err` function and give us time to work towards a more general solution that applies to all enums rather than just `Result` such as making or_patterns usable for situations like this via postfix `match`.

I choose to duplicate the example rather than simply moving it from `binary_search` to partition point because most of the confusion seems to arise when people are looking at `binary_search`. It makes sense to me to have the example presented immediately rather than requiring people to click through to even realize there is an example. If I had to put it in only one place I'd leave it in `binary_search` and remove it from `partition_point` but it seems pretty obviously relevant to `partition_point` so I figured the best option would be to duplicate it.
2022-04-11 12:06:52 +02:00
bors
d00e77078c Auto merge of #95758 - compiler-errors:issue-54771, r=estebank
Only suggest removing semicolon when expression is compatible with `impl Trait`

https://github.com/rust-lang/rust/issues/54771#issuecomment-476423690
> It still needs checking that the last statement's expr can actually conform to the trait, but the naïve behavior is there.

Only suggest removing a semicolon when the type behind the semicolon actually implements the trait in an RPIT `-> impl Trait`. Also upgrade the label that suggests removing the semicolon to a suggestion (should it be verbose?).

cc #54771
2022-04-11 08:31:37 +00:00
bors
48a9e104df Auto merge of #95754 - compiler-errors:binder-assoc-ty, r=nagisa
Better error for `for<...>` on associated type bound

With GATs just around the corner, we'll probably see more people trying out `Trait<for<'a> Assoc<'a> = ..>`.

This PR improves the syntax error slightly, and also makes it slightly easier to make this into real syntax in the future.

Feel free to push back if the reviewer thinks this should have a suggestion on how to fix it (i.e. push the `for<'a>` outside of the angle brackets), but that can also be handled in a follow-up PR.
2022-04-11 05:16:48 +00:00
Ralf Jung
dbc0afa215 thin_box test: import from std, not alloc 2022-04-10 22:59:51 -04:00
Deadbeef
7f54d68f26
Add a note for unsatisfied ~const Drop bounds 2022-04-11 12:00:39 +10:00
bors
d12b857816 Auto merge of #94243 - compiler-errors:compiler-flags-typo, r=Mark-Simulacrum
`s/compiler-flags/compile-flags` in compiletest

Also make compiletest panic so this doesn't happen in the future! I literally always forget which it's called, so I wanted to make my life easier in the future.

Also open to the possibility of parsing both.
2022-04-11 00:58:22 +00:00
Michael Goulet
b65265b5e1 better error for binder on associated type bound 2022-04-10 16:41:15 -07:00
Michael Goulet
dfe13dbbcf only suggest removing semicolon when expr implements trait 2022-04-10 16:30:14 -07:00
bors
1f7fb6413d Auto merge of #95889 - Dylan-DPC:rollup-1cmywu4, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #95566 (Avoid duplication of doc comments in `std::char` constants and functions)
 - #95784 (Suggest replacing `typeof(...)` with an actual type)
 - #95807 (Suggest adding a local for vector to fix borrowck errors)
 - #95849 (Check for git submodules in non-git source tree.)
 - #95852 (Fix missing space in lossy provenance cast lint)
 - #95857 (Allow multiple derefs to be splitted in deref_separator)
 - #95868 (rustdoc: Reduce allocations in a `html::markdown` function)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-10 21:01:13 +00:00
Dylan DPC
fcfecab2d8
Rollup merge of #95868 - vacuus:markdown-code-blocks, r=GuillaumeGomez
rustdoc: Reduce allocations in a `html::markdown` function
2022-04-10 21:03:39 +02:00
Dylan DPC
78fc931355
Rollup merge of #95857 - ouz-a:mir-opt, r=oli-obk
Allow multiple derefs to be splitted in deref_separator

Previously in #95649 only a single deref within projection was supported and multiple derefs caused a bunch of issues, this PR fixes those issues.

```@oli-obk``` helped a ton again ❤️
2022-04-10 21:03:38 +02:00
Dylan DPC
a52eb325e6
Rollup merge of #95852 - niluxv:strict-provenance-lint-fixup, r=Dylan-DPC
Fix missing space in lossy provenance cast lint

See https://github.com/rust-lang/rust/pull/95599#discussion_r846425050
2022-04-10 21:03:37 +02:00
Dylan DPC
0b871435e9
Rollup merge of #95849 - ehuss:check-submodules, r=Mark-Simulacrum
Check for git submodules in non-git source tree.

People occasionally download the source from https://github.com/rust-lang/rust/releases, but those source distributions will not work because they are missing the submodules. They will get a confusing `failed to load manifest for workspace member` error.

Unfortunately AFAIK there is no way to disable the GitHub source links. This change tries to detect this scenario and provide an error message that guides them toward a solution.

Closes #95608
2022-04-10 21:03:36 +02:00
Dylan DPC
c172544848
Rollup merge of #95807 - TaKO8Ki:suggest-local-var-for-vector, r=fee1-dead
Suggest adding a local for vector to fix borrowck errors

closes #95574
2022-04-10 21:03:35 +02:00
Dylan DPC
54597ba11f
Rollup merge of #95784 - WaffleLapkin:typeof_cool_suggestion, r=compiler-errors
Suggest replacing `typeof(...)` with an actual type

This PR adds suggestion to replace `typeof(...)` with an actual type of `...`, for example in case of `typeof(1)` we suggest replacing it with `i32`.

If the expression
1. Is not const (`{ let a = 1; let _: typeof(a); }`)
2. Can't be found (`let _: typeof(this_variable_does_not_exist)`)
3. Or has non-suggestable type (closure, generator, error, etc)
we don't suggest anything.

The 1 one is sad, but it's not clear how to support non-consts expressions for `typeof`.

_This PR is inspired by [this tweet]._

[this tweet]: https://twitter.com/compiler_errors/status/1511945354752638976
2022-04-10 21:03:34 +02:00
Dylan DPC
c0655dec7e
Rollup merge of #95566 - eduardosm:std_char_consts_and_methods, r=Mark-Simulacrum
Avoid duplication of doc comments in `std::char` constants and functions

For those consts and functions, only the summary is kept and a reference to the `char` associated const/method is included.

Additionaly, re-exported functions have been converted to function definitions that call the previously re-exported function. This makes it easier to add a deprecated attribute to these functions in the future.
2022-04-10 21:03:34 +02:00
Michael Goulet
137c207d20 FIXME for diagnostic variable name 2022-04-10 11:11:25 -07:00
bors
027a232755 Auto merge of #95487 - cjgillot:menhir, r=oli-obk
Avoid accessing HIR from MIR passes

`hir_owner_nodes` contains a lot of information, and the query result is typically dirty. This forces dependent queries to be re-executed needlessly.

This PR refactors some accesses to HIR to go through more targeted queries that yield the same result.

Based on https://github.com/rust-lang/rust/pull/95435 and https://github.com/rust-lang/rust/pull/95436
2022-04-10 17:59:27 +00:00
bors
18f32b73bd Auto merge of #95848 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/95844
r? `@ghost`
2022-04-10 14:51:30 +00:00
Maybe Waffle
8412d5dc5c --bless tests 2022-04-10 16:45:09 +04:00
bors
32c2630262 Auto merge of #95253 - jyn514:cargo-run, r=Mark-Simulacrum
Make it possible to run `cargo test` for bootstrap

Note that this only runs bootstrap's self-tests, not compiler or library tests.

Helps with https://github.com/rust-lang/rust/issues/94829.
2022-04-10 12:30:26 +00:00
Camille GILLOT
bbacfcb6c4 Avoid checking HIR in variances_of. 2022-04-10 13:58:29 +02:00
Camille GILLOT
0c6e2466f2 Do not access HIR to compute symbol_name. 2022-04-10 13:42:47 +02:00
Camille GILLOT
69d8183337 Store LocalDefId in is_late_bound_map.
This allows to avoid looking at HIR from borrowck.
2022-04-10 13:36:06 +02:00
Camille GILLOT
db03a2deb0 Avoid accessing HIR from MIR queries. 2022-04-10 13:08:36 +02:00
bors
7af93292c2 Auto merge of #95621 - saethlin:remove-mpsc-transmute, r=RalfJung
Remove ptr-int transmute in std::sync::mpsc

Since https://github.com/rust-lang/rust/pull/95340 landed, Miri with `-Zmiri-check-number-validity` produces an error on the test suites of some crates which implement concurrency tools<sup>*</sup>, because it seems like such crates tend to use `std::sync::mpsc` in their tests. This fixes the problem by storing pointer bytes in a pointer.

<sup>*</sup> I have so far seen errors in the test suites of `once_cell`, `parking_lot`, and `crossbeam-utils`.
(just updating the list for fun, idk)
Also `threadpool`, `async-lock`, `futures-timer`, `fragile`, `scoped_threadpool`, `procfs`, `slog-async`, `scheduled-thread-pool`, `tokio-threadpool`, `mac`, `futures-cpupool`, `ntest`, `actix`, `zbus`, `jsonrpc-client-transports`, `fail`, `libp2p-gossipsub`, `parity-send-wrapper`, `async-broadcast,` `libp2p-relay`, `http-client`, `mockito`, `simple-mutex`, `surf`, `pollster`, and `pulse`. Then I turned the bot off.
2022-04-10 08:57:32 +00:00
Allen Wild
e4bbbacb8c bootstrap: show available paths help text for aliased subcommands
Running `./x.py build -h -v` shows a list of available build targets,
but the short alias `./x.py b -h -v` does not. Fix so that the aliases
behave the same as their spelled out counterparts.
2022-04-10 03:17:05 -04:00