Commit Graph

170780 Commits

Author SHA1 Message Date
David Wood
dc90d1d987 errors: remove diagnostic message ctors
Now that typed identifiers are used in both derives, constructors for
the `DiagnosticMessage` and `SubdiagnosticMessage` types are not
required.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-24 09:08:25 +01:00
David Wood
abd3467d47 macros: use typed identifiers in subdiag derive
As in the diagnostic derive, using typed identifiers in the
subdiagnostic derive improves the diagnostics of using the subdiagnostic
derive as Fluent messages will be confirmed to exist at compile-time.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-24 09:08:25 +01:00
David Wood
99bc979403 macros: use typed identifiers in diag derive
Using typed identifiers instead of strings with the Fluent identifier
enables the diagnostic derive to benefit from the compile-time
validation that comes with typed identifiers - use of a non-existent
Fluent identifier will not compile.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-24 09:08:25 +01:00
bors
fc96600bf6 Auto merge of #98395 - arlosi:update-cargo, r=ehuss
Update cargo

8 commits in 03a849043e25104e8b7ad0d4a96c525787b69379..a5e08c4703f202e30cdaf80ca3e7c00baa59c496
2022-06-20 14:47:36 +0000 to 2022-06-23 20:12:03 +0000
- Fix tests due to change in dead_code diagnostic. (rust-lang/cargo#10785)
- Stabilize config-cli (rust-lang/cargo#10755)
- Restrict duplicate deps warning only to published packages (rust-lang/cargo#10767)
- Use fingerprint_hash when computing fingerprints for custom targets (rust-lang/cargo#10746)
- Add preloading for workspace packages in `resolve_with_previous` (rust-lang/cargo#10761)
- capitalise, for consistency (rust-lang/cargo#10772)
- remove unused dependency from benchsuite (rust-lang/cargo#10774)
- docs(contrib): Add documentation for ui tests (rust-lang/cargo#10758)
2022-06-24 04:37:14 +00:00
bors
e605a88441 Auto merge of #98438 - compiler-errors:rollup-fudubjn, r=compiler-errors
Rollup of 16 pull requests

Successful merges:

 - #96173 (Fix documentation for  `with_capacity` and `reserve` families of methods)
 - #98184 (Give name if anonymous region appears in impl signature)
 - #98259 (Greatly improve error reporting for futures and generators in `note_obligation_cause_code`)
 - #98269 (Provide a `PathSegment.res` in more cases)
 - #98283 (Point at private fields in struct literal)
 - #98305 (prohibit_generics: don't alloc error string if no error emitted)
 - #98310 (rustdoc: optimize loading of source sidebar)
 - #98353 (Migrate two diagnostics from the `rustc_builtin_macros` crate)
 - #98355 (Update no_default_libraries handling for emscripten target)
 - #98364 (clarify Arc::clone overflow check comment)
 - #98365 (Address review comments from #98259)
 - #98388 (implement `iter_projections` function on `PlaceRef`)
 - #98390 (Fixes handling of keywords in rustdoc json output)
 - #98409 (triagebot.toml: Allow applying nominated labels)
 - #98410 (Update books)
 - #98422 (Update browser-ui-test version to 0.9.6)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-24 02:08:52 +00:00
Arlo Siemsen
7926ee4d0e Update cargo
8 commits in 03a849043e25104e8b7ad0d4a96c525787b69379..a5e08c4703f202e30cdaf80ca3e7c00baa59c496
2022-06-20 14:47:36 +0000 to 2022-06-23 20:12:03 +0000
- Fix tests due to change in dead_code diagnostic. (rust-lang/cargo#10785)
- Stabilize config-cli (rust-lang/cargo#10755)
- Restrict duplicate deps warning only to published packages (rust-lang/cargo#10767)
- Use fingerprint_hash when computing fingerprints for custom targets (rust-lang/cargo#10746)
- Add preloading for workspace packages in `resolve_with_previous` (rust-lang/cargo#10761)
- capitalise, for consistency (rust-lang/cargo#10772)
- remove unused dependency from benchsuite (rust-lang/cargo#10774)
- docs(contrib): Add documentation for ui tests (rust-lang/cargo#10758)
2022-06-23 15:21:35 -07:00
Michael Goulet
c9b1674987
Rollup merge of #98422 - GuillaumeGomez:browser-ui-test-update, r=Dylan-DPC
Update browser-ui-test version to 0.9.6

This update provides a better error message when chromium crashes.

cc ``@jsha``
r? ``@Dylan-DPC``
2022-06-23 14:39:19 -07:00
Michael Goulet
28b92bae2e
Rollup merge of #98410 - ehuss:update-books, r=ehuss
Update books

## reference

6 commits in 683bfe5cd64d589c6a1645312ab5f93b6385ccbb..9fce337a55ee4a4629205f6094656195cecad231
2022-05-27 11:54:20 -0700 to 2022-06-22 13:59:28 -0700
- Remove outdated restriction on recursive types (rust-lang/reference#1231)
- Clarify "string continue" for (byte) string literals (rust-lang/reference#1042)
- Add a note to the turbofish section about impl Trait (rust-lang/reference#1212)
- modify confusing variance example (rust-lang/reference#1224)
- Add stable references of `macro_metavar_expr` (rust-lang/reference#1192)
- Document native library modifier `bundle` (rust-lang/reference#1210)

## book

33 commits in 396fdb69de7fb18f24b15c7ad13491b1c1fa7231..efbafdba3618487fbc9305318fcab9775132ac15
2022-06-08 10:02:35 -0400 to 2022-06-19 21:06:50 -0400
- Propagate tech review edits to appendices to src
- Tech review comments and further edits to the appendices
- Duplicate fragment "mutation and borrowing"
- Propagate ch20 tech review edits to src
- Edits in response to tech review of chapter 20
- Comments from tech review on chapter 20
- Propagate ch7 tech review edits to src
- Responding to tech review of ch7
- Tech review comments on ch7
- Propagate ch19 tech review edits to src
- Responses to tech review of ch19
- Tech review comments on ch 19
- Update ch03-01-variables-and-mutability.md
- Add more explanation to CONTRIBUTING about the nostarch directory
- Duplicate sentence
- Missing period
- Regenerate ch09-02 error messages
- Change some print formatting styles in ch18
- Propagate tech review ch18 edits to src
- Responses to tech review comments of chapter 18
- Chapter 18 from tech review
- Snapshot of introduction for nostarch
- Propagate edits of ch1 to src
- Edits to edits to chapter 1
- Edits from nostarch for chapter 1
- Update Visual Studio instructions for 2022
- bugfix/typo-ch10-01 Fix typo in chapter ch10-01
- Tweak rustfmt slightly for these listings
- Propagate edits to ch13 to src
- Responses to nostarch edits to ch13
- Edits to ch13 from nostarch
- Apply complex Clippy recommendation
- Apply Clippy recommendations: `cargo clippy --fix`

## rust-by-example

4 commits in dbb7e5e2345ee26199ffba218156b6009016a20c..1095df2a5850f2d345fad43a30633133365875ba
2022-06-02 16:30:51 -0300 to 2022-06-18 21:47:12 -0300
- Add example for `array.get()` (rust-lang/rust-by-example#1554)
- Example improvements (rust-lang/rust-by-example#1552)
- Fix for a set of typos (rust-lang/rust-by-example#1551)
- Make guard examples clearer around `_` (rust-lang/rust-by-example#1550)

## rustc-dev-guide

11 commits in 6e4d6435db89bcc027b1bba9742e4f59666f5412..048d925f0a955aac601c4160c0e7f05771bcf63b
2022-06-08 08:06:32 +0900 to 2022-06-21 22:25:34 +0900
- not obvious what Ex is, so rather get rid (rust-lang/rustc-dev-guide#1372)
- small improves (rust-lang/rustc-dev-guide#1371)
- make clear that other versions can work (rust-lang/rustc-dev-guide#1373)
- Fix small `src/diagnostics.md` typo (rust-lang/rustc-dev-guide#1370)
- Add an "is" and rearange "We next" to "Next, we" (rust-lang/rustc-dev-guide#1369)
- diagnostics: add translation documentation
- diagnostics: line wrapping/heading changes
- later -&gt; latter
- Remove mention of -Zborrowck=mir with Polonius. (rust-lang/rustc-dev-guide#1367)
- Remove nll compare mode. (rust-lang/rustc-dev-guide#1366)
- add section on user types (rust-lang/rustc-dev-guide#1359)

## embedded-book

1 commits in cbb494f96da3268c2925bdadc65ca83d42f2d4ef..e17dcef5e96346ee3d7fa56820ddc7e5c39636bc
2022-05-26 06:58:43 +0000 to 2022-06-19 10:28:00 +0000
- Fix a typo  (rust-embedded/book#319)
2022-06-23 14:39:18 -07:00
Michael Goulet
8db945f012
Rollup merge of #98409 - joshtriplett:triagebot-nominated, r=Mark-Simulacrum
triagebot.toml: Allow applying nominated labels
2022-06-23 14:39:17 -07:00
Michael Goulet
56209834a6
Rollup merge of #98390 - GuillaumeGomez:keyword-rustdoc-json, r=notriddle
Fixes handling of keywords in rustdoc json output

Fixes #98002.

Instead of panicking, we just filter them out.

cc ```@matthiaskrgr```
r? ```@notriddle```
2022-06-23 14:39:16 -07:00
Michael Goulet
aafddd2a8a
Rollup merge of #98388 - rosehuds:master, r=davidtwco
implement `iter_projections` function on `PlaceRef`

this makes the api more flexible. the original function now calls the PlaceRef
version to avoid duplicating the code.
2022-06-23 14:39:15 -07:00
Michael Goulet
667a54623d
Rollup merge of #98365 - jyn514:improve-obligation-errors-review-comments, r=eholk
Address review comments from #98259

It got approved so fast I didn't have time to make changes xD

r? ``@eholk``
2022-06-23 14:39:14 -07:00
Michael Goulet
e749ba2061
Rollup merge of #98364 - RalfJung:arc-clone, r=Mark-Simulacrum
clarify Arc::clone overflow check comment

I had to read this twice to realize that this is explaining that the code is technically unsound, so move that into a dedicated paragraph and make the wording a bit more explicit.
2022-06-23 14:39:13 -07:00
Michael Goulet
cc45ad50f8
Rollup merge of #98355 - hoodmane:emscripten-no-default, r=petrochenkov
Update no_default_libraries handling for emscripten target

```@sbc100``` says:

> `-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[]` is almost certainly wrong/out-of-date.   This setting defaults to the empty list anyway these days so its redundant.  Also we now support `-nodefaultlibs` so you can use that, as with other toolchains.

https://github.com/rust-lang/rust/issues/98303#issuecomment-1162163684
2022-06-23 14:39:12 -07:00
Michael Goulet
21085e9120
Rollup merge of #98353 - beetrees:builtin-macros-cfg-diag, r=davidtwco
Migrate two diagnostics from the `rustc_builtin_macros` crate

Migrate two diagnostics to use the struct derive and be translatable.

r? ```@davidtwco```
2022-06-23 14:39:11 -07:00
Michael Goulet
cc95225fee
Rollup merge of #98310 - jsha:defer-source-sidebar, r=GuillaumeGomez
rustdoc: optimize loading of source sidebar

The source sidebar has a setting to remember whether it should be open or
closed. Previously, this setting was handled in source-script.js, which
is loaded with `defer`, meaning it is often run after the document is rendered.
Since CSS renders the source sidebar as closed by default, changing this
after the initial render results in a relayout.

Instead, handle the setting in storage.js, which is the first script to load
and is the only script that blocks render. This avoids a relayout and means
navigating between files with the sidebar open is faster.

Demo: https://rustdoc.crud.net/jsha/defer-source-sidebar/src/alloc/ffi/c_str.rs.html

r? ````@GuillaumeGomez````
2022-06-23 14:39:10 -07:00
Michael Goulet
0ed2feca61
Rollup merge of #98305 - klensy:no-err-alloc, r=compiler-errors
prohibit_generics: don't alloc error string if no error emitted

Noticed unreaded allocs in DHAT.
2022-06-23 14:39:09 -07:00
Michael Goulet
41cb5e9439
Rollup merge of #98283 - TaKO8Ki:point-at-private-fields-in-struct-literal, r=compiler-errors
Point at private fields in struct literal

closes #95872
2022-06-23 14:39:08 -07:00
Michael Goulet
3b68700d0c
Rollup merge of #98269 - compiler-errors:provide-more-segment-res, r=petrochenkov
Provide a `PathSegment.res` in more cases

I find that in many cases, the `res` associated with a `PathSegment` is `Res::Err` even though the path was fully resolved. A few diagnostics use this `res` and their error messages suffer because of the lack of resolved segment.

This fixes it a bit, but it's obviously not complete and I'm not exactly sure if it's correct.
2022-06-23 14:39:07 -07:00
Michael Goulet
413e350f87
Rollup merge of #98259 - jyn514:improve-obligation-errors, r=estebank
Greatly improve error reporting for futures and generators in `note_obligation_cause_code`

Most futures don't go through this code path, because they're caught by
`maybe_note_obligation_cause_for_async_await`. But all generators do,
and `maybe_note` is imperfect and doesn't catch all futures. Improve the error message for those it misses.

At some point, we may want to consider unifying this with the code for `maybe_note_async_await`,
so that `async_await` notes all parent constraints, and `note_obligation` can point to yield points.
But both functions are quite complicated, and it's not clear to me how to combine them;
this seems like a good incremental improvement.

Helps with https://github.com/rust-lang/rust/issues/97332.

r? ``@estebank`` cc ``@eholk`` ``@compiler-errors``
2022-06-23 14:39:06 -07:00
Michael Goulet
49bcc70574
Rollup merge of #98184 - compiler-errors:elided-lifetime-in-impl-nll, r=cjgillot
Give name if anonymous region appears in impl signature

Fixes #98170

We probably should remove the two unwraps in [`report_general_error`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_borrowck/diagnostics/region_errors.rs.html#683-685), but I have no idea what to provide if those regions are missing, so I've kept those in. Let me know if I should try harder to remove those.
2022-06-23 14:39:06 -07:00
Michael Goulet
262382ff37
Rollup merge of #96173 - jmaargh:jmaargh/with-capacity-doc-fix, r=Dylan-DPC
Fix documentation for  `with_capacity` and `reserve` families of methods

Fixes #95614

Documentation for the following methods
 - `with_capacity`
 - `with_capacity_in`
 - `with_capacity_and_hasher`
 - `reserve`
 - `reserve_exact`
 - `try_reserve`
 - `try_reserve_exact`

was inconsistent and often not entirely correct where they existed on the following types
- `Vec`
- `VecDeque`
- `String`
- `OsString`
- `PathBuf`
- `BinaryHeap`
- `HashSet`
- `HashMap`
- `BufWriter`
- `LineWriter`

since the allocator is allowed to allocate more than the requested capacity in all such cases, and will frequently "allocate" much more in the case of zero-sized types (I also checked `BufReader`, but there the docs appear to be accurate as it appears to actually allocate the exact capacity).

Some effort was made to make the documentation more consistent between types as well.
2022-06-23 14:39:05 -07:00
bors
43347397f7 Auto merge of #98423 - ehuss:ci-submodule-no-archive, r=compiler-errors
Temporarily disable submodule archive downloads.

The `llvm-project` `/archive/` download has been timing out with a 504 error since yesterday. This changes it so that it uses a normal submodule clone, but also uses `--depth 1` since GitHub now supports `allowReachableSHA1InWant` which allows for fetching a specific revision. That should be reasonably fast (but not as fast as an archive download) to unstick CI.
2022-06-23 18:00:16 +00:00
Eric Huss
ebfde3cca4 Temporarily disable submodule archive downloads. 2022-06-23 10:44:36 -07:00
Guillaume Gomez
137d3c7067 Update browser-ui-test version to 0.9.6
This update provides a better error message when chromium crashes
2022-06-23 13:04:29 +02:00
Hood Chatham
b96ae9b204 Set no_default_libraries: false in wasm32_emscripten target 2022-06-22 17:43:10 -07:00
Eric Huss
24e0c44eb6 Update books 2022-06-22 16:12:32 -07:00
Josh Triplett
5cf5a5236f triagebot.toml: Sort and wrap the list of allowed labels 2022-06-22 14:02:48 -07:00
Josh Triplett
96cc0c691a triagebot.toml: Allow applying nominated labels
This seems likely to help more than it would hurt; let's see how it
goes.
2022-06-22 14:01:31 -07:00
Guillaume Gomez
75ad2f7a76 Add test for keywords in rustdoc JSON output 2022-06-22 16:26:22 +02:00
Guillaume Gomez
8e40d93647 Filter out keyword items in rustdoc JSON output 2022-06-22 16:26:04 +02:00
Rose Hudson
53481a5a8f implement iter_projections function on PlaceRef
this makes the api more flexible. the original function now calls the PlaceRef
version to avoid duplicating the code.
2022-06-22 14:06:13 +01:00
bors
10f4ce324b Auto merge of #98279 - cjgillot:all-fresh-nofn, r=petrochenkov
Create elided lifetime parameters for function-like types

Split from https://github.com/rust-lang/rust/pull/97720

This PR refactor lifetime generic parameters in bare function types and parenthesized traits to introduce the additional required lifetimes as fresh parameters in a `for<>` bound.

This PR does the same to lifetimes appearing in closure signatures, and as-if introducing `for<>` bounds on closures (without the associated change in semantics).

r? `@petrochenkov`
2022-06-22 10:48:58 +00:00
bors
89a0783f1c Auto merge of #98375 - JohnTitor:rollup-e5c6rgo, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #95446 (update CPU usage script)
 - #96768 (Use futex based thread parker on Fuchsia.)
 - #97454 (Add release notes for 1.62)
 - #97516 (clarify how Rust atomics correspond to C++ atomics)
 - #97818 (Point at return expression for RPIT-related error)
 - #97895 (Simplify `likely!` and `unlikely!` macro)
 - #98005 (Add some tests for impossible bounds)
 - #98226 (Document unstable `--extern` options)
 - #98356 (Add missing period)
 - #98363 (remove use of &Alloc in btree tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-22 08:07:46 +00:00
Yuki Okushi
db64923b80
Rollup merge of #98363 - RalfJung:btree-test-ref-alloc, r=thomcc
remove use of &Alloc in btree tests

I missed these in https://github.com/rust-lang/rust/pull/98233.

r? ``@thomcc``
2022-06-22 15:16:17 +09:00
Yuki Okushi
0cac62df1c
Rollup merge of #98356 - lucasthormann:patch-1, r=Mark-Simulacrum
Add missing period
2022-06-22 15:16:16 +09:00
Yuki Okushi
35597182ab
Rollup merge of #98226 - ChrisDenton:doc-extern-options, r=ehuss
Document unstable `--extern` options

These are needed for Cargo's `build-std` feature and for anyone who wanted to do a similar thing outside of Cargo.
2022-06-22 15:16:15 +09:00
Yuki Okushi
400751d40b
Rollup merge of #98005 - compiler-errors:impossible-bounds, r=Mark-Simulacrum
Add some tests for impossible bounds

Adds test for #93008
Adds test for #94680
Closes #94999
Closes #95640
2022-06-22 15:16:14 +09:00
Yuki Okushi
8f861dae7a
Rollup merge of #97895 - nbdd0121:unlikely, r=estebank
Simplify `likely!` and `unlikely!` macro

The corresponding intrinsics have long been safe-to-call, so the unsafe block is no longer needed.
2022-06-22 15:16:13 +09:00
Yuki Okushi
dfc6d7ac76
Rollup merge of #97818 - compiler-errors:rpit-error-spanned, r=oli-obk
Point at return expression for RPIT-related error

Certainly this needs some diagnostic refining, but I wanted to show that it was possible first and foremost. Not sure if this is the right approach. Open to feedback.

Fixes #80583
2022-06-22 15:16:12 +09:00
Yuki Okushi
25b84491f7
Rollup merge of #97516 - RalfJung:atomics, r=joshtriplett
clarify how Rust atomics correspond to C++ atomics

``@cbeuw`` noted in https://github.com/rust-lang/miri/pull/1963 that the correspondence between C++ atomics and Rust atomics is not quite as obvious as one might think, since in Rust I can use `get_mut` to treat previously non-atomic data as atomic. However, I think using C++20 `atomic_ref`, we can establish a suitable relation between the two -- or do you see problems with that ``@cbeuw?`` (I recall you said there was some issue, but it was deep inside that PR and Github makes it impossible to find...)

Cc ``@thomcc;`` not sure whom else to ping for atomic memory model things.
2022-06-22 15:16:11 +09:00
Yuki Okushi
75a2e5dddd
Rollup merge of #97454 - Mark-Simulacrum:relnotes, r=Mark-Simulacrum
Add release notes for 1.62

cc ``@rust-lang/release``

r? ``@pietroalbini``
2022-06-22 15:16:10 +09:00
Yuki Okushi
897745bf67
Rollup merge of #96768 - m-ou-se:futex-fuchsia, r=tmandry
Use futex based thread parker on Fuchsia.
2022-06-22 15:16:09 +09:00
Yuki Okushi
7b442f717e
Rollup merge of #95446 - notseanray:master, r=Mark-Simulacrum
update CPU usage script

I've made slight changes to the CPU usage plot script with updated links from the [ci2 aws instance](https://rust-lang-ci2.s3.amazonaws.com/).
2022-06-22 15:16:08 +09:00
Takayuki Maeda
eb86daa138 add "was" to pluralize macro and use it 2022-06-22 14:56:40 +09:00
Ralf Jung
46b2454bad clarify Arc::clone overflow check comment 2022-06-21 21:14:03 -07:00
Chris Denton
c20e0e1e8e
Document unstable --extern options
Co-Authored-By: Joshua Nelson <github@jyn.dev>
Co-Authored-By: Eric Huss <eric@huss.org>
2022-06-22 04:12:26 +01:00
Takayuki Maeda
f847261478 stop pointing at definitions of missing fields 2022-06-22 12:01:41 +09:00
bors
3d829a0922 Auto merge of #97853 - TaKO8Ki:emit-only-one-note-per-unused-struct-field, r=estebank
Collapse multiple dead code warnings into a single diagnostic

closes #97643
2022-06-22 02:51:55 +00:00
Michael Goulet
e53b2baf29 Add some tests for impossible bounds 2022-06-21 18:40:42 -07:00