Commit graph

253263 commits

Author SHA1 Message Date
bors a77f76e263 Auto merge of #123992 - compiler-errors:no-has-typeck-results, r=jackh726
`has_typeck_results` doesnt need to be a query

self-explanatory
2024-04-23 04:13:33 +00:00
bors aca749eefc Auto merge of #121801 - zetanumbers:async_drop_glue, r=oli-obk
Add simple async drop glue generation

This is a prototype of the async drop glue generation for some simple types. Async drop glue is intended to behave very similar to the regular drop glue except for being asynchronous. Currently it does not execute synchronous drops but only calls user implementations of `AsyncDrop::async_drop` associative function and awaits the returned future. It is not complete as it only recurses into arrays, slices, tuples, and structs and does not have same sensible restrictions as the old `Drop` trait implementation like having the same bounds as the type definition, while code assumes their existence (requires a future work).

This current design uses a workaround as it does not create any custom async destructor state machine types for ADTs, but instead uses types defined in the std library called future combinators (deferred_async_drop, chain, ready_unit).

Also I recommend reading my [explainer](https://zetanumbers.github.io/book/async-drop-design.html).

This is a part of the [MCP: Low level components for async drop](https://github.com/rust-lang/compiler-team/issues/727) work.

Feature completeness:

 - [x] `AsyncDrop` trait
 - [ ] `async_drop_in_place_raw`/async drop glue generation support for
   - [x] Trivially destructible types (integers, bools, floats, string slices, pointers, references, etc.)
   - [x] Arrays and slices (array pointer is unsized into slice pointer)
   - [x] ADTs (enums, structs, unions)
   - [x] tuple-like types (tuples, closures)
   - [ ] Dynamic types (`dyn Trait`, see explainer's [proposed design](https://github.com/zetanumbers/posts/blob/main/async-drop-design.md#async-drop-glue-for-dyn-trait))
   - [ ] coroutines (https://github.com/rust-lang/rust/pull/123948)
 - [x] Async drop glue includes sync drop glue code
 - [x] Cleanup branch generation for `async_drop_in_place_raw`
 - [ ] Union rejects non-trivially async destructible fields
 - [ ] `AsyncDrop` implementation requires same bounds as type definition
 - [ ] Skip trivially destructible fields (optimization)
 - [ ] New [`TyKind::AdtAsyncDestructor`](https://github.com/zetanumbers/posts/blob/main/async-drop-design.md#adt-async-destructor-types) and get rid of combinators
 - [ ] [Synchronously undroppable types](https://github.com/zetanumbers/posts/blob/main/async-drop-design.md#exclusively-async-drop)
 - [ ] Automatic async drop at the end of the scope in async context
2024-04-23 02:10:23 +00:00
bors 9cf10bcf5b Auto merge of #124271 - GuillaumeGomez:rollup-7st9wd7, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #115913 (checked_ilog: improve performance)
 - #124178 ([cleanup] [llvm backend] Prevent creating the same `Instance::mono` multiple times)
 - #124183 (Stop taking `ParamTy`/`ParamConst`/`EarlyParamRegion`/`AliasTy` by ref)
 - #124217 (coverage: Prepare for improved branch coverage)
 - #124230 (Stabilize generic `NonZero`.)
 - #124252 (Improve ICE message for forbidden dep-graph reads.)
 - #124268 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-23 00:05:31 +00:00
bors 25087e02b3 Auto merge of #124270 - RalfJung:miri-libstd-win, r=onur-ozkan
miri libstd tests: test windows-msvc instead of windows-gnu

This avoids https://github.com/rust-lang/rust/issues/123583. MSVC is the more widely used target anyway AFAIK, so probably makes more sense to cover that.
2024-04-22 22:01:36 +00:00
Guillaume Gomez 000d0f9116
Rollup merge of #124268 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

41 commits in 3131aa4642c627a24f523c82566b94a7d920f68c..d207d894cc5e1d496ab99beeacd1a420e5d4d238
2024-04-19 19:48:19 UTC to 2024-04-08 19:34:07 UTC

- Ch. 2: intentionally use `{}` at first (rust-lang/book#3898)
- Inline fmt lints for `redirects/` (rust-lang/book#3897)
- ch12-03: `expect` is not used multitude times by this chapter (rust-lang/book#3287)
- Inline format args to `tools/src` (rust-lang/book#3896)
- Improve awkward phrasing around the kinds of closures (rust-lang/book#3290)
- Ch. 14: clarify workspace dependency reuse (rust-lang/book#3890)
- Edit on line no. 153. Replaced fn add_to_waitlist with fn eat_at_restaurant.  (rust-lang/book#3281)
- Ch. 2: less ambiguity about numbers (rust-lang/book#3895)
- Clarified first slices paragraph (rust-lang/book#3363)
- Inline all format arguments (rust-lang/book#3385)
- Use v1.58 captured ident formatting in examples (rust-lang/book#3048)
- Revert "ch18-03: Guarded match arm exhaustivness clarification" (rust-lang/book#3894)
- Ch. 18: further clarify about irrefutable patterns (rust-lang/book#3893)
- ch18-02: Minor corrections (rust-lang/book#3381)
- Make style of listings 9-7 and 9-8 consistent with 9-6 (rust-lang/book#3217)
- ch18-03: Guarded match arm exhaustivness clarification (rust-lang/book#3397)
- ch11-03: Unnecessary import removal (rust-lang/book#3284)
- Update ch20-01-single-threaded.md (rust-lang/book#3394)
- In Appendix D, adds hyperlink to Appendix E (rust-lang/book#3418)
- Chapter 13-03 fixed Iterator 'type' to 'trait' (rust-lang/book#3433)
- Fix the expected substring in ch11-01 (rust-lang/book#3534)
- Ch. 17: clarify 'in order to compile' (rust-lang/book#3892)
- Revert "Chapter 15-05: Fix incorrect interpretation of compiler error" (rust-lang/book#3891)
- Chapter 15-05: Fix incorrect interpretation of compiler error (rust-lang/book#3501)
- Remove direction to authenticate with `cargo login {API token}` (rust-lang/book#3506)
- Update syn dependencies in Chapter 19 to 2.0 (rust-lang/book#3888)
- Chapter 3: Clarify `return` vs. `break`. (rust-lang/book#3889)
- Fix "`Display` type" to "`Display` trait" in ch19-03 (rust-lang/book#3835)
- Update listings in ch 11-01 to reflect current output from cargo new (rust-lang/book#3533)
- Fix "`test` module" to "`tests` module" in ch11-03 (rust-lang/book#3579)
- Ch. 2: fix wording about `cargo update` (rust-lang/book#3882)
- Remove hebrew niqqud in 8-14 String::from example (rust-lang/book#3648)
- Ch. 16: fix a grammar issue (rust-lang/book#3881)
- Update MSVC instructions (rust-lang/book#3616)
- Replace RLS with rust-analyzer in ch00 (rust-lang/book#3546)
- Fix em dashes (rust-lang/book#3570)
- Revert #3711 (rust-lang/book#3880)
- Procedure Macro: Update dependencies  (rust-lang/book#3631)
- Parity with rustup's help (rust-lang/book#3642)
- Fix confusing sentence (rust-lang/book#3877)
- Ch. 7: add a note about the need for `pub` in one more place (rust-lang/book#3879)

## rust-lang/edition-guide

2 commits in eb3eb80e106d03250c1fb7c5666b1c8c59672862..0c68e90acaae5a611f8f5098a3c2980de9845ab2
2024-04-16 21:23:55 UTC to 2024-04-15 16:05:32 UTC

- Document RustcEncodable/RustcDecodable (rust-lang/edition-guide#298)
- Flesh out detail behind disallowing refs to static mut (rust-lang/edition-guide#299)

## rust-lang/reference

5 commits in 55694913b1301cc809f9bf4a1ad1b3d6920efbd9..5854fcc286557ad3ab34d325073d11d8118096b6
2024-04-21 13:47:07 UTC to 2024-04-15 16:12:40 UTC

- Stabilize Wasm target features that are in phase 4 and 5 (rust-lang/reference#1420)
- Expand and clarify primitive alignment (rust-lang/reference#1493)
- Update clone reference to include closures (rust-lang/reference#1492)
- Document how `non_exhaustive` interacts with tuple and unit-like structs. (rust-lang/reference#1491)
- Fix link to RISC-V Zkt spec; it was pointing to Zkr (rust-lang/reference#1490)

## rust-lang/rustc-dev-guide

4 commits in b77a34bd46399687b4ce6a17198e9f316c988794..07425fed36b00e60341c5e29e28d37d40cbd4451
2024-04-13 15:16:44 UTC to 2024-04-08 19:00:54 UTC

- Add a note about checks with multiple revisions (rust-lang/rustc-dev-guide#1963)
- compiletest: clarify that headers must be one header per line (rust-lang/rustc-dev-guide#1962)
- chore: fix some typos in conments (rust-lang/rustc-dev-guide#1961)
- compiletest: specify which special env var and which particular CI job (rust-lang/rustc-dev-guide#1960)
2024-04-22 20:26:01 +02:00
Guillaume Gomez a60ccc1876
Rollup merge of #124252 - michaelwoerister:better-forbidden-read-ice, r=oli-obk
Improve ICE message for forbidden dep-graph reads.

The new message mentions the main context that the ICE might occur in and it mentions the query/dep-node that is being read.

cc https://github.com/rust-lang/rust/pull/123781, where this would have been helpful.
2024-04-22 20:26:00 +02:00
Guillaume Gomez 6a326d889a
Rollup merge of #124230 - reitermarkus:generic-nonzero-stable, r=dtolnay
Stabilize generic `NonZero`.

Tracking issue: https://github.com/rust-lang/rust/issues/120257

r? `@dtolnay`
2024-04-22 20:26:00 +02:00
Guillaume Gomez 17c28799f3
Rollup merge of #124217 - Zalathar:pre-branch, r=oli-obk
coverage: Prepare for improved branch coverage

When trying to rebase my new branch coverage work (including #124154) on top of the introduction of MC/DC coverage (#123409), I found it a lot harder than anticipated. With the benefit of hindsight, the branch coverage code and MC/DC code have become more interdependent than I'm happy with.

This PR therefore disentangles them a bit, so that it will be easier for both areas of code to evolve independently without interference.

---

This PR also includes a few extra branch coverage tests that I had sitting around from my current branch coverage work. They mostly just demonstrate that certain language constructs listed in #124118 currently don't have branch coverage support.

``@rustbot`` label +A-code-coverage
2024-04-22 20:25:59 +02:00
Guillaume Gomez e984447405
Rollup merge of #124183 - compiler-errors:unnecessary-by-ref, r=oli-obk
Stop taking `ParamTy`/`ParamConst`/`EarlyParamRegion`/`AliasTy` by ref

It's unnecessary and is annoying when we have it by value.
2024-04-22 20:25:59 +02:00
Guillaume Gomez 1a12ec41e9
Rollup merge of #124178 - GuillaumeGomez:llvm-backend, r=oli-obk
[cleanup] [llvm backend] Prevent creating the same `Instance::mono` multiple times

Just a little thing I came across while going through the code.

r? ```@oli-obk```
2024-04-22 20:25:58 +02:00
Guillaume Gomez 206e0df78d
Rollup merge of #115913 - FedericoStra:checked_ilog, r=the8472
checked_ilog: improve performance

Addresses #115874.

(This PR replicates the original #115875, which I accidentally closed by deleting my forked repository...)
2024-04-22 20:25:58 +02:00
Ralf Jung 8d5c47f17f miri libstd tests: test windows-msvc instead of windows-gnu 2024-04-22 19:50:09 +02:00
rustbot 9ed562f9e7 Update books 2024-04-22 13:00:54 -04:00
Markus Reiter 33e68aadc9
Stabilize generic NonZero. 2024-04-22 18:48:47 +02:00
Michael Woerister 6146a51f17 Add more context to the forbidden dep-graph read ICE error message. 2024-04-22 14:54:28 +02:00
Daria Sukhonina 67980dd6fb
Fix typo in the has_surface_drop's doc comment
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2024-04-22 15:44:01 +03:00
Daria Sukhonina a9c7465997 Fix copy-paste typo in the comment within consider_builtin_async_destruct_candidate 2024-04-22 15:42:07 +03:00
Daria Sukhonina 0881e3e531 Exhaustivelly match TyKind in consider_builtin_async_destruct_candidate 2024-04-22 15:41:08 +03:00
bors 7f2fc33da6 Auto merge of #115120 - icedrocket:ignore-strip-on-msvc, r=michaelwoerister
Ignore `-C strip` on MSVC

tl;dr - Define `-Cstrip` to only ever affect the binary; no other build artifacts.

This is necessary to improve cross-platform behavior consistency: if someone wanted debug information to be contained only in separate files on all platforms, they would set `-Cstrip=symbols` and `-Csplit-debuginfo=packed`, but this would result in no PDB files on MSVC.

Resolves #114215
2024-04-22 12:05:39 +00:00
Zalathar 2b6adb06fb coverage: Separate branch pairs from other mapping kinds
This clears the way for larger changes to how branches are handled by the
coverage instrumentor, in order to support branch coverage for more language
constructs.
2024-04-22 21:55:34 +10:00
Zalathar b5a22be6a3 coverage: Move some helper code into BranchInfoBuilder 2024-04-22 21:55:33 +10:00
Zalathar 97bf553682 coverage: Detach MC/DC branch spans from regular branch spans
MC/DC's reliance on the existing branch coverage types is making it much harder
to improve branch coverage.
2024-04-22 21:55:33 +10:00
Zalathar a892c2387e coverage: Add a mir-opt test for branch coverage of match arms 2024-04-22 21:55:33 +10:00
Zalathar da37b14121 coverage: Move mir-opt coverage tests into a subdirectory 2024-04-22 21:55:33 +10:00
Zalathar 3de87feba2 coverage: Branch coverage tests for match arms 2024-04-22 21:55:33 +10:00
Zalathar 7f432dfb23 coverage: Branch coverage test for if-let and let-chains 2024-04-22 21:55:33 +10:00
Zalathar 4f7a47798e coverage: Branch coverage test for let-else 2024-04-22 21:55:33 +10:00
Michael Woerister c373ec07c4 Improve ICE message for forbidden dep-graph reads. 2024-04-22 12:11:07 +02:00
bors 290d792411 Auto merge of #124250 - matthiaskrgr:rollup-b8tqsup, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #124240 (add a couple tests for fixed ICEs.)
 - #124245 (bootstrap: Promote some build_steps comments to docs)
 - #124246 (Add comma at one place in `abs()` documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-22 10:01:27 +00:00
Matthias Krüger c597ccf3f1
Rollup merge of #124246 - gurry:add-comma-in-abs-doc, r=jhpratt
Add comma at one place in `abs()` documentation

As suggested  by ``@RalfJung`` here: https://github.com/rust-lang/rust/pull/124184#discussion_r1573670533
2024-04-22 10:02:56 +02:00
Matthias Krüger e4e660ef5d
Rollup merge of #124245 - workingjubilee:bootstrap-some-doc-comments, r=onur-ozkan
bootstrap: Promote some build_steps comments to docs

No new content, just makes some comments readable when viewing the docs with `--document-private-items`.
2024-04-22 10:02:55 +02:00
Matthias Krüger 3cd56f3bda
Rollup merge of #124240 - matthiaskrgr:tests_sunday, r=compiler-errors
add a couple tests for fixed ICEs.

Fixes https://github.com/rust-lang/rust/issues/121413
Fixes https://github.com/rust-lang/rust/issues/121463
Fixes https://github.com/rust-lang/rust/issues/114463
2024-04-22 10:02:55 +02:00
bors b3e117044c Auto merge of #124236 - matthiaskrgr:n-ice, r=jieyouxu
crashes: add a couple more ICE tests
2024-04-22 07:57:04 +00:00
bors 32885838c0 Auto merge of #124112 - beetrees:incremental-os-str, r=Nadrieril
Fix ICE when there is a non-Unicode entry in the incremental crate directory

Fix the ICE that occurs when there is a non-Unicode entry in the incremental crate directory by replacing uses of `to_string_lossy` + `assert_no_characters_lost` with `to_str`. The added test would cause the compiler to ICE before this PR.
2024-04-22 04:00:58 +00:00
Gurinder Singh f31e4aef0b Add comma at one place in abs() documentation 2024-04-22 08:16:47 +05:30
bors eb70af2e03 Auto merge of #124244 - saethlin:stdarch, r=workingjubilee
Update stdarch submodule

Most importantly, this pulls in https://github.com/rust-lang/stdarch/pull/1567 which is part of https://github.com/rust-lang/rust/pull/124050
2024-04-22 01:56:40 +00:00
Jubilee Young 9470e05550 bootstrap: Promote some build_steps comments to docs 2024-04-21 18:55:53 -07:00
Ben Kimock 9989d009c4 Update stdarch submodule 2024-04-21 21:35:17 -04:00
bors fb898629a2 Auto merge of #124241 - matthiaskrgr:rollup-xhu90xr, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #123840 (Add an intrinsic for `ptr::from_raw_parts(_mut)`)
 - #124224 (cleanup: unnecessary clone during lower generics args)
 - #124229 (Add gnullvm targets to manifest)
 - #124231 (remove from reviewers)
 - #124235 (Move some tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-21 21:08:03 +00:00
Matthias Krüger a42adf2f95 add test for ICE caused by using feature(generic_const_exprs) #114463
Fixes #114463
2024-04-21 22:00:38 +02:00
Matthias Krüger 751f662b70 add test for ice #121463
Fixes #121463
2024-04-21 22:00:38 +02:00
Matthias Krüger 28f60ff9a4 add test for #121413
Fixes #121413
2024-04-21 22:00:38 +02:00
Matthias Krüger 3315bf961d
Rollup merge of #124235 - c410-f3r:tests98765, r=jieyouxu
Move some tests

r? `@petrochenkov`
2024-04-21 21:56:34 +02:00
Matthias Krüger f277f3d653
Rollup merge of #124231 - BoxyUwU:dereview, r=Mark-Simulacrum
remove from reviewers

not gonna be around for a few weeks
2024-04-21 21:56:33 +02:00
Matthias Krüger e96ed6d35d
Rollup merge of #124229 - mati865:add-gnullvm-targets-to-manifest, r=Mark-Simulacrum
Add gnullvm targets to manifest

Fixes an oversight from https://github.com/rust-lang/rust/pull/121712
2024-04-21 21:56:33 +02:00
Matthias Krüger cd92422180
Rollup merge of #124224 - bvanjoi:cleanup, r=fmease
cleanup: unnecessary clone during lower generics args
2024-04-21 21:56:32 +02:00
Matthias Krüger 67872e740e
Rollup merge of #123840 - scottmcm:aggregate-kind-rawptr, r=cjgillot
Add an intrinsic for `ptr::from_raw_parts(_mut)`

Fixes #123174
cc `@CAD97` `@saethlin`
r? `@cjgillot`

As suggested in https://github.com/rust-lang/rust/pull/123190#issuecomment-2028717967, this adds a new `AggregateKind::RawPtr` for creating a pointer from its data pointer and its metadata.

That means that `slice::from_raw_parts` and friends no longer need to hard-code pointer layout into `libcore`, and because it no longer does union hacks the MIR is shorter and more amenable to optimizations.
2024-04-21 21:56:32 +02:00
bors 1b3fba066c Auto merge of #124203 - lukas-code:delete-deleting-caches, r=compiler-errors
fix normalizing in different `ParamEnv`s with the same `InferCtxt`

This PR changes the key of the projection cache from just `AliasTy` to `(AliasTy, ParamEnv)` to allow normalizing in different `ParamEnv`s without resetting caches. Previously, normalizing the same alias in different param envs would always reuse the cached result from the first normalization, which is incorrect if the projection clauses in the param env have changed.

Fixing this bug allows us to get rid of `InferCtxt::clear_caches`, which was only used by the `AutoTraitFinder`, because it requires normalizing in different param envs.

r? `@fmease`
2024-04-21 19:05:08 +00:00
Matthias Krüger 6774801563 crashes: add a couple more ICE tests 2024-04-21 21:04:32 +02:00
Caio 3aaa3941fd Move some tests 2024-04-21 15:43:43 -03:00