Commit Graph

195949 Commits

Author SHA1 Message Date
Jack Wrenn
aee5f31c68 safe transmute: lowercase tracing levels
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r927095154
2022-07-27 17:33:57 +00:00
Jack Wrenn
2268603046 safe transmute: tweak Nfa::union to consume params by value
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925274516
2022-07-27 17:33:57 +00:00
Jack Wrenn
b78c3daad0 safe transmute: reference tracking issue
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925266769
2022-07-27 17:33:57 +00:00
Jack Wrenn
21d1ab4877 safe transmute: add rustc_on_unimplemented to BikeshedIntrinsicFrom
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925266583
2022-07-27 17:33:57 +00:00
Jack Wrenn
402644f72f safe transmute: test to ensure that trait is correctly feature-gated
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925265476
2022-07-27 17:33:57 +00:00
Jack Wrenn
4a15157bad safe transmute: don't mark user impls as unambiguous
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925243794
2022-07-27 17:33:57 +00:00
Jack Wrenn
c0d0ce95eb safe transmute: tweak tracing
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925246903
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925250811
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925255782
2022-07-27 17:33:56 +00:00
Jack Wrenn
0fa70c3b12 safe transmute: revise Hash, PartialEq impls on VariantDef, FieldDef
Exhaustively destructure parameter(s) so that changes to type
definitions will lead to compile errors, thus reminding contributors
to re-assess the assumptions underpinning these impls.

ref: https://github.com/rust-lang/rust/pull/92268/#discussion_r925241377
ref: https://github.com/rust-lang/rust/pull/92268/#discussion_r925241718
2022-07-27 17:33:56 +00:00
Jack Wrenn
8c5c291882 safe transmute: test when ASSUME params are passed indirectly
ref: https://github.com/rust-lang/rust/pull/92268/files#r925258420
2022-07-27 17:33:56 +00:00
Jack Wrenn
18751a708a safe transmute: gracefully handle const params of wrong types
ref: https://github.com/rust-lang/rust/pull/92268/files#r925244819
2022-07-27 17:33:56 +00:00
Jack Wrenn
bc4a1dea41 Initial (incomplete) implementation of transmutability trait.
This initial implementation handles transmutations between types with specified layouts, except when references are involved.

Co-authored-by: Igor null <m1el.2027@gmail.com>
2022-07-27 17:33:56 +00:00
bors
2a220937c2 Auto merge of #99802 - JohnTitor:rollup-uaklql1, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #99079 (Check that RPITs constrained by a recursive call in a closure are compatible)
 - #99704 (Add `Self: ~const Trait` to traits with `#[const_trait]`)
 - #99769 (Sync rustc_codegen_cranelift)
 - #99783 (rustdoc: remove Clean trait impls for more items)
 - #99789 (Refactor: use `pluralize!`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-27 12:32:54 +00:00
Yuki Okushi
e0f88b3e9c
Rollup merge of #99789 - TaKO8Ki:use-pluralize-macro, r=compiler-errors
Refactor: use `pluralize!`

Use `pluralize!` in more places
2022-07-27 19:05:36 +09:00
Yuki Okushi
d425979f43
Rollup merge of #99783 - notriddle:notriddle/clean-trait-removal, r=GuillaumeGomez
rustdoc: remove Clean trait impls for more items

Follow up to #99638 and	#99672
2022-07-27 19:05:35 +09:00
Yuki Okushi
faa6f6b159
Rollup merge of #99769 - bjorn3:sync_cg_clif-2022-07-26, r=bjorn3
Sync rustc_codegen_cranelift

I did a large refactoring of the intrinsics module to remove the intrinsic_match macro which is not very clear to other people. This also enables rustfmt to run on this code. While I already did a sync yesterday, I am going to do another sync again to avoid potential conflicts as those will likely be painful to resolve.

r? ``@ghost``

``@rustbot`` label +A-codegen +A-cranelift +T-compiler
2022-07-27 19:05:34 +09:00
Yuki Okushi
28b44ff5d4
Rollup merge of #99704 - fee1-dead-contrib:add_self_tilde_const_trait, r=oli-obk
Add `Self: ~const Trait` to traits with `#[const_trait]`

r? `@oli-obk`
2022-07-27 19:05:33 +09:00
Yuki Okushi
3b780fc279
Rollup merge of #99079 - compiler-errors:issue-99073, r=oli-obk
Check that RPITs constrained by a recursive call in a closure are compatible

Fixes #99073

Adapts a similar visitor pattern to `find_opaque_ty_constraints` (that we use to check TAITs), but with some changes:
0. Only walk the "OnlyBody" children, instead of all items in the RPIT's defining scope
1. Only walk through the body's children if we found a constraining usage
2. Don't actually do any inference, just do a comparison and error if they're mismatched

----

r? `@oli-obk` -- you know all this impl-trait stuff best... is this the right approach? I can explain the underlying issue better if you'd like, in case that might reveal a better solution. Not sure if it's possible to gather up the closure's defining usages of the RPIT while borrowck'ing the outer function, that might be a better place to put this check...
2022-07-27 19:05:32 +09:00
bors
50166d5e5e Auto merge of #98748 - saethlin:optimize-bufreader, r=Mark-Simulacrum
Remove some redundant checks from BufReader

The implementation of BufReader contains a lot of redundant checks. While any one of these checks is not particularly expensive to execute, especially when taken together they dramatically inhibit LLVM's ability to make subsequent optimizations by confusing data flow increasing the code size of anything that uses BufReader.

In particular, these changes have a ~2x increase on the benchmark that this adds a `black_box` to. I'm adding that `black_box` here just in case LLVM gets clever enough to remove the reads entirely. Right now it can't, but these optimizations are really setting it up to do so.

We get this optimization by factoring all the actual buffer management and bounds-checking logic into a new module inside `bufreader` with a new `Buffer` type. This makes it much easier to ensure that we have correctly encapsulated the management of the region of the buffer that we have read bytes into, and it lets us provide a new faster way to do small reads. `Buffer::consume_with` lets a caller do a read from the buffer with a single bounds check, instead of the double-check that's required to use `buffer` + `consume`.

Unfortunately I'm not aware of a lot of open-source usage of `BufReader` in perf-critical environments. Some time ago I tweaked this code because I saw `BufReader` in a profile at work, and I contributed some benchmarks to the `bincode` crate which exercise `BufReader::buffer`. These changes appear to help those benchmarks at little, but all these sorts of benchmarks are kind of fragile so I'm wary of quoting anything specific.
2022-07-27 09:49:06 +00:00
bors
ff693dc7b8 Auto merge of #99778 - ehuss:update-cargo, r=ehuss
Update cargo

5 commits in d8d30a75376f78bb0fabe3d28ee9d87aa8035309..85b500ccad8cd0b63995fd94a03ddd4b83f7905b
2022-07-19 13:59:17 +0000 to 2022-07-24 21:10:46 +0000
- Make the empty rustc-wrapper test more explicit. (rust-lang/cargo#10899)
- expand RUSTC_WRAPPER docs (rust-lang/cargo#10896)
- Stabilize Workspace Inheritance (rust-lang/cargo#10859)
- Fix typo in unstable docs: s/PROGJCT/PROJECT/ (rust-lang/cargo#10890)
- refactor(source): Open query API for adding more types of queries (rust-lang/cargo#10883)
2022-07-27 06:59:51 +00:00
bors
e33cc71a61 Auto merge of #99792 - JohnTitor:rollup-20i7ewx, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #98583 (Stabilize Windows `FileTypeExt` with `is_symlink_dir` and `is_symlink_file`)
 - #99698 (Prefer visibility map parents that are not `doc(hidden)` first)
 - #99700 (Add a clickable link to the layout section)
 - #99712 (passes: port more of `check_attr` module)
 - #99759 (Remove dead code from cg_llvm)
 - #99765 (Don't build std for *-uefi targets)
 - #99771 (Update pulldown-cmark version to 0.9.2 (fixes url encoding for some chars))
 - #99775 (rustdoc: do not allocate String when writing path full name)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-27 04:18:49 +00:00
Yuki Okushi
0d5bdcac5f
Rollup merge of #99775 - notriddle:notriddle/as-str, r=camelid
rustdoc: do not allocate String when writing path full name

No idea if this makes any perf difference, but it just seems like premature pessimisation to use String when str will do.
2022-07-27 11:52:59 +09:00
Yuki Okushi
f8f07dece7
Rollup merge of #99771 - GuillaumeGomez:update-pulldown-cmark, r=Urgau
Update pulldown-cmark version to 0.9.2 (fixes url encoding for some chars)

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

r? ``@Dylan-DPC``
2022-07-27 11:52:58 +09:00
Yuki Okushi
a76f2fe66e
Rollup merge of #99765 - nicholasbishop:bishop-disable-uefi-std-build, r=jyn514
Don't build std for *-uefi targets

https://github.com/rust-lang/rust/issues/97322
2022-07-27 11:52:57 +09:00
Yuki Okushi
7f608e99dc
Rollup merge of #99759 - bjorn3:remove_llvm_dead_code, r=nikic
Remove dead code from cg_llvm

Found while working on https://github.com/rust-lang/rust/pull/97485
2022-07-27 11:52:56 +09:00
Yuki Okushi
fe51d07b99
Rollup merge of #99712 - davidtwco:translation-migrate-passes-2, r=compiler-errors
passes: port more of `check_attr` module

Continues from #99213.

Port more diagnostics in `rustc_passes::check_attr` to using the diagnostic derive and translation machinery.

r? `@compiler-errors`
2022-07-27 11:52:55 +09:00
Yuki Okushi
181bf05d86
Rollup merge of #99700 - est31:rustdoc_layout_heading, r=GuillaumeGomez
Add a clickable link to the layout section

The layout section (activated by `--show-type-layout`) is currently not linkable to (outside of chrome's link to text feature). This PR makes it linkable via `#layout`.
2022-07-27 11:52:54 +09:00
Yuki Okushi
3ca1c3100d
Rollup merge of #99698 - compiler-errors:no-doc-hidden, r=cjgillot
Prefer visibility map parents that are not `doc(hidden)` first

Far simpler approach to #98876.

This only fixes the case where the parent is `doc(hidden)`, not where the child is `doc(hidden)` since I don't know how to get the attrs on the import statement given a `ModChild`... I'll try to follow up with that, but this is a good first step.
2022-07-27 11:52:53 +09:00
Yuki Okushi
1ff84f09b2
Rollup merge of #98583 - joshtriplett:stabilize-windows-symlink-types, r=thomcc
Stabilize Windows `FileTypeExt` with `is_symlink_dir` and `is_symlink_file`

These calls allow detecting whether a symlink is a file or a directory,
a distinction Windows maintains, and one important to software that
wants to do further operations on the symlink (e.g. removing it).
2022-07-27 11:52:52 +09:00
bors
b573e10d21 Auto merge of #98553 - the8472:next_chunk_opt, r=Mark-Simulacrum
Optimized vec::IntoIter::next_chunk impl

```
x86_64v1, default
test vec::bench_next_chunk                               ... bench:         696 ns/iter (+/- 22)
x86_64v1, pr
test vec::bench_next_chunk                               ... bench:         309 ns/iter (+/- 4)

znver2, default
test vec::bench_next_chunk                               ... bench:      17,272 ns/iter (+/- 117)
znver2, pr
test vec::bench_next_chunk                               ... bench:         211 ns/iter (+/- 3)
```

On znver2 the default impl seems to be slow due to different inlining decisions. It goes through `core::array::iter_next_chunk`
which has a deep call tree.
2022-07-27 01:12:30 +00:00
Takayuki Maeda
ddd326fda4 use pluralize! 2022-07-27 10:09:06 +09:00
Ben Kimock
5fa1926634 Add Buffer::consume_with to enable direct buffer access with one check 2022-07-26 20:16:55 -04:00
Michael Howell
9dcf1d9c1a rustdoc: remove Clean trait impl for ty::PolyTraitPredicate 2022-07-26 15:33:17 -07:00
Michael Howell
e94ef5cc76 rustdoc: remove Clean trait impls for ty::OutlivesPredicate 2022-07-26 15:33:13 -07:00
Michael Howell
791beb7a5c rustdoc: remove Clean trait impl for ProjectionPredicate 2022-07-26 15:33:10 -07:00
Michael Howell
4443fd5d76 rustdoc: remove Clean trait impl for ProjectionTy 2022-07-26 15:33:04 -07:00
Eric Huss
56a7738c97 Update cargo 2022-07-26 12:48:39 -07:00
The 8472
4ba7cac359 add test for vec::IntoIter::next_chunk() impl
an adaption of the default impl's doctest
2022-07-26 21:43:25 +02:00
bors
4d6d601c8a Auto merge of #99574 - durin42:allocator-patch-redux, r=nikic
codegen: use new {re,de,}allocator annotations in llvm

This obviates the patch that teaches LLVM internals about
_rust_{re,de}alloc functions by putting annotations directly in the IR
for the optimizer.

The sole test change is required to anchor FileCheck to the body of the
`box_uninitialized` method, so it doesn't see the `allocalign` on
`__rust_alloc` and get mad about the string `alloca` showing up. Since I
was there anyway, I added some checks on the attributes to prove the
right attributes got set.

r? `@nikic`
2022-07-26 19:35:57 +00:00
Michael Howell
b8fb6e1032 rustdoc: do not allocate String when writing path full name
No idea if this makes any perf difference, but it just seems like premature
pessimisation to use String when str will do.
2022-07-26 12:23:59 -07:00
Guillaume Gomez
7f78a9acc5 Update pulldown-cmark version 2022-07-26 20:36:20 +02:00
The 8472
2f9f2e507e Optimized vec::IntoIter::next_chunk impl
```
test vec::bench_next_chunk                               ... bench:         696 ns/iter (+/- 22)
x86_64v1, pr
test vec::bench_next_chunk                               ... bench:         309 ns/iter (+/- 4)

znver2, default
test vec::bench_next_chunk                               ... bench:      17,272 ns/iter (+/- 117)
znver2, pr
test vec::bench_next_chunk                               ... bench:         211 ns/iter (+/- 3)
```

The znver2 default impl seems to be slow due to inlining decisions. It goes through `core::array::iter_next_chunk`
which has a deeper call tree.
2022-07-26 20:31:43 +02:00
bjorn3
30a5eb063e Merge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into sync_cg_clif-2022-07-26 2022-07-26 18:53:46 +02:00
bors
c11207ec89 Auto merge of #99764 - matthiaskrgr:rollup-fawyb3m, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #99235 (rustdoc: Add support for `#[rustc_must_implement_one_of]`)
 - #99716 (remove useless mut from examples)
 - #99724 (Fix some broken link fragments.)
 - #99729 (Remove unused tuple fields)
 - #99757 (Make `transmute_copy` docs read better)
 - #99758 (remove useless `#[allow]` in a test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-26 16:47:36 +00:00
bjorn3
d3a2366ee8 Implement some more llvm float compare intrinsic options 2022-07-26 16:27:14 +00:00
bjorn3
d3099a40c7 Outline a bug! invocation
This reduces the amount of llvm ir lines for intrinsic related code from
23801 to 20478.
2022-07-26 16:26:35 +00:00
bjorn3
54eb0d992a Fully remove the intrinsic_match macro 2022-07-26 16:09:41 +00:00
Nicholas Bishop
05c1a4ab4d Don't build std for *-uefi targets
https://github.com/rust-lang/rust/issues/97322
2022-07-26 11:50:54 -04:00
bjorn3
e151964a70 Start moving away from the intrinsic_match macro
It isn't clear most people other than me and it blocks formatting by
rustfmt.
2022-07-26 15:17:34 +00:00
Matthias Krüger
8e5bc06354
Rollup merge of #99758 - WaffleLapkin:remove_useless_allow, r=Dylan-DPC
remove useless `#[allow]` in a test

The mentioned issue, https://github.com/rust-lang/rust/issues/54586 was fixed 4 years ago :)
2022-07-26 16:57:53 +02:00
Matthias Krüger
a739e28aea
Rollup merge of #99757 - asquared31415:patch-1, r=Dylan-DPC
Make `transmute_copy` docs read better
2022-07-26 16:57:52 +02:00