Commit Graph

171030 Commits

Author SHA1 Message Date
Dylan DPC
ec8477fea1
Rollup merge of #98337 - c410-f3r:assert-compiler, r=oli-obk
[RFC 2011] Optimize non-consuming operators

Tracking issue: https://github.com/rust-lang/rust/issues/44838
Fifth step of https://github.com/rust-lang/rust/pull/96496

The most non-invasive approach that will probably have very little to no performance impact.

## Current behaviour

Captures are handled "on-the-fly", i.e., they are performed in the same place expressions are located.

```rust
// `let a = 1; let b = 2; assert!(a > 1 && b < 100);`

if !(
  { ***try capture `a` and then return `a`*** } > 1 && { ***try capture `b` and then return `b`*** } < 100
) {
  panic!( ... );
}
```

As such, some overhead is likely to occur (Specially with very large chains of conditions).

## New behaviour for non-consuming operators

When an operator is known to not take `self`, then it is possible to capture variables **AFTER** the condition.

```rust
// `let a = 1; let b = 2; assert!(a > 1 && b < 100);`

if !( a > 1 && b < 100 ) {
  { ***try capture `a`*** }
  { ***try capture `b`*** }
  panic!( ... );
}
```

So the possible impact on the runtime execution time will be diminished.

r? ````@oli-obk````
2022-06-28 15:30:02 +05:30
Dylan DPC
9b3dbb8200
Rollup merge of #98261 - WaffleLapkin:attempt_to_remove_max_suggestion_highlight_lines, r=flip1995
Remove `MAX_SUGGESTION_HIGHLIGHT_LINES`

After #97798 the `MAX_SUGGESTION_HIGHLIGHT_LINES` constant doesn't really make sense since we always show full suggestions. This PR removes last usages of the constant and the constant itself.

r? ``@flip1995`` (this mostly does changes in clippy)
2022-06-28 15:30:01 +05:30
Dylan DPC
c703d11dcc
Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, r=oli-obk
Remove a back-compat hack on lazy TAIT

This PR's motivation is here: https://github.com/rust-lang/rust/issues/72614#issuecomment-1134595446
~~But removing a hack doesn't seem to reject the code on the issue, there're some more hacks?~~
r? ``@oli-obk``
2022-06-28 15:30:00 +05:30
bors
64eb9ab869 Auto merge of #98324 - conradludgate:write-vectored-vec, r=Mark-Simulacrum
attempt to optimise vectored write

benchmarked:

old:
```
test io::cursor::tests::bench_write_vec                     ... bench:          68 ns/iter (+/- 2)
test io::cursor::tests::bench_write_vec_vectored            ... bench:         913 ns/iter (+/- 31)
```

new:
```
test io::cursor::tests::bench_write_vec                     ... bench:          64 ns/iter (+/- 0)
test io::cursor::tests::bench_write_vec_vectored            ... bench:         747 ns/iter (+/- 27)
```

More unsafe than I wanted (and less gains) in the end, but it still does the job
2022-06-28 06:25:19 +00:00
bors
5ffa8f67b7 Auto merge of #98222 - cjgillot:single-wf, r=michaelwoerister
Only keep a single query for well-formed checking

There are currently 3 queries to perform wf checks on different item-likes.  This complexity is not required.

This PR replaces the query by:
- one query per item;
- one query to invoke it for a whole module.

This allows to remove HIR `ParItemLikeVisitor`.
2022-06-28 03:44:33 +00:00
bors
7f08d04d60 Auto merge of #98591 - matthiaskrgr:rollup-7dok1wq, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #98331 (Fix rustdoc argument error)
 - #98506 (Fix span issues in object safety suggestions)
 - #98563 (interpret: refactor allocation info query)
 - #98576 (small regions refactoring)
 - #98577 (Fix "kind" for associated types in trait implementations in rustdoc JSON)
 - #98578 (Remove eddyb from miri failure pings)
 - #98579 (liballoc tests: avoid int2ptr cast)
 - #98581 (Add triagebot mentions.)
 - #98587 (libcore tests: avoid int2ptr casts)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-27 22:22:58 +00:00
Matthias Krüger
f266821d8f
Rollup merge of #98587 - RalfJung:core-tests, r=thomcc
libcore tests: avoid int2ptr casts

We don't need any of these pointers to actually be dereferenceable so using `ptr::invalid` should be fine. And then we can run Miri with strict provenance enforcement on the tests.
2022-06-27 22:35:14 +02:00
Matthias Krüger
19a05b56b1
Rollup merge of #98581 - ehuss:triagebot-mentions, r=Mark-Simulacrum
Add triagebot mentions.

This migrates the configuration of mentions from highfive to triagebot.

I also fixed a few broken paths (error_codes.rs src/librustdoc/html/static/themes src/librustdoc/html/static/themes/ayu.css).
2022-06-27 22:35:14 +02:00
Matthias Krüger
b52c362b8b
Rollup merge of #98579 - RalfJung:alloc-tests, r=thomcc
liballoc tests: avoid int2ptr cast

I think we don't need `ptr::from_exposed_addr` here; `ptr::invalid` should be enough for this test. (And this makes Miri less unhappy when running these tests.)
2022-06-27 22:35:13 +02:00
Matthias Krüger
9f667994fd
Rollup merge of #98578 - rust-lang:oli-obk-patch-1, r=eddyb
Remove eddyb from miri failure pings

r? `@eddyb`
2022-06-27 22:35:11 +02:00
Matthias Krüger
d0ae6ebe63
Rollup merge of #98577 - GuillaumeGomez:associated-items, r=notriddle
Fix "kind" for associated types in trait implementations in rustdoc JSON

Fixes https://github.com/rust-lang/rust/issues/81340.

Contrary to what is suggested in the issue, I really think we should distinguish between associated items and "normal" constants and types.

cc `@CraftSpider` `@SimonSapin`
r? `@notriddle`
2022-06-27 22:35:11 +02:00
Matthias Krüger
950934801e
Rollup merge of #98576 - lcnr:region-stuff-cool-beans, r=jackh726
small regions refactoring

these commits should be fairly self-contained

r? rust-lang/types
2022-06-27 22:35:09 +02:00
Matthias Krüger
4f61fe2122
Rollup merge of #98563 - RalfJung:interpret-alloc-check, r=oli-obk
interpret: refactor allocation info query

We now have an infallible function that also tells us which kind of allocation we are talking about.
Also we do longer have to distinguish between data and function allocations for liveness.

This will help us to avoid "catching" `InterpError`s in Miri.
r? `@oli-obk`
2022-06-27 22:35:08 +02:00
Matthias Krüger
6391f239c8
Rollup merge of #98506 - compiler-errors:object-safety-suggestions, r=oli-obk
Fix span issues in object safety suggestions

Fixes #98500
2022-06-27 22:35:07 +02:00
Matthias Krüger
38bfa9c4f8
Rollup merge of #98331 - GuillaumeGomez:rustdoc-arg-error, r=notriddle
Fix rustdoc argument error

Fixes #88756.

It's a take over of #88831. I cherry-picked the commits, fixed the merge conflict and the failing test.

cc `@inashivb` `@jyn514`

r? `@notriddle`
2022-06-27 22:35:06 +02:00
bors
2f3ddd9f59 Auto merge of #97307 - SparrowLii:parallel, r=cjgillot
catch unwind in parallel mode during wfcheck

Update #75760
When performing wfcheck, from the test results, the parallel mode will stop all checks when an `item`'s check failed, (e.g. the first ui test failure raised from [here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs#L249))while the serial mode will output each `item`'s check result via `catch_unwind`. This leads to inconsistencies in the final output of the two mode.
In my local environment, this modification prevents the following ui tests from failing when set `parallel-compiler = true` in `config.toml`:

```
    [ui] src/test\ui\associated-types\defaults-cyclic-fail-1.rs
    [ui] src/test\ui\associated-types\defaults-cyclic-fail-2.rs
    [ui] src/test\ui\associated-types\hr-associated-type-bound-2.rs
    [ui] src/test\ui\associated-types\impl-wf-cycle-1.rs
    [ui] src/test\ui\associated-types\impl-wf-cycle-2.rs
    [ui] src/test\ui\issues\issue-20413.rs
    [ui] src/test\ui\parallel_test\defaults-cyclic-fail-para.rs
```
2022-06-27 19:42:09 +00:00
Eric Huss
44e57155cb Add triagebot mentions. 2022-06-27 11:34:49 -07:00
Ralf Jung
8c977cfda8 libcore tests: avoid int2ptr casts 2022-06-27 13:30:44 -04:00
bors
8e52fa87eb Auto merge of #98566 - matthiaskrgr:rollup-43etyls, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #97389 (Improve memory ordering diagnostics)
 - #97780 (Check ADT field is well-formed before checking it is sized)
 - #98530 (compiletest: add issue number param to `known-bug`)
 - #98556 (Fix builds on Windows (closes #98546))
 - #98561 (Fix spelling in SAFETY comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-27 16:28:58 +00:00
Ralf Jung
8e73c3ed18 make AllocKind actually public 2022-06-27 10:58:30 -04:00
Ralf Jung
9b497abb9a liballoc tests: avoid int2ptr cast 2022-06-27 10:50:56 -04:00
Oli Scherer
dfb592a91d
Remove eddyb from miri failure pings 2022-06-27 16:08:19 +02:00
lcnr
28fafc45e6 lower-generic vs. outlive 2022-06-27 16:06:46 +02:00
Guillaume Gomez
9277f959dd Add test for associated items in rustdoc JSON 2022-06-27 16:01:13 +02:00
Guillaume Gomez
c1c0d25939 Fix kind for associated types in rustdoc JSON output for trait implementations 2022-06-27 16:01:13 +02:00
lcnr
70497d9d10 fold_region: remove unused parameter 2022-06-27 15:55:03 +02:00
lcnr
4dbf9ba0ab outside of borrowck, do not provide an implicit_region_bound
see comment added to the field in `VerifyBoundCx`.
2022-06-27 15:48:54 +02:00
Yuki Okushi
c24f06354a
Remove a back-compat hack on lazy TAIT 2022-06-27 20:43:44 +09:00
Guillaume Gomez
768129d4bd Finish rustdoc error improvement 2022-06-27 10:52:53 +02:00
Shivani Bhardwaj
70ced2502b Add test for help output with -W 2022-06-27 10:43:51 +02:00
Shivani Bhardwaj
ed62a09de1 Add test for default rustdoc run 2022-06-27 10:43:51 +02:00
Shivani Bhardwaj
e1b6f16fd4 Fix rustdoc argument error 2022-06-27 10:43:51 +02:00
SparrowLii
ec137f29c5 catch unwind of every iter in parallel mode during wfcheck 2022-06-27 16:39:10 +08:00
Matthias Krüger
54b81dd8d7
Rollup merge of #98561 - Wilfred:patch-4, r=fee1-dead
Fix spelling in SAFETY comment

"can not" should be "cannot", and add punctuation.
2022-06-27 08:06:49 +02:00
Matthias Krüger
31ec973b15
Rollup merge of #98556 - BlaCoiso:patch-1, r=jyn514
Fix builds on Windows (closes #98546)

closes https://github.com/rust-lang/rust/issues/98546
2022-06-27 08:06:48 +02:00
Matthias Krüger
13e4f87c4d
Rollup merge of #98530 - davidkna:known-bug-ref, r=Mark-Simulacrum
compiletest: add issue number param to `known-bug`

I was getting some errors while testing this, but I'm pretty sure that was unrelated to my changes.

Closes #98436

> Basically, instead of `// known-bug`, do `// known-bug #00000` or maybe `// known-bug chalk#00`?
>
> From: https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.2398095.3A.20NLL.3A.20unsound.20verification.20of.20higher.20ranked.20outlives.E2.80.A6/near/287258738

I also added an `unknown` escape-hatch because I didn't find corresponding issues for every `// known-bug`.

The syntax also ended up being `// known-bug: `, because of `set_name_value_directive`.
2022-06-27 08:06:47 +02:00
Matthias Krüger
43dd0e2424
Rollup merge of #97780 - compiler-errors:field-wfcheck-before-sized, r=jackh726
Check ADT field is well-formed before checking it is sized

Fixes #96810.

There is one diagnostics regression, in [`src/test/ui/generic-associated-types/bugs/issue-80626.stderr`](https://github.com/rust-lang/rust/pull/97780/files#diff-53795946378e78a0af23a10277c628ff79091c18090fdc385801ee70c1ba6963). I am not super concerned about it, since it's GAT related.
We _could_ fix it, possibly by using the `FieldSized` obligation cause code instead of `BuiltinDerivedObligation`. But that would require changing `Sized` trait confirmation and the `adt_sized_constraint` query.
2022-06-27 08:06:46 +02:00
Matthias Krüger
3694e40ffa
Rollup merge of #97389 - m-ou-se:memory-ordering-diagnostics, r=estebank
Improve memory ordering diagnostics

Before:

![image](https://user-images.githubusercontent.com/783247/170234545-891cac30-eaa2-4186-847b-35cd51e00f2b.png)

After:

![image](https://user-images.githubusercontent.com/783247/170239684-645f186f-5a02-4eb9-8651-2e5fe9591352.png)

---

Before this change, the compiler suggests the failure ordering is too strong and suggests choosing a weaker ordering. After this change, it instead suggests the success ordering is not strong enough, and suggests chosing a stronger one. This is more likely to be correct.

Also, before this change, the compiler suggested downgrading an invalid AcqRel failure ordering to Relaxed, without mentioning Acquire as an option.
2022-06-27 08:06:45 +02:00
bors
bd2e51a338 Auto merge of #98285 - nikic:update-llvm-5, r=cuviper
Rebase LLVM submodule

This is a rebase of our LLVM fork onto LLVM 14.0.5, which is intended to be the last release of the 14.x series. Additionally:

 * I've dropped three patches that were needed to build on FreeBSD 11, which is no longer necessary after #97944.
 * I've dropped some cherry-picks that were later reverted.
 * I've cherry-picked caa2a829cd for https://github.com/rust-lang/rust/issues/96797 (fyi `@Amanieu)`
2022-06-27 05:36:50 +00:00
bors
7702ae16a2 Auto merge of #98221 - cjgillot:single-coh, r=lcnr
Perform coherence checking per impl.

r? `@ghost`
2022-06-27 02:56:06 +00:00
Ralf Jung
b094116538 interpret: refactor allocation info query
We now have an infallible function that also tells us which kind of allocation we are talking about.
Also we do longer have to distinguish between data and function allocations for liveness.
2022-06-26 22:49:40 -04:00
Wilfred Hughes
1c1ae78db7
Fix spelling in SAFETY comment
"can not" should be "cannot", and add punctuation.
2022-06-26 19:17:34 -07:00
bors
221bdb62a2 Auto merge of #98212 - petrochenkov:addlinkargs, r=lqd
rustc_target: Add convenience functions for adding linker arguments

They ensure that lld and non-lld linker flavors get the same set of arguments.

The second commit also adds some tests checking for linker argument inconsistencies, and tweaks some arguments to fix those inconsistencies.
2022-06-27 00:27:40 +00:00
BlaCoiso
15abd82d70
Fix builds on Windows (closes #98546) 2022-06-26 23:27:44 +01:00
bors
3b0d4813ab Auto merge of #98187 - mystor:fast_span_call_site, r=eddyb
proc_macro/bridge: cache static spans in proc_macro's client thread-local state

This is the second part of https://github.com/rust-lang/rust/pull/86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. This patch removes the RPC calls required for the very common operations of `Span::call_site()`, `Span::def_site()` and `Span::mixed_site()`.

Some notes:

This part is one of the ones I don't love as a final solution from a design standpoint, because I don't like how the spans are serialized immediately at macro invocation. I think a more elegant solution might've been to reserve special IDs for `call_site`, `def_site`, and `mixed_site` at compile time (either starting at 1 or from `u32::MAX`) and making reading a Span handle automatically map these IDs to the relevant values, rather than doing extra serialization.

This would also have an advantage for potential future work to allow `proc_macro` to operate more independently from the compiler (e.g. to reduce the necessity of `proc-macro2`), as methods like `Span::call_site()` could be made to function without access to the compiler backend.

That was unfortunately tricky to do at the time, as this was the first part I wrote of the patches. After the later part (#98188, #98189), the other uses of `InternedStore` are removed meaning that a custom serialization strategy for `Span` is easier to implement.

If we want to go that path, we'll still need the majority of the work to split the bridge object and introduce the `Context` trait for free methods, and it will be easier to do after `Span` is the only user of `InternedStore` (after #98189).
2022-06-26 21:28:24 +00:00
David Knaack
93d3359d37 compiletest: add issue number param to known-bug 2022-06-26 23:15:47 +02:00
bors
c80c4b8fdc Auto merge of #98545 - matthiaskrgr:rollup-njely29, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #97140 (std: use an event-flag-based thread parker on SOLID)
 - #97295 ([rustc_parse] Forbid `let`s in certain places)
 - #97743 (make const_err show up in future breakage reports)
 - #97908 (Stabilize NonZero* checked operations constness.)
 - #98297 (Transform help popup into a pocket menu)
 - #98428 (macros: use typed identifiers in diag and subdiag derive)
 - #98528 (Respect --color when building rustbuild itself)
 - #98535 (Add regression test for generic const in rustdoc)
 - #98538 (Add a ui test for issue #91883)
 - #98540 (Add regression test for #87558)
 - #98541 (Update `std::alloc::System` doc example code style)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-26 19:02:00 +00:00
Matthias Krüger
935958e6e4
Rollup merge of #98541 - Veykril:patch-2, r=Dylan-DPC
Update `std::alloc::System` doc example code style

`return` on the last line of a block is unidiomatic so I don't think the example should be using that here
2022-06-26 19:47:09 +02:00
Matthias Krüger
93ea1ec153
Rollup merge of #98540 - TaKO8Ki:add-regression-test-for-87558, r=Mark-Simulacrum
Add regression test for #87558

Fixes #87558
2022-06-26 19:47:08 +02:00
Matthias Krüger
5efe7c7fc6
Rollup merge of #98538 - TaKO8Ki:add-test-for-issue-91883, r=Mark-Simulacrum
Add a ui test for issue #91883

closes #91883
2022-06-26 19:47:07 +02:00