Commit Graph

206007 Commits

Author SHA1 Message Date
bors
4ecfdfac51 Auto merge of #100214 - scottmcm:strict-range, r=thomcc
Optimize `array::IntoIter`

`.into_iter()` on arrays was slower than it needed to be (especially compared to slice iterator) since it uses `Range<usize>`, which needs to handle degenerate ranges like `10..4`.

This PR adds an internal `IndexRange` type that's like `Range<usize>` but with a safety invariant that means it doesn't need to worry about those cases -- it only handles `start <= end` -- and thus can give LLVM more information to optimize better.

I added one simple demonstration of the improvement as a codegen test.

(`vec::IntoIter` uses pointers instead of indexes, so doesn't have this problem, but that only works because its elements are boxed.  `array::IntoIter` can't use pointers because that would keep it from being movable.)
2022-09-21 00:41:33 +00:00
Eric Huss
e7467132ef Update books 2022-09-20 17:04:55 -07:00
Michael Howell
04e98b9025 rustdoc: remove no-op .method { position: relative }
This rule was added in 88fe6dfa31 to assist
in position the hide/show togges on methods. This is no longer needed,
because these toggles are no longer implemented as absolutely positioned
links nested inside headers.
2022-09-20 16:16:49 -07:00
Michael Howell
c6c4e0f438 rustdoc: remove no-op .method { font-size: 1rem }
This rule was added in 22dad4b044, back when
the `method` class was attached to headers instead of DIVs that wrap
headers.

Old method rendering:

a96247bcac/src/librustdoc/html/render.rs (L2062)

Current method rendering:

432abd86f2/src/librustdoc/html/render/print_item.rs (L721)
2022-09-20 16:16:45 -07:00
Mark Rousskov
84fb168d7f Avoid panicking on missing fallback
This just prints a message but continues on if a fallback is missing,
which can happen when we're building a partial set of builders and
producing a dev-static build from it (e.g., when no Apple builder runs
at all).

Probably the more extensive fix is to allow the build-manifest invoker
to specify the expected set of targets & hosts, but that's a far more
extensive change. The main risk from this is that we accidentally start
falling back to linux docs across all platforms without noticing. I'm
not sure that we can do much about that though at this time.
2022-09-20 18:23:22 -04:00
Nicholas Nethercote
b7dc9341b5 Wrap some long comment lines. 2022-09-21 08:06:06 +10:00
bors
7743aa836e Auto merge of #100581 - joboet:sync_rwlock_everywhere, r=thomcc
std: use `sync::RwLock` for internal statics

Since `sync::RwLock` is now `const`-constructible, it can be used for internal statics, removing the need for `sys_common::StaticRwLock`. This adds some extra allocations on platforms which need to box their locks (currently SGX and some UNIX), but these will become unnecessary with the lock improvements tracked in #93740.
2022-09-20 22:00:08 +00:00
Andrew Pollack
ad52e325c6 Adding ignore fuchsia tests for execvp 2022-09-20 21:37:08 +00:00
Guillaume Gomez
27a420f251 Unify generation of section on "All items" page with all other pages 2022-09-20 23:23:03 +02:00
Chris Wailes
3d5a41724b Update rustc's information on Android's sanitizers
This patch updates sanitizier support definitions for Android inside the
compiler.  It also adjusts the logic to make sure no pre-built sanitizer
runtime libraries are emitted as these are instead provided dynamically
on Android targets.
2022-09-20 14:16:57 -07:00
Michael Goulet
5b96e5e71a Skip Equate relation in handle_opaque_type 2022-09-20 20:57:02 +00:00
Josh Stone
a72666ed56 rustc_transmute: fix big-endian discriminants 2022-09-20 13:03:43 -07:00
Andrew Pollack
592ae2073b Adding needs-unwind to tests involving changing memory size of Futures/Closures 2022-09-20 19:46:27 +00:00
bors
432abd86f2 Auto merge of #102061 - notriddle:rollup-kwu9vp8, r=notriddle
Rollup of 12 pull requests

Successful merges:

 - #100250 (Manually cleanup token stream when macro expansion aborts.)
 - #101014 (Fix -Zmeta-stats ICE by giving `FileEncoder` file read permissions)
 - #101958 (Improve error for when query is unsupported by crate)
 - #101976 (MirPhase: clarify that linting is not a semantic change)
 - #102001 (Use LLVM C-API to build atomic cmpxchg and fence)
 - #102008 (Add GUI test for notable traits element position)
 - #102013 (Simplify rpitit handling on lower_fn_decl)
 - #102021 (some post-valtree cleanup)
 - #102027 (rustdoc: remove `docblock` class from `item-decl`)
 - #102034 (rustdoc: remove no-op CSS `h1-6 { border-bottom-color }`)
 - #102038 (Make the `normalize-overflow` rustdoc test actually do something)
 - #102053 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-20 19:10:11 +00:00
Michael Howell
25f5483f58
Rollup merge of #102053 - lnicola:rust-analyzer-2022-09-20, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2022-09-20 10:13:03 -07:00
Michael Howell
3fac4bbdda
Rollup merge of #102038 - jyn514:rustdoc-normalize-test, r=compiler-errors
Make the `normalize-overflow` rustdoc test actually do something

Since https://github.com/rust-lang/rust/pull/88679, rustdoc doesn't load crates eagerly. Add an explicit `extern crate` item to make sure the crate is loaded and the bug reproduces.
You can verify this fix by adding `// compile-flags: -Znormalize-docs` and running the test to make sure it gives an error.
2022-09-20 10:13:02 -07:00
Michael Howell
128733d742
Rollup merge of #102034 - notriddle:notriddle/border-bottom, r=GuillaumeGomez
rustdoc: remove no-op CSS `h1-6 { border-bottom-color }`

For this rule to have an actual effect, the border-bottom width needs specified, elsewhere, without also specifying the color. This doesn't happen. Ever since 88b137d5fe, every spot where headers get a border assigned to them also assigns the color.

Preview: https://notriddle.com/notriddle-rustdoc-test/border-bottom/rustc_monomorphize/collector/index.html
2022-09-20 10:13:02 -07:00
Michael Howell
1b54ee38a3
Rollup merge of #102027 - notriddle:notriddle/docblock-item-decl, r=GuillaumeGomez
rustdoc: remove `docblock` class from `item-decl`

This class was originally added in 73b97c7e7c to support hiding and showing the item, because `main.js` went through all `docblock` elements in the DOM and added toggles to them.

73b97c7e7c/src/librustdoc/html/static/main.js (L1856-L1867)

The `item-decl` is no longer auto-hidden since c96f86de30 removed it.

`item-decl` used to be called `type-decl`: that name was changed in 8b7a2dd462.

The `docblock` class is no longer used for implementing toggles, since rustdoc switched to using `<details>` elements.

Preview: https://notriddle.com/notriddle-rustdoc-test/docblock-item-decl/rustdoc/clean/types/enum.Type.html
2022-09-20 10:13:01 -07:00
Michael Howell
b149c48186
Rollup merge of #102021 - lcnr:tyConst-fun, r=b-naber,BoxyUwU
some post-valtree cleanup

r? project-const-generics cc ```@b-naber```
2022-09-20 10:13:01 -07:00
Michael Howell
08b369a501
Rollup merge of #102013 - spastorino:rpitit-lower-fn-decl, r=compiler-errors
Simplify rpitit handling on lower_fn_decl

r? `````@compiler-errors`````
2022-09-20 10:13:00 -07:00
Michael Howell
09221722af
Rollup merge of #102008 - GuillaumeGomez:notable-trait-gui-test, r=notriddle
Add GUI test for notable traits element position

Fixes #101891.

r? ````@notriddle````
2022-09-20 10:12:59 -07:00
Michael Howell
2c57a5b166
Rollup merge of #102001 - cuviper:build-atomic-capi, r=nikic
Use LLVM C-API to build atomic cmpxchg and fence

We don't need C++ wrappers because the LLVM C API can build these.
2022-09-20 10:12:59 -07:00
Michael Howell
0d2e57cb04
Rollup merge of #101976 - RalfJung:mir-semantic-phases, r=oli-obk
MirPhase: clarify that linting is not a semantic change

r? ```@JakobDegen```
2022-09-20 10:12:58 -07:00
Michael Howell
2c893737a6
Rollup merge of #101958 - hanar3:101666/enhance-error-message, r=oli-obk
Improve error for when query is unsupported by crate

This is an improvement to the error message mentioned on #101666.  It seems like a good idea to also add [this link to the rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/query.html), if explaining the query system in detail is a concern here, but I'm unsure if there is any restrictions on adding links to error messages.
2022-09-20 10:12:58 -07:00
Michael Howell
3f377d3f96
Rollup merge of #101014 - isikkema:fix-zmeta-stats-file-encoder-no-read-perms, r=isikkema
Fix -Zmeta-stats ICE by giving `FileEncoder` file read permissions

Fixes #101001

As far as I can tell, #101001 is caused because the file is being created with write-only permissions here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_serialize/src/opaque.rs#L196

but it is trying to be read here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/rmeta/encoder.rs#L780

This PR attempts to fix this by creating/opening the file with the same permissions as `File::create()` with the addition of read.
2022-09-20 10:12:57 -07:00
Michael Howell
14b27cfd11
Rollup merge of #100250 - cjgillot:recover-token-stream, r=Aaron1011
Manually cleanup token stream when macro expansion aborts.

In case of syntax error in macro expansion, the expansion code can decide to stop processing anything. In that case, the token stream is malformed. This makes downstream users, like derive macros, ICE.

In this case, this PR manually cleans up the token stream by closing all currently open delimiters.

Fixes https://github.com/rust-lang/rust/issues/96818.
Fixes https://github.com/rust-lang/rust/issues/80447.
Fixes https://github.com/rust-lang/rust/issues/81920.
Fixes https://github.com/rust-lang/rust/issues/91023.
2022-09-20 10:12:56 -07:00
Michael Goulet
83e6128b57 Better binder treatment 2022-09-20 16:39:39 +00:00
bors
cd8cc91045 Auto merge of #101989 - fee1-dead-contrib:const_trait_impl-assoc-caller-bounds, r=oli-obk
make projection bounds with const bounds satisfy const

Fixes #101982.
2022-09-20 16:24:36 +00:00
bors
1f66a3e8d0 Auto merge of #9502 - c410-f3r:arith, r=Alexendoo
[arithmetic-side-effects] Add more tests

Taken from the `integer-arithmetic` lint.

changelog: [arithmetic-side-effects] Add more tests
2022-09-20 16:14:54 +00:00
Mahmoud Al-Qudsi
c291d2adec Clarify Path::extension() semantics in docs abstract
State up-front and center what shape the returned extension will have, without
making the user read through the description and examples.

Rationale: Various frameworks and libraries for different platforms have their
different conventions as to whether an "extension" is ".ext" or just "ext" and
anyone that's had to deal with this ambiguity in the past is always double- or
triple-checking to make sure the function call returns an extension that matches
the expected semantics. Offer the answer to this important question right off
the bat instead of making them dig to find it.
2022-09-20 11:12:03 -05:00
Guillaume Gomez
4a3109e8b7 Add test for sidebar elements in the "All types" page 2022-09-20 17:10:38 +02:00
Guillaume Gomez
5343dc7c99 Generate sidebar elements for the "All items" page 2022-09-20 17:10:21 +02:00
Caio
736d88b549 [arithmetic_side_effects] Add more tests 2022-09-20 12:06:49 -03:00
Laurențiu Nicola
9dcd19bd2e ⬆️ rust-analyzer 2022-09-20 17:39:17 +03:00
Sikkema, Isaac
a2cb8a4949 add comment explaining read permissions 2022-09-20 10:06:50 -04:00
bors
4136b59b7d Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank
Allow patterns to constrain the hidden type of opaque types

fixes #96572

reverts a revert as original PR was a perf regression that was fixed by reverting it: https://github.com/rust-lang/rust/pull/99368#issuecomment-1186587864)

TODO:

* check if https://github.com/rust-lang/rust/issues/99685 is avoided
2022-09-20 12:09:52 +00:00
Ralf Jung
7373788c37 fix ConstProp handling of written_only_inside_own_block_locals 2022-09-20 12:49:32 +02:00
bors
eb84c8b621 Auto merge of #2553 - RalfJung:macos-is-a-pain, r=RalfJung
make a sync test more reliable

CI still failed in https://github.com/rust-lang/miri/actions/runs/3088146532/jobs/4994285794, with a 2 second timeout?!??
2022-09-20 08:19:56 +00:00
Ralf Jung
42523d9231 make a sync test more reliable 2022-09-20 10:14:30 +02:00
bors
dfa6f8894e Auto merge of #2552 - RalfJung:env-term, r=oli-obk
remove Windows TERM env var hack and -Zmiri-env-exclude

The hack should not be needed any more since https://github.com/rust-lang/rust/pull/100206. And that also mostly removes the need for `-Zmiri-env-exclude` -- if needed, users can still achieve the same by running `(unset VAR; cargo miri test)`.

I am keeping `-Zmiri-env-forward` since it is still useful, e.g. to have RUST_BACKTRACE=full set in an otherwise deterministic execution.

`@rust-lang/miri` any objections to removing `-Zmiri-env-exclude`?
2022-09-20 07:16:58 +00:00
Ralf Jung
dd80b1aaba work harder around notorious macos unrealiability 2022-09-20 09:14:14 +02:00
bors
8fd6d03e22 Auto merge of #101806 - BelovDV:issue-fix-fn-find_library, r=petrochenkov
fix verbatim with upstream dependencies

https://github.com/rust-lang/rust/issues/99425#issuecomment-1207224161

r? `@petrochenkov`
2022-09-20 07:10:18 +00:00
bors
a38a082afb fix verbatim with upstream dependencies
https://github.com/rust-lang/rust/issues/99425#issuecomment-1207224161

r? `@petrochenkov`
2022-09-20 07:10:17 +00:00
Ralf Jung
bacf131acc remove Windows TERM env var hack and -Zmiri-env-exclude 2022-09-20 08:51:13 +02:00
bors
d9ad25ee4b Auto merge of #2548 - RalfJung:remove-tls-diagnostics-hack, r=RalfJung
avoid thread-local var indirection for non-halting diagnostics

This hack used to be necessary because Stacked Borrows did not have access to enough parts of the machine. But that got fixed a while ago, so now we can just emit diagnostics directly, which is a lot more reliable.

Needs https://github.com/rust-lang/rust/pull/101985
Fixes https://github.com/rust-lang/miri/issues/2538
2022-09-20 06:42:05 +00:00
Ralf Jung
7687b7e510 rustup, fmt 2022-09-20 08:41:44 +02:00
Ralf Jung
5ca1f85a2d make some names more consistent 2022-09-20 08:37:20 +02:00
Ralf Jung
cc149c7691 put a tcx into the Machine so that we have to pass around fewer things 2022-09-20 08:37:20 +02:00
Ralf Jung
3cb27f584b avoid thread-local var indirection for non-halting diagnostics 2022-09-20 08:37:20 +02:00
Scott McMurray
6dbd9a29c2 Optimize array::IntoIter
`.into_iter()` on arrays was slower than it needed to be (especially compared to slice iterator) since it uses `Range<usize>`, which needs to handle degenerate ranges like `10..4`.

This PR adds an internal `IndexRange` type that's like `Range<usize>` but with a safety invariant that means it doesn't need to worry about those cases -- it only handles `start <= end` -- and thus can give LLVM more information to optimize better.

I added one simple demonstration of the improvement as a codegen test.
2022-09-19 23:24:34 -07:00