Commit Graph

211502 Commits

Author SHA1 Message Date
Ralf Jung
166e60e2bb update lockfile 2022-11-26 14:16:45 +01:00
bors
7d0db1efdb Auto merge of #2647 - saethlin:current-span, r=RalfJung
Track local frames incrementally during execution

https://github.com/rust-lang/miri/pull/2646 currently introduces a performance regression. This change removes that regression, and provides a minor perf improvement.

The existing lazy strategy for tracking the span we want to display is as efficient as it is only because we often create a `CurrentSpan` then never call `.get()`. Most of the calls to the `before_memory_read` and `before_memory_write` hooks do not create any event that we store in `AllocHistory`. But data races are totally different, any memory read or write may race, so every call to those hooks needs to access to the current local span.

So this changes to a strategy where we update some state in a `Thread` and `FrameExtra` incrementally, upon entering and existing each function call.

Before:
```
Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/backtraces/Cargo.toml
  Time (mean ± σ):      5.532 s ±  0.022 s    [User: 5.444 s, System: 0.073 s]
  Range (min … max):    5.516 s …  5.569 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/mse/Cargo.toml
  Time (mean ± σ):     831.4 ms ±   3.0 ms    [User: 783.8 ms, System: 46.7 ms]
  Range (min … max):   828.7 ms … 836.1 ms    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/serde1/Cargo.toml
  Time (mean ± σ):      1.975 s ±  0.021 s    [User: 1.914 s, System: 0.059 s]
  Range (min … max):    1.939 s …  1.990 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/serde2/Cargo.toml
  Time (mean ± σ):      4.060 s ±  0.051 s    [User: 3.983 s, System: 0.071 s]
  Range (min … max):    3.972 s …  4.100 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/slice-get-unchecked/Cargo.toml
  Time (mean ± σ):     784.9 ms ±   8.2 ms    [User: 746.5 ms, System: 37.7 ms]
  Range (min … max):   772.9 ms … 793.3 ms    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/unicode/Cargo.toml
  Time (mean ± σ):      1.679 s ±  0.006 s    [User: 1.623 s, System: 0.055 s]
  Range (min … max):    1.673 s …  1.687 s    5 runs
```
After:
```
Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/backtraces/Cargo.toml
  Time (mean ± σ):      5.330 s ±  0.037 s    [User: 5.232 s, System: 0.084 s]
  Range (min … max):    5.280 s …  5.383 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/mse/Cargo.toml
  Time (mean ± σ):     818.9 ms ±   3.7 ms    [User: 776.8 ms, System: 41.3 ms]
  Range (min … max):   813.5 ms … 822.5 ms    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/serde1/Cargo.toml
  Time (mean ± σ):      1.927 s ±  0.011 s    [User: 1.864 s, System: 0.061 s]
  Range (min … max):    1.917 s …  1.945 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/serde2/Cargo.toml
  Time (mean ± σ):      3.974 s ±  0.020 s    [User: 3.893 s, System: 0.076 s]
  Range (min … max):    3.956 s …  4.004 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/slice-get-unchecked/Cargo.toml
  Time (mean ± σ):     780.0 ms ±   5.3 ms    [User: 740.3 ms, System: 39.0 ms]
  Range (min … max):   771.2 ms … 784.5 ms    5 runs

Benchmark 1: cargo +miri miri run --manifest-path /home/ben/miri/bench-cargo-miri/unicode/Cargo.toml
  Time (mean ± σ):      1.643 s ±  0.007 s    [User: 1.584 s, System: 0.058 s]
  Range (min … max):    1.635 s …  1.654 s    5 runs
```
(This change is marginal, but the point is that it avoids a much more significant regression)
2022-11-26 13:02:15 +00:00
Ralf Jung
726b9d09d4 caller_span only makes sense when there are 2 frames on the stack 2022-11-26 14:01:26 +01:00
bors
579c993b35 Auto merge of #104935 - matthiaskrgr:rollup-nuca86l, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #104121 (Refine `instruction_set` MIR inline rules)
 - #104675 (Unsupported query error now specifies if its unsupported for local or external crate)
 - #104839 (improve array_from_fn documenation)
 - #104880 ([llvm-wrapper] adapt for LLVM API change)
 - #104899 (rustdoc: remove no-op CSS `#help dt { display: block }`)
 - #104906 (Remove AscribeUserTypeCx)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-26 12:11:32 +00:00
Chris Denton
2ab3f76442
Remove more redundant alls 2022-11-26 09:54:54 +00:00
Matthias Krüger
1fe18a5dad
Rollup merge of #104906 - spastorino:remove-ascribeusertypecx, r=compiler-errors
Remove AscribeUserTypeCx

r? ``@compiler-errors``

This basically inlines `AscribeUserTypeCx::relate_mir_and_user_ty` into `type_op_ascribe_user_type_with_span` which is the only place where it's used and makes direct use of `ObligationCtxt` API.
2022-11-26 10:39:12 +01:00
Matthias Krüger
8586544855
Rollup merge of #104899 - notriddle:notriddle/help-dt, r=GuillaumeGomez
rustdoc: remove no-op CSS `#help dt { display: block }`

`display: block` is the [default UA style] for dt.

[default UA style]: https://html.spec.whatwg.org/multipage/rendering.html#lists
2022-11-26 10:39:12 +01:00
Matthias Krüger
0f28e403d4
Rollup merge of #104880 - krasimirgg:llvm-16-ctx, r=cuviper
[llvm-wrapper] adapt for LLVM API change

Adapt for the LLVM API changes from 721f975d35.

Found via our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15203#0184ae73-5169-4b9b-92f4-d4e6e9b86ad9/194-531
2022-11-26 10:39:11 +01:00
Matthias Krüger
1fc83aee1e
Rollup merge of #104839 - HintringerFabian:docs_array_from_fn, r=scottmcm
improve array_from_fn documenation

Improves array::from_fn documentation
Fixes #102609

There were also unresolved comments from [this PR #100462](https://github.com/rust-lang/rust/pull/100462), which have been added to my PR
2022-11-26 10:39:11 +01:00
Matthias Krüger
42010a23f5
Rollup merge of #104675 - SarthakSingh31:issue-101666, r=jyn514
Unsupported query error now specifies if its unsupported for local or external crate

Fixes #101666.
I had to move `keys.rs` from `rustc_query_impl` to `rustc_middle`. I don't know if that is problematic. I couldn't think of any other way to get the needed information inside `rustc_middle`.

r? ```@jyn514```
2022-11-26 10:39:10 +01:00
Matthias Krüger
4733312e09
Rollup merge of #104121 - Lokathor:mir-opt-when-instruction-set-missing-on-callee, r=tmiasko
Refine `instruction_set` MIR inline rules

Previously an exact match of the `instruction_set` attribute was required for an MIR inline to be considered. This change checks for an exact match *only* if the callee sets an `instruction_set` in the first place. When the callee does not declare an instruction set then it is considered to be platform agnostic code and it's allowed to be inline'd into the caller.

cc ``@oli-obk``

[Edit] Zulip Context: https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/What.20exactly.20does.20the.20MIR.20optimizer.20do.3F
2022-11-26 10:39:10 +01:00
Chris Denton
c256bd2908
Remove redundant all in cfg 2022-11-26 09:31:40 +00:00
bors
8841bee954 Auto merge of #103556 - clubby789:specialize-option-partial-eq, r=scottmcm
Manually implement PartialEq for Option<T> and specialize non-nullable types

This PR manually implements `PartialEq` and `StructuralPartialEq` for `Option`, which seems to produce slightly better codegen than the automatically derived implementation.

It also allows specializing on the `core::num::NonZero*` and `core::ptr::NonNull` types, taking advantage of the niche optimization by transmuting the `Option<T>` to `T` to be compared directly, which can be done in just two instructions.

A comparison of the original, new and specialized code generation is available [here](https://godbolt.org/z/dE4jxdYsa).
2022-11-26 08:56:20 +00:00
bors
f8a2e491eb Auto merge of #104730 - petrochenkov:modchild5, r=cjgillot
rustc_metadata: Switch module children decoding to an iterator

Previously https://github.com/rust-lang/rust/pull/103578, https://github.com/rust-lang/rust/pull/103524 and previous PRs simplified it as much as possible.

A couple of cleanup commits is also added.
r? `@cjgillot`
2022-11-26 05:41:34 +00:00
Michael Goulet
6210812494 Do not record unresolved const vars in generator interior 2022-11-26 05:38:43 +00:00
Michael Goulet
1472b38039 Remove unnecessary binder from get_impl_future_output_ty 2022-11-26 05:22:52 +00:00
Michael Goulet
61e185b5d0 simplify some binder shifting logic 2022-11-26 05:11:06 +00:00
Michael Howell
8b001b4da0 rustdoc: use flexbox CSS to align sidebar button instead of position
This accomplishes the same thing with significantly less code.
2022-11-25 22:06:22 -07:00
bors
5fa44b5464 Auto merge of #104431 - alistair23:alistair/rv64-profiler, r=Mark-Simulacrum
Enable profiler in dist-riscv64-linux

Build the profiler runtime to allow using -C profile-generate and -C instrument-coverage on riscv64-linux.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2022-11-26 02:43:08 +00:00
Nixon Enraght-Moony
b1cdb05003 jsondoclint: Accept trait alias is places where trait expected.
Closes #104923
2022-11-26 01:41:30 +00:00
Michael Goulet
1dc88ffb3f
Allow non-org members to label requires-debug-assertions
jruderman tried to add this in #104916, for example. I think I've seen this happen before as well.
2022-11-25 16:06:52 -08:00
Markus Everling
f6f25983c6 Don't use Take in SpecExtend impl 2022-11-26 00:44:24 +01:00
Michael Goulet
6436c348db Remove SelectionContext::infcx() in favor of field access 2022-11-25 23:31:37 +00:00
bors
aff003becd Auto merge of #99798 - JulianKnodt:ac1, r=BoxyUwU
Add `ConstKind::Expr`

Starting to implement `ty::ConstKind::Abstract`, most of the match cases are stubbed out, some I was unsure what to add, others I didn't want to add until a more complete implementation was ready.

r? `@lcnr`
2022-11-25 22:56:59 +00:00
Lokathor
ea47943212 Refine instruction_set inline rules
Previously an exact match of the `instruction_set` attribute was required for an MIR inline to be considered. This change checks for an exact match *only* if the callee sets an `instruction_set` in the first place. When the callee does not declare an instruction set then it is considered to be platform agnostic code and it's allowed to be inline'd into the caller.
2022-11-25 15:19:16 -07:00
Michael Goulet
6b63d6c918 Rename normalize_opaque_types to reveal_opaque_types_in_bounds 2022-11-25 19:39:46 +00:00
bors
8681d4cffc Auto merge of #104902 - matthiaskrgr:rollup-oo27a4u, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104716 (move 2 candidates into builtin candidate)
 - #104760 (Clarify `SyntaxExtensionKind::LegacyDerive`.)
 - #104797 (rustc_codegen_ssa: write `.dwp` in a streaming fashion)
 - #104835 (Use infcx.partially_normalize_associated_types_in)
 - #104853 (Fix typo in miri sysroot)
 - #104879 (jsondoclint: Recognise Typedef as valid kind for Type::ResolvedPath)
 - #104887 (rustbuild: Don't build doc::SharedAssets when building JSON docs.)
 - #104896 (rustdoc: fix broken tooltip CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-25 19:09:30 +00:00
Santiago Pastorino
3c9b30e658
Define all clauses as dummy_with_span as the usages are all equivalent 2022-11-25 16:00:08 -03:00
Santiago Pastorino
aaa1db63ce
Remove AscribeUserTypeCx 2022-11-25 15:25:00 -03:00
Ben Kimock
8961e13802 Use None when the stack is empty 2022-11-25 13:13:11 -05:00
Matthias Krüger
12e1b84e95
Rollup merge of #104896 - notriddle:notriddle/tooltip, r=GuillaumeGomez
rustdoc: fix broken tooltip CSS

text `#ffffff` on background `#fdffd3` fails the [WCAG color contrast checker], and seems like a mistake in 16b55903ee.

Making the cursor a pointer is misleading, since clicking it doesn't do anything.

[WCAG color contrast checker]: https://accessibleweb.com/color-contrast-checker/
2022-11-25 18:35:42 +01:00
Matthias Krüger
c72db77ecb
Rollup merge of #104887 - aDotInTheVoid:rustbuild-json-doc-shared-assets, r=jyn514
rustbuild: Don't build doc::SharedAssets when building JSON docs.

Previously, running `./x doc library/core/ --json` on a plain build would panic bootstrap.

```
$ ./x doc library/core/ --json
Building rustbuild
    Blocking waiting for file lock on package cache
   Compiling bootstrap v0.0.0 (/home/nixon/dev/rust/rust/src/bootstrap)
    Finished dev [unoptimized] target(s) in 4.47s
thread 'main' panicked at 'fs::write(&version_info, &info) failed with No such file or directory (os error 2) ("/home/nixon/dev/rust/rust/build/x86_64-unknown-linux-gnu/doc/version_info.html")', doc.rs:410:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:04
```

Becuase the `SharedAssets` step assumes that the HTML out dir has been created. This isn't true for JSON.

The fix is to not build shared assets when doing a JSON doc build, as it doesn't need them.

r? ``@jyn514``

``@rustbot`` modify labels: +A-rustdoc-json
2022-11-25 18:35:42 +01:00
Matthias Krüger
996de3adf6
Rollup merge of #104879 - aDotInTheVoid:jsondoclint-typedef, r=GuillaumeGomez
jsondoclint: Recognise Typedef as valid kind for Type::ResolvedPath

Closes #104851

r? ``@GuillaumeGomez``

``@rustbot`` modify labels: +A-testsuite
2022-11-25 18:35:42 +01:00
Matthias Krüger
287bb6d252
Rollup merge of #104853 - jyn514:sysroot-typo, r=RalfJung
Fix typo in miri sysroot

r? ``@RalfJung``
2022-11-25 18:35:41 +01:00
Matthias Krüger
7fac5048c4
Rollup merge of #104835 - spastorino:use-partially_normalize_associated_types_in, r=lcnr
Use infcx.partially_normalize_associated_types_in

r? ``@lcnr``
2022-11-25 18:35:41 +01:00
Matthias Krüger
aec60c6b7c
Rollup merge of #104797 - weihanglo:stream-write-dwp, r=jackh726
rustc_codegen_ssa: write `.dwp` in a streaming fashion

When writing a `.dwp` file, rustc writes to a Vec first then to a BufWriter-wrapped file. It seems very likely that we can write in a streaming fashion to avoid double buffering in an intermediate Vec.

On my Linux machine, `.dwp` from the latest rust-lang/cargo is 113MiB. It may worth a stream writer, though I didn't do any benchmark 🙇🏾‍♂️.
2022-11-25 18:35:40 +01:00
Matthias Krüger
8f3f4980b4
Rollup merge of #104760 - nnethercote:rm-LegacyDerive, r=petrochenkov
Clarify `SyntaxExtensionKind::LegacyDerive`.

It's always treated the same as `SyntaxExtensionKind::Derive`.
2022-11-25 18:35:39 +01:00
Matthias Krüger
9c7dc3e30b
Rollup merge of #104716 - lcnr:selection-candidate, r=jackh726
move 2 candidates into builtin candidate

having separate candidates for these isn't too helpful i think

r? types
2022-11-25 18:35:39 +01:00
Nilstrieb
2c456b5123
Test a small cargo-miri smoke test even in run_tests_minimal
This makes sure that cargo-miri works on all targets.
2022-11-25 18:28:35 +01:00
Michael Howell
20cb41f466 rustdoc: remove no-op CSS #help dt { display: block }
`display: block` is the [default UA style] for dt.

[default UA style]: https://html.spec.whatwg.org/multipage/rendering.html#lists
2022-11-25 10:07:21 -07:00
Michael Howell
75e4de61d4 rustdoc: revert tooltip background color on light theme to readable
text #fff on background #fdffd3 fails the [WCAG color contrast checker], and
seems like a mistake in 16b55903ee.

[WCAG color contrast checker]: https://accessibleweb.com/color-contrast-checker/
2022-11-25 09:28:25 -07:00
Michael Howell
f8b2e13d16 rustdoc: remove cursor: pointer from unclickable tooltip
It's misleading unless it gets changed to respond to being clicked.
2022-11-25 09:16:27 -07:00
bors
051cab2b84 Auto merge of #104846 - spastorino:santa-clauses-make-goals-early-christmas-🎄, r=oli-obk
Branch Clause from Predicate

r? `@oli-obk`

This is part of what's proposed in https://github.com/rust-lang/compiler-team/issues/531
2022-11-25 15:59:31 +00:00
lcnr
4f07008419 remove confusing comment
`?0: CoerceUnsized<SomeTy>` can definitely apply because
`?0` matches any type, same for `SomeTy: CoerceUnsized<?0>`
2022-11-25 16:39:23 +01:00
lcnr
a215b7b4df remove TypeError::ObjectUnsafeCoercion 2022-11-25 16:39:23 +01:00
lcnr
40a053361a small method code cleanup 2022-11-25 15:52:58 +01:00
Tshepang Mbambo
b21674f3bd remove unused code 2022-11-25 16:28:18 +02:00
Tshepang Mbambo
c6ea362571 remove obsolete comment 2022-11-25 16:27:27 +02:00
Nixon Enraght-Moony
37b0a100aa rustbuild: Don't build doc::SharedAssets when building JSON docs. 2022-11-25 13:50:41 +00:00
lcnr
68d953014e notify lcnr on changes to ObligationCtxt 2022-11-25 14:26:10 +01:00