]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agoAuto merge of #102302 - nnethercote:more-lexer-improvements, r=matklad
bors [Wed, 28 Sep 2022 08:14:04 +0000 (08:14 +0000)]
Auto merge of #102302 - nnethercote:more-lexer-improvements, r=matklad

More lexer improvements

A follow-up to #99884.

r? `@matklad`

21 months agoAuto merge of #102388 - JohnTitor:rollup-mbyw6fl, r=JohnTitor
bors [Wed, 28 Sep 2022 04:18:19 +0000 (04:18 +0000)]
Auto merge of #102388 - JohnTitor:rollup-mbyw6fl, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #100747 (Add long description and test for E0311)
 - #102232 (Stabilize bench_black_box)
 - #102288 (Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`.)
 - #102338 (Deny associated type bindings within associated type bindings)
 - #102347 (Unescaping cleanups)
 - #102348 (Tweak `FulfillProcessor`.)
 - #102378 (Use already resolved `self_ty` in `confirm_fn_pointer_candidate`)
 - #102380 (rustdoc: remove redundant mobile `.source > .sidebar` CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

21 months agoRollup merge of #102380 - notriddle:notriddle/rustdoc-source-sidebar, r=camelid
Yuki Okushi [Wed, 28 Sep 2022 04:07:20 +0000 (13:07 +0900)]
Rollup merge of #102380 - notriddle:notriddle/rustdoc-source-sidebar, r=camelid

rustdoc: remove redundant mobile `.source > .sidebar` CSS

When the source sidebar and standard sidebar had most of their code merged in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114, the properties `z-index: 11`, `margin: 0`, and `position: fixed` were already being set on the `.sidebar` class, so no need to repeat them.

https://github.com/rust-lang/rust/blob/57ee5cf5a93923dae9c98bffb11545fc3a31368d/src/librustdoc/html/static/css/rustdoc.css#L1742-L1754

21 months agoRollup merge of #102378 - compiler-errors:issue-102289, r=jackh726
Yuki Okushi [Wed, 28 Sep 2022 04:07:20 +0000 (13:07 +0900)]
Rollup merge of #102378 - compiler-errors:issue-102289, r=jackh726

Use already resolved `self_ty` in `confirm_fn_pointer_candidate`

Fixes #102289

21 months agoRollup merge of #102348 - nnethercote:tweak-FulfillProcessor, r=jackh726
Yuki Okushi [Wed, 28 Sep 2022 04:07:19 +0000 (13:07 +0900)]
Rollup merge of #102348 - nnethercote:tweak-FulfillProcessor, r=jackh726

Tweak `FulfillProcessor`.

Avoids some unnecessary references and lifetimes.

r? `@jackh726`

21 months agoRollup merge of #102347 - nnethercote:unescaping-cleanups, r=matklad
Yuki Okushi [Wed, 28 Sep 2022 04:07:18 +0000 (13:07 +0900)]
Rollup merge of #102347 - nnethercote:unescaping-cleanups, r=matklad

Unescaping cleanups

Some minor improvements.

r? `@matklad`

21 months agoRollup merge of #102338 - compiler-errors:assoc-ty-binding-in-assoc-ty-binding, r...
Yuki Okushi [Wed, 28 Sep 2022 04:07:18 +0000 (13:07 +0900)]
Rollup merge of #102338 - compiler-errors:assoc-ty-binding-in-assoc-ty-binding, r=cjgillot

Deny associated type bindings within associated type bindings

Fixes #102335

This was made worse by #100865, which unified the way we generate substs for GATs and non-generic associated types. However, the issue was not _caused_ by #100865, evidenced by the test I added for GATs:

```rust
trait T {
    type A: S<C<(), i32 = ()> = ()>;
    //~^ ERROR associated type bindings are not allowed here
}

trait Q {}

trait S {
    type C<T>: Q;
}

fn main() {}
```

^ which passes on beta (where GATs are stable) and presumably ever since GATs support was added to `create_substs_for_associated_item` in astconv.

21 months agoRollup merge of #102288 - mejrs:inner, r=compiler-errors
Yuki Okushi [Wed, 28 Sep 2022 04:07:17 +0000 (13:07 +0900)]
Rollup merge of #102288 - mejrs:inner, r=compiler-errors

Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`.

This suggests various ways to get inside wrapper types if the method cannot be found on the wrapper type, but is present on the wrappee.

For this PR, those wrapper types include `Localkey`, `MaybeUninit`, `RefCell`, `RwLock` and `Mutex`.

21 months agoRollup merge of #102232 - Urgau:stabilize-bench_black_box, r=TaKO8Ki
Yuki Okushi [Wed, 28 Sep 2022 04:07:17 +0000 (13:07 +0900)]
Rollup merge of #102232 - Urgau:stabilize-bench_black_box, r=TaKO8Ki

Stabilize bench_black_box

This PR stabilize `feature(bench_black_box)`.

```rust
pub fn black_box<T>(dummy: T) -> T;
```

The FCP was completed in https://github.com/rust-lang/rust/issues/64102.

`@rustbot` label +T-libs-api -T-libs

21 months agoRollup merge of #100747 - MatthewPeterKelly:mpk/add-long-error-message-for-E0311...
Yuki Okushi [Wed, 28 Sep 2022 04:07:16 +0000 (13:07 +0900)]
Rollup merge of #100747 - MatthewPeterKelly:mpk/add-long-error-message-for-E0311, r=MatthewPeterKelly

Add long description and test for E0311

Adds a long description and unit test for the E0311 compiler error.

Fixes one line-item in https://github.com/rust-lang/rust/issues/61137.

21 months agoAuto merge of #100996 - m-ou-se:format-args-2, r=estebank
bors [Wed, 28 Sep 2022 01:36:28 +0000 (01:36 +0000)]
Auto merge of #100996 - m-ou-se:format-args-2, r=estebank

Rewrite and refactor format_args!() builtin macro.

This is a near complete rewrite of `compiler/rustc_builtin_macros/src/format.rs`.

This gets rid of the massive unmaintanable [`Context` struct](https://github.com/rust-lang/rust/blob/76531befc4b0352247ada67bd225e8cf71ee5686/compiler/rustc_builtin_macros/src/format.rs#L176-L263), and splits the macro expansion into three parts:

1. First, `parse_args` will parse the `(literal, arg, arg, name=arg, name=arg)` syntax, but doesn't parse the template (the literal) itself.
2. Second, `make_format_args` will parse the template, the format options, resolve argument references, produce diagnostics, and turn the whole thing into a `FormatArgs` structure.
3. Finally, `expand_parsed_format_args` will turn that `FormatArgs` structure into the expression that the macro expands to.

In other words, the `format_args` builtin macro used to be a hard-to-maintain 'single pass compiler', which I've split into a three phase compiler with a parser/tokenizer (step 1), semantic analysis (step 2), and backend (step 3). (It's compilers all the way down. ^^)

This can serve as a great starting point for https://github.com/rust-lang/rust/issues/99012, which will only need to change the implementation of 3, while leaving step 1 and 2 unchanged.

It also makes https://github.com/rust-lang/compiler-team/issues/541 easier, which could then upgrade the new `FormatArgs` struct to an `ast` node and remove step 3, moving that step to later in the compilation process.

It also fixes a few diagnostics bugs.

This also [significantly reduces](https://gist.github.com/m-ou-se/b67b2d54172c4837a5ab1b26fa3e5284) the amount of generated code for cases with arguments in non-default order without formatting options, like `"{1} {0}"` or `"{a} {}"`, etc.

21 months agoAddress review comments.
Nicholas Nethercote [Wed, 28 Sep 2022 00:28:36 +0000 (10:28 +1000)]
Address review comments.

21 months agoDeduplicate some logic
mejrs [Wed, 28 Sep 2022 00:36:58 +0000 (02:36 +0200)]
Deduplicate some logic

21 months agoreview updates
Matthew Kelly [Tue, 27 Sep 2022 23:23:59 +0000 (19:23 -0400)]
review updates

21 months agoAuto merge of #102377 - matthiaskrgr:rollup-1zvj50t, r=matthiaskrgr
bors [Tue, 27 Sep 2022 22:41:47 +0000 (22:41 +0000)]
Auto merge of #102377 - matthiaskrgr:rollup-1zvj50t, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #101555 (Stabilize `#![feature(mixed_integer_ops)]`)
 - #102253 (rustdoc: use CSS containment to speed up render)
 - #102281 (make invalid_value lint a bit smarter around enums)
 - #102284 (Structured suggestion for missing `mut`/`const` in raw pointer)
 - #102330 (rustdoc: remove no-op CSS `.srclink { font-weight; font-size }`)
 - #102337 (Avoid LLVM-deprecated `Optional::hasValue`)
 - #102356 (session: remove now-unnecessary lint `#[allow]`s)
 - #102367 (rustdoc: remove redundant `#help-button` CSS)
 - #102369 (Fix search result colors)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

21 months agoSmall cleanups in unescaping code.
Nicholas Nethercote [Tue, 27 Sep 2022 06:32:22 +0000 (16:32 +1000)]
Small cleanups in unescaping code.

- Rename `unescape_raw_str_or_raw_byte_str` as
  `unescape_raw_str_or_byte_str`, which is more accurate.
- Remove the unused `Mode::in_single_quotes` method.
- Make some assertions more precise, and add a missing one to
  `unescape_char_or_byte`.
- Change all the assertions to `debug_assert!`, because this code is
  reasonably hot, and the assertions aren't required for memory safety,
  and any violations are likely to be sufficiently obvious that normal
  tests will trigger them.

21 months agorustdoc: remove redundant mobile `.source > .sidebar` CSS
Michael Howell [Tue, 27 Sep 2022 21:25:48 +0000 (14:25 -0700)]
rustdoc: remove redundant mobile `.source > .sidebar` CSS

When the source sidebar and standard sidebar had most of their code merged in
07e3f998b1ceb4b8d2a7992782e60f5e776aa114, the properties `z-index: 11`,
`margin: 0`, and `position: fixed` were already being set on the `.sidebar`
class, so no need to repeat them.

21 months agoAdd newline
mejrs [Tue, 27 Sep 2022 21:12:52 +0000 (23:12 +0200)]
Add newline

21 months agoUse already resolved self_ty in confirm_fn_pointer_candidate
Michael Goulet [Tue, 27 Sep 2022 20:00:24 +0000 (20:00 +0000)]
Use already resolved self_ty in confirm_fn_pointer_candidate

21 months agoAuto merge of #102365 - weihanglo:update-cargo, r=ehuss
bors [Tue, 27 Sep 2022 19:42:46 +0000 (19:42 +0000)]
Auto merge of #102365 - weihanglo:update-cargo, r=ehuss

Update cargo

22 commits in 73ba3f35e0205844418260722c11602113179c4a..f5fed93ba24607980647962c59863bbabb03ce14 2022-09-18 06:38:16 +0000 to 2022-09-27 12:03:57 +0000

- build-scripts.md: Use em dash consistently. (rust-lang/cargo#11150)
- Indicate how Cargo locates the manifest (rust-lang/cargo#10770)
- Reduce references to `[project]` within cargo (rust-lang/cargo#11135)
- Iteratively construct target cfg (rust-lang/cargo#11114)
- update comment about `CARGO_BIN_EXE_` (rust-lang/cargo#11146)
- Call out that not all config values can be set via env vars (rust-lang/cargo#11139)
- Bump to 0.67.0, update changelog (rust-lang/cargo#11137)
- ci: update toolchain for building api doc (rust-lang/cargo#11134)
- Http publish not noop (rust-lang/cargo#11111)
- Improve errors for TOML fields that support workspace inheritance (rust-lang/cargo#11113)
- switch to `std::task::ready!()` where possible (rust-lang/cargo#11130)
- Report cmd aliasing failure with more contexts (rust-lang/cargo#11087)
- minor: remove unused mut (rust-lang/cargo#11127)
- fix(cli): Forward non-UTF8 arguments to external subcommands (rust-lang/cargo#11118)
- This change adds an example to the authors attribute in the manifest. (rust-lang/cargo#10938)
- Add support for relative git submodule paths (rust-lang/cargo#11106)
- make unknown features on `cargo add` more discoverable (rust-lang/cargo#11098)
- Unlink old final artifacts before compilation (rust-lang/cargo#11122)
- refactor(cli): Prepare for clap v4 (rust-lang/cargo#11116)
- fix(cli): Error trailing args rather than ignore (rust-lang/cargo#11119)
- Add a minor clarification (rust-lang/cargo#11093)
- doc(changelog): mention CVE fixes (rust-lang/cargo#11104)

21 months agoRollup merge of #102369 - GuillaumeGomez:results-colors, r=notriddle
Matthias Krüger [Tue, 27 Sep 2022 19:42:25 +0000 (21:42 +0200)]
Rollup merge of #102369 - GuillaumeGomez:results-colors, r=notriddle

Fix search result colors

Fixes regression introduced in https://github.com/rust-lang/rust/commit/99c00714cff0d13b6c5092c9949cb4e93a121346.

As you can see, ayu lost some colors for its search results:

beta/nightly:
![Screenshot from 2022-09-27 19-46-49](https://user-images.githubusercontent.com/3050060/192606456-e7bb58dd-cf76-49a0-b1ae-28565adb1dc6.png)

stable:
![Screenshot from 2022-09-27 19-46-36](https://user-images.githubusercontent.com/3050060/192606453-e720e219-a336-4ff1-989b-2fdb76e789eb.png)

We'll need to backport it to beta too to prevent it reaching stable.

r? `@notriddle`

21 months agoRollup merge of #102367 - notriddle:notriddle/help-text-align, r=GuillaumeGomez
Matthias Krüger [Tue, 27 Sep 2022 19:42:25 +0000 (21:42 +0200)]
Rollup merge of #102367 - notriddle:notriddle/help-text-align, r=GuillaumeGomez

rustdoc: remove redundant `#help-button` CSS

When the separate top and bottom styles were added in cd3f4da244578a2ab4d17d10016c61b9191b21e4, some of the CSS rules were needlessly duplicated.

The `text-align: initial` rule on `.side-by-side` was always redundant, since the rules that centered the text were set on children, not parents.

21 months agoRollup merge of #102356 - davidtwco:translation-bootstrap-bump-allow-lint, r=lcnr
Matthias Krüger [Tue, 27 Sep 2022 19:42:24 +0000 (21:42 +0200)]
Rollup merge of #102356 - davidtwco:translation-bootstrap-bump-allow-lint, r=lcnr

session: remove now-unnecessary lint `#[allow]`s

In #101230, the internal diagnostic migration lints - `diagnostic_outside_of_impl` and `untranslatable_diagnostic` - were modified so that they wouldn't trigger on functions annotated with `#[rustc_lint_diagnostics]`. However, this change has to make it into the bootstrap compiler before the `#[allow]` annotations that it aims to remove can be removed, which is possible now that #102051 has landed.

21 months agoRollup merge of #102337 - cuviper:llvm-optional-bool, r=nikic
Matthias Krüger [Tue, 27 Sep 2022 19:42:24 +0000 (21:42 +0200)]
Rollup merge of #102337 - cuviper:llvm-optional-bool, r=nikic

Avoid LLVM-deprecated `Optional::hasValue`

LLVM 15 added `Optional::has_value`, and LLVM `main` (16) has deprecated
`hasValue`. However, its `explicit operator bool` does the same thing,
and was added long ago, so we can use that across our full LLVM range of
compatibility.

21 months agoRollup merge of #102330 - notriddle:notriddle/srclink, r=GuillaumeGomez
Matthias Krüger [Tue, 27 Sep 2022 19:42:23 +0000 (21:42 +0200)]
Rollup merge of #102330 - notriddle:notriddle/srclink, r=GuillaumeGomez

rustdoc: remove no-op CSS `.srclink { font-weight; font-size }`

When this CSS was added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, source links were nested below headers.

https://github.com/rust-lang/rust/blob/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9/src/librustdoc/html/render.rs#L4015-L4019

Now, thanks to 458e7219bc2a62f72368279945cfda632a016da1, they are now siblings of headers, and thanks to 270d09dca9aae263671c4d32bbc7cb60dc378af8, they have the same font size that they would've had anyway.

21 months agoRollup merge of #102284 - compiler-errors:missing-type-in-raw-ptr, r=davidtwco
Matthias Krüger [Tue, 27 Sep 2022 19:42:23 +0000 (21:42 +0200)]
Rollup merge of #102284 - compiler-errors:missing-type-in-raw-ptr, r=davidtwco

Structured suggestion for missing `mut`/`const` in raw pointer

Fixes #102261

21 months agoRollup merge of #102281 - RalfJung:invalid-enums, r=cjgillot
Matthias Krüger [Tue, 27 Sep 2022 19:42:22 +0000 (21:42 +0200)]
Rollup merge of #102281 - RalfJung:invalid-enums, r=cjgillot

make invalid_value lint a bit smarter around enums

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

21 months agoRollup merge of #102253 - jsha:css-contain, r=notriddle
Matthias Krüger [Tue, 27 Sep 2022 19:42:22 +0000 (21:42 +0200)]
Rollup merge of #102253 - jsha:css-contain, r=notriddle

rustdoc: use CSS containment to speed up render

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Containment

This affected layout a little and required adjustments to the CSS to keep spacing the same. In particular, the margins of adjacent items usually overlap with each other. However, when an item has contain: layout, any margins of child nodes push out the size of the item itself. This was making spacing between items a little too big. To solve that, I removed margins in some places: in particular for certain classes that often occur at the end of a `details.rustdoc-toggle` block, I removed their bottom margin. Generally, the margins provided by the next item down are sufficient.

Also remove an unnecessary margin-top on .code-header.

In particular this helps with the problem that rustdoc in some situations can generate giant HTML pages, which can crash a Chrome tab on typical modern hardware, for instance: `https://docs.rs/iced-x86/1.16.0/iced_x86/code_asm/struct.CodeAssembler.html` (26MB, 409k DOM nodes). This doesn't, of course, universally solve the problem, but it pushes out the boundary of the largest page rustdoc can produce without crashing a browser tab.

Demos:

https://rustdoc.crud.net/jsha/css-contain/std/string/struct.String.html
(warning: giant page, _may_ crash a browser tab) https://rustdoc.crud.net/jsha/css-contain-icedx86/iced_x86/code_asm/struct.CodeAssembler.html

r? `@notriddle`

21 months agoRollup merge of #101555 - jhpratt:stabilize-mixed_integer_ops, r=joshtriplett
Matthias Krüger [Tue, 27 Sep 2022 19:42:21 +0000 (21:42 +0200)]
Rollup merge of #101555 - jhpratt:stabilize-mixed_integer_ops, r=joshtriplett

Stabilize `#![feature(mixed_integer_ops)]`

Tracked and FCP completed in #87840.

````@rustbot```` label +T-libs-api +S-waiting-on-review +relnotes

r? rust-lang/t-libs-api

21 months agoAddress feedback
mejrs [Tue, 27 Sep 2022 11:06:31 +0000 (13:06 +0200)]
Address feedback

21 months agoWrapper suggestions
mejrs [Sun, 25 Sep 2022 22:55:35 +0000 (00:55 +0200)]
Wrapper suggestions

21 months agoAdd GUI regression test for search results colors
Guillaume Gomez [Tue, 27 Sep 2022 18:23:00 +0000 (20:23 +0200)]
Add GUI regression test for search results colors

21 months agoFix regression for results colors
Guillaume Gomez [Tue, 27 Sep 2022 18:22:46 +0000 (20:22 +0200)]
Fix regression for results colors

21 months agorustdoc: remove redundant `#help-button` CSS
Michael Howell [Tue, 27 Sep 2022 17:52:08 +0000 (10:52 -0700)]
rustdoc: remove redundant `#help-button` CSS

When the separate top and bottom styles were added in
cd3f4da244578a2ab4d17d10016c61b9191b21e4, some of the CSS rules were
needlessly duplicated.

The `text-align: initial` rule on `.side-by-side` was always redundant, since
the rules that centered the text were set on children, not parents.

21 months agoUpdate src/test/rustdoc-gui/sidebar-mobile-scroll.goml
Jacob Hoffman-Andrews [Tue, 27 Sep 2022 17:25:25 +0000 (10:25 -0700)]
Update src/test/rustdoc-gui/sidebar-mobile-scroll.goml

Co-authored-by: Michael Howell <michael@notriddle.com>
21 months agoDeny associated type bindings within associated type bindings
Michael Goulet [Tue, 27 Sep 2022 00:45:50 +0000 (00:45 +0000)]
Deny associated type bindings within associated type bindings

21 months agoUpdate cargo
Weihang Lo [Tue, 27 Sep 2022 16:46:34 +0000 (17:46 +0100)]
Update cargo

22 commits in 73ba3f35e0205844418260722c11602113179c4a..f5fed93ba24607980647962c59863bbabb03ce14
2022-09-18 06:38:16 +0000 to 2022-09-27 12:03:57 +0000

- build-scripts.md: Use em dash consistently. (rust-lang/cargo#11150)
- Indicate how Cargo locates the manifest (rust-lang/cargo#10770)
- Reduce references to `[project]` within cargo (rust-lang/cargo#11135)
- Iteratively construct target cfg (rust-lang/cargo#11114)
- update comment about `CARGO_BIN_EXE_` (rust-lang/cargo#11146)
- Call out that not all config values can be set via env vars (rust-lang/cargo#11139)
- Bump to 0.67.0, update changelog (rust-lang/cargo#11137)
- ci: update toolchain for building api doc (rust-lang/cargo#11134)
- Http publish not noop (rust-lang/cargo#11111)
- Improve errors for TOML fields that support workspace inheritance (rust-lang/cargo#11113)
- switch to `std::task::ready!()` where possible (rust-lang/cargo#11130)
- Report cmd aliasing failure with more contexts (rust-lang/cargo#11087)
- minor: remove unused mut (rust-lang/cargo#11127)
- fix(cli): Forward non-UTF8 arguments to external subcommands (rust-lang/cargo#11118)
- This change adds an example to the authors attribute in the manifest. (rust-lang/cargo#10938)
- Add support for relative git submodule paths (rust-lang/cargo#11106)
- make unknown features on `cargo add` more discoverable (rust-lang/cargo#11098)
- Unlink old final artifacts before compilation (rust-lang/cargo#11122)
- refactor(cli): Prepare for clap v4 (rust-lang/cargo#11116)
- fix(cli): Error trailing args rather than ignore (rust-lang/cargo#11119)
- Add a minor clarification (rust-lang/cargo#11093)
- doc(changelog): mention CVE fixes (rust-lang/cargo#11104)

21 months agorustdoc: use CSS containment to speed up render
Jacob Hoffman-Andrews [Tue, 27 Sep 2022 16:21:24 +0000 (09:21 -0700)]
rustdoc: use CSS containment to speed up render

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Containment

This affected layout a little and required adjustments to the CSS to
keep spacing the same. In particular, the margins of adjacent items
usually overlap with each other. However, when an item has contain:
layout, any margins of child nodes push out the size of the item itself.
This was making spacing between items a little too big. To solve that, I
removed margins in some places: in particular for certain classes that
often occur at the end of a `details.rustdoc-toggle` block, I removed
their bottom margin. Generally, the margins provided by the next item
down are sufficient.

Also remove an unnecessary margin-top on .code-header.

21 months agoStabilize bench_black_box
Urgau [Sat, 24 Sep 2022 10:34:56 +0000 (12:34 +0200)]
Stabilize bench_black_box

21 months agoalso query type_uninhabited_from
Ralf Jung [Tue, 27 Sep 2022 13:59:10 +0000 (15:59 +0200)]
also query type_uninhabited_from

21 months agoRemove confusing drop.
Mara Bos [Tue, 6 Sep 2022 21:19:20 +0000 (23:19 +0200)]
Remove confusing drop.

21 months agoUpdate doc comments.
Mara Bos [Tue, 6 Sep 2022 21:15:44 +0000 (23:15 +0200)]
Update doc comments.

21 months agoTurn format arguments Vec into its own struct.
Mara Bos [Tue, 6 Sep 2022 21:15:13 +0000 (23:15 +0200)]
Turn format arguments Vec into its own struct.

With efficient lookup through a hash map.

21 months agoUpdate test.
Mara Bos [Tue, 6 Sep 2022 21:08:27 +0000 (23:08 +0200)]
Update test.

21 months agoAdd clarifying comments.
Mara Bos [Tue, 30 Aug 2022 15:26:50 +0000 (17:26 +0200)]
Add clarifying comments.

21 months agoFlatten if-let and match into one.
Mara Bos [Tue, 30 Aug 2022 15:21:41 +0000 (17:21 +0200)]
Flatten if-let and match into one.

21 months agoMove enum definition closer to its usage.
Mara Bos [Tue, 30 Aug 2022 15:18:09 +0000 (17:18 +0200)]
Move enum definition closer to its usage.

21 months agoUse if let chain.
Mara Bos [Tue, 30 Aug 2022 15:18:01 +0000 (17:18 +0200)]
Use if let chain.

21 months agoTweak comments.
Mara Bos [Sat, 27 Aug 2022 16:32:20 +0000 (18:32 +0200)]
Tweak comments.

21 months agoPrefer new_v1_formatted instead of new_v1 with duplicates.
Mara Bos [Sat, 27 Aug 2022 15:51:28 +0000 (17:51 +0200)]
Prefer new_v1_formatted instead of new_v1 with duplicates.

21 months agoFix typo.
Mara Bos [Fri, 26 Aug 2022 20:56:21 +0000 (22:56 +0200)]
Fix typo.

21 months agoMove FormatArgs structure to its own module.
Mara Bos [Fri, 26 Aug 2022 17:13:17 +0000 (19:13 +0200)]
Move FormatArgs structure to its own module.

21 months agoUpdate tests.
Mara Bos [Fri, 26 Aug 2022 16:52:08 +0000 (18:52 +0200)]
Update tests.

21 months agoRewrite and refactor format_args!() builtin macro.
Mara Bos [Mon, 8 Aug 2022 14:17:08 +0000 (16:17 +0200)]
Rewrite and refactor format_args!() builtin macro.

21 months agoAuto merge of #102306 - lcnr:rustc_hir_analysis, r=compiler-errors
bors [Tue, 27 Sep 2022 10:45:57 +0000 (10:45 +0000)]
Auto merge of #102306 - lcnr:rustc_hir_analysis, r=compiler-errors

rename rustc_typeck to rustc_hir_analysis

first part of https://github.com/rust-lang/compiler-team/issues/529

r? `@compiler-errors`

21 months agosession: remove now-unnecessary lint `#[allow]`s
David Wood [Tue, 27 Sep 2022 10:01:49 +0000 (11:01 +0100)]
session: remove now-unnecessary lint `#[allow]`s

In #101230, the internal diagnostic migration lints -
`diagnostic_outside_of_impl` and `untranslatable_diagnostic` - were
modified so that they wouldn't trigger on functions annotated with
`#[rustc_lint_diagnostics]`. However, this change has to make it into
the bootstrap compiler before the `#[allow]` annotations that it aims to
remove can be removed, which is possible now that #102051 has landed.

Signed-off-by: David Wood <david.wood@huawei.com>
21 months agorustc_typeck to rustc_hir_analysis
lcnr [Mon, 26 Sep 2022 11:00:29 +0000 (13:00 +0200)]
rustc_typeck to rustc_hir_analysis

21 months agoAuto merge of #102314 - TaKO8Ki:add-label-to-struct-enum-union-ident, r=estebank
bors [Tue, 27 Sep 2022 07:30:11 +0000 (07:30 +0000)]
Auto merge of #102314 - TaKO8Ki:add-label-to-struct-enum-union-ident, r=estebank

Add a label to struct/enum/union ident name

Based on https://github.com/rust-lang/rust/pull/94996#discussion_r831694150
cc: `@estebank`

21 months agoTweak `FulfillProcessor`.
Nicholas Nethercote [Tue, 27 Sep 2022 03:24:49 +0000 (13:24 +1000)]
Tweak `FulfillProcessor`.

Avoids some unnecessary references and lifetimes.

21 months agoFix an incorrect comment.
Nicholas Nethercote [Tue, 27 Sep 2022 05:25:34 +0000 (15:25 +1000)]
Fix an incorrect comment.

If a `\x` escape occurs in a non-byte literals (e.g. char literal,
string literal), it must be <= 0xff.

21 months agoAuto merge of #102189 - davidtwco:translation-derive-enums, r=compiler-errors
bors [Tue, 27 Sep 2022 04:39:25 +0000 (04:39 +0000)]
Auto merge of #102189 - davidtwco:translation-derive-enums, r=compiler-errors

macros: diagnostic derive on enums

Part of #100717.

Extends `#[derive(Diagnostic)]` to work on enums too where each variant acts like a distinct diagnostic - being able to represent diagnostics this way can be quite a bit simpler for some parts of the compiler.

r? `@compiler-errors`
cc `@Xiretza`

21 months agoStructured suggestion for missing mut/const in pointer
Michael Goulet [Sun, 25 Sep 2022 22:03:39 +0000 (22:03 +0000)]
Structured suggestion for missing mut/const in pointer

21 months agoRename some variables.
Nicholas Nethercote [Tue, 27 Sep 2022 02:04:03 +0000 (12:04 +1000)]
Rename some variables.

These make the delimiter processing clearer.

21 months agoAuto merge of #102331 - notriddle:rollup-dmefd2d, r=notriddle
bors [Tue, 27 Sep 2022 01:58:36 +0000 (01:58 +0000)]
Auto merge of #102331 - notriddle:rollup-dmefd2d, r=notriddle

Rollup of 6 pull requests

Successful merges:

 - #102283 (Improve code example for Option::unwrap_or_default)
 - #102319 (rustdoc: merge CSS `table` rules into `.docblock`)
 - #102321 ( Rustdoc-Json: List impls for primitives)
 - #102322 (Document that Display automatically implements ToString)
 - #102325 (rustdoc: give `.line-number` / `.line-numbers` meaningful names)
 - #102326 (rustdoc: Update doc comment for splitn_mut to include mutable in the …)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

21 months agofix a ui test
Takayuki Maeda [Mon, 26 Sep 2022 14:43:31 +0000 (23:43 +0900)]
fix a ui test

21 months agoadd a label to struct/enum/union ident name
Takayuki Maeda [Mon, 26 Sep 2022 14:13:38 +0000 (23:13 +0900)]
add a label to struct/enum/union ident name

21 months agocreate a new local var
Takayuki Maeda [Mon, 26 Sep 2022 14:13:09 +0000 (23:13 +0900)]
create a new local var

21 months agoremove implied link bound per review
Matthew Kelly [Tue, 27 Sep 2022 00:50:33 +0000 (20:50 -0400)]
remove implied link bound per review

also update .stderr outputs

21 months agoMerge remote-tracking branch 'origin/master' into mpk/add-long-error-message-for...
Matthew Kelly [Mon, 26 Sep 2022 23:59:52 +0000 (19:59 -0400)]
Merge remote-tracking branch 'origin/master' into mpk/add-long-error-message-for-E0311

21 months agoMinor improvements.
Nicholas Nethercote [Mon, 26 Sep 2022 23:53:04 +0000 (09:53 +1000)]
Minor improvements.

Add some comments, and mark one path as unreachable.

21 months agoAvoid LLVM-deprecated `Optional::hasValue`
Josh Stone [Mon, 26 Sep 2022 23:51:18 +0000 (16:51 -0700)]
Avoid LLVM-deprecated `Optional::hasValue`

LLVM 15 added `Optional::has_value`, and LLVM `main` (16) has deprecated
`hasValue`. However, its `explicit operator bool` does the same thing,
and was added long ago, so we can use that across our full LLVM range of
compatibility.

21 months agoAuto merge of #102283 - GuillaumeGomez:option-code-example-unwrap-or-default, r=thomcc
bors [Mon, 26 Sep 2022 23:17:52 +0000 (23:17 +0000)]
Auto merge of #102283 - GuillaumeGomez:option-code-example-unwrap-or-default, r=thomcc

Improve code example for Option::unwrap_or_default

Fixes #100054.
Follow-up of #102259.

r? `@thomcc`

21 months agoRollup merge of #102326 - yancyribbens:splin-mut-doc-change, r=thomcc
Michael Howell [Mon, 26 Sep 2022 22:40:55 +0000 (15:40 -0700)]
Rollup merge of #102326 - yancyribbens:splin-mut-doc-change, r=thomcc

rustdoc: Update doc comment for splitn_mut to include mutable in the …

The doc comment for [splitn](https://github.com/rust-lang/rust/blob/master/library/core/src/slice/mod.rs#L2051:L2056) is the exact same as the comment for [splitn_mut](https://github.com/rust-lang/rust/blob/master/library/core/src/slice/mod.rs#L2079:L2084).  The doc comment for `splitn_mut` should instead say it's working on a mutable subslice.

21 months agoRollup merge of #102325 - notriddle:notriddle/line-number, r=GuillaumeGomez
Michael Howell [Mon, 26 Sep 2022 22:40:55 +0000 (15:40 -0700)]
Rollup merge of #102325 - notriddle:notriddle/line-number, r=GuillaumeGomez

rustdoc: give `.line-number` / `.line-numbers` meaningful names

21 months agoRollup merge of #102322 - sigaloid:master, r=GuillaumeGomez
Michael Howell [Mon, 26 Sep 2022 22:40:54 +0000 (15:40 -0700)]
Rollup merge of #102322 - sigaloid:master, r=GuillaumeGomez

Document that Display automatically implements ToString

Closes #92941

r? rust-lang/docs

21 months agoRollup merge of #102321 - aDotInTheVoid:rdj-prim-impls, r=GuillaumeGomez
Michael Howell [Mon, 26 Sep 2022 22:40:54 +0000 (15:40 -0700)]
Rollup merge of #102321 - aDotInTheVoid:rdj-prim-impls, r=GuillaumeGomez

 Rustdoc-Json: List impls for primitives

 Closes #101695

 Partially addresses #100961

r? ``@GuillaumeGomez``

21 months agoRollup merge of #102319 - notriddle:notriddle/td-th, r=GuillaumeGomez
Michael Howell [Mon, 26 Sep 2022 22:40:53 +0000 (15:40 -0700)]
Rollup merge of #102319 - notriddle:notriddle/td-th, r=GuillaumeGomez

rustdoc: merge CSS `table` rules into `.docblock`

This was added in 510107815fe888319028c5e96001cdee70e7a931, to fix the display of the module items and search results tables (see the discussion in https://github.com/rust-lang/rust/pull/86725).

Those aren't tables any more. The only remaining table is in docblock, which has its own padding declarations.

21 months agoRollup merge of #102283 - GuillaumeGomez:option-code-example-unwrap-or-default, r...
Michael Howell [Mon, 26 Sep 2022 22:40:52 +0000 (15:40 -0700)]
Rollup merge of #102283 - GuillaumeGomez:option-code-example-unwrap-or-default, r=thomcc

Improve code example for Option::unwrap_or_default

Fixes #100054.
Follow-up of #102259.

r? ``@thomcc``

21 months agorustdoc: remove no-op CSS `.srclink { font-weight; font-size }`
Michael Howell [Mon, 26 Sep 2022 22:28:26 +0000 (15:28 -0700)]
rustdoc: remove no-op CSS `.srclink { font-weight; font-size }`

When this CSS was added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, source
links were nested below headers.

https://github.com/rust-lang/rust/blob/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9/src/librustdoc/html/render.rs#L4015-L4019

Now, thanks to 458e7219bc2a62f72368279945cfda632a016da1, they are now
siblings of headers, and thanks to
270d09dca9aae263671c4d32bbc7cb60dc378af8, they have the same font size that
they would've had anyway.

21 months agoAuto merge of #102324 - matthiaskrgr:rollup-6l70oz3, r=matthiaskrgr
bors [Mon, 26 Sep 2022 19:57:51 +0000 (19:57 +0000)]
Auto merge of #102324 - matthiaskrgr:rollup-6l70oz3, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #101875 (Allow more `!Copy` impls)
 - #101996 (Don't duplicate region names for late-bound regions in print of Binder)
 - #102181 (Add regression test)
 - #102273 (Allow `~const` bounds on non-const functions)
 - #102286 (Recover some items that expect braces and don't take semicolons)

Failed merges:

 - #102314 (Add a label to struct/enum/union ident name)

r? `@ghost`
`@rustbot` modify labels: rollup

21 months agorustdoc: simplify example-line-numbers CSS selector
Michael Howell [Mon, 26 Sep 2022 19:21:27 +0000 (12:21 -0700)]
rustdoc: simplify example-line-numbers CSS selector

21 months agorustdoc: give `.line-number` / `.line-numbers` meaningful names
Michael Howell [Mon, 26 Sep 2022 17:50:51 +0000 (10:50 -0700)]
rustdoc: give `.line-number` / `.line-numbers` meaningful names

21 months agorustdoc: Update doc comment for splitn_mut to include mutable in the description
yancy [Mon, 26 Sep 2022 18:20:13 +0000 (20:20 +0200)]
rustdoc: Update doc comment for splitn_mut to include mutable in the description

21 months agoRollup merge of #102286 - compiler-errors:recover-semi-in-block-item, r=davidtwco
Matthias Krüger [Mon, 26 Sep 2022 17:19:21 +0000 (19:19 +0200)]
Rollup merge of #102286 - compiler-errors:recover-semi-in-block-item, r=davidtwco

Recover some items that expect braces and don't take semicolons

Fixes #102262

21 months agoRollup merge of #102273 - woppopo:relax_const_bound, r=fee1-dead
Matthias Krüger [Mon, 26 Sep 2022 17:19:21 +0000 (19:19 +0200)]
Rollup merge of #102273 - woppopo:relax_const_bound, r=fee1-dead

Allow `~const` bounds on non-const functions

Makes the behavior of bound of trait-associated functions and non-associated functions consistent.

21 months agoRollup merge of #102181 - inquisitivecrystal:issue-100878-test, r=Mark-Simulacrum
Matthias Krüger [Mon, 26 Sep 2022 17:19:20 +0000 (19:19 +0200)]
Rollup merge of #102181 - inquisitivecrystal:issue-100878-test, r=Mark-Simulacrum

Add regression test

This adds a regression test for issue #100878.

Closes #100878.

21 months agoRollup merge of #101996 - b-naber:binder-print, r=lcnr
Matthias Krüger [Mon, 26 Sep 2022 17:19:20 +0000 (19:19 +0200)]
Rollup merge of #101996 - b-naber:binder-print, r=lcnr

Don't duplicate region names for late-bound regions in print of Binder

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

21 months agoRollup merge of #101875 - fmease:allow-more-negative-copy-impls, r=lcnr
Matthias Krüger [Mon, 26 Sep 2022 17:19:19 +0000 (19:19 +0200)]
Rollup merge of #101875 - fmease:allow-more-negative-copy-impls, r=lcnr

Allow more `!Copy` impls

You can already implement `!Copy` for a lot of types (with `#![feature(negative_impls)]`). However, before this PR you could not implement `!Copy` for ADTs whose fields don't implement `Copy` which didn't make any sense. Further, you couldn't implement `!Copy` for types impl'ing `Drop` (equally nonsensical).

``@rustbot`` label T-types F-negative_impls
Fixes #101836.

r? types

21 months agoAuto merge of #102257 - cjgillot:let-else-lint, r=dingxiangfei2009
bors [Mon, 26 Sep 2022 17:17:07 +0000 (17:17 +0000)]
Auto merge of #102257 - cjgillot:let-else-lint, r=dingxiangfei2009

Fix lint scoping for let-else.

The scoping for let-else is inconsistent with HIR nesting.  This creates cases, in `ui/let-else/let-else-allow-unused.rs` for instance, where an `allow` lint attribute does not apply to the bindings created by `let-else`.

This PR is an attempt to correct this.

As there is no lint that currently relies on this, the test for this behaviour is https://github.com/rust-lang/rust/pull/101500.

cc `@dingxiangfei2009` as you filed https://github.com/rust-lang/rust/pull/101894

21 months ago Rustdoc-Json: List impls for primitives
Nixon Enraght-Moony [Mon, 26 Sep 2022 17:06:48 +0000 (18:06 +0100)]
 Rustdoc-Json: List impls for primitives

 Closes #101695

21 months agoDocument that Display entails ToString
Matthew Esposito [Mon, 26 Sep 2022 16:50:45 +0000 (12:50 -0400)]
Document that Display entails ToString

21 months agorustdoc: merge `table { border-collapse } into `.docblock table`
Michael Howell [Mon, 26 Sep 2022 16:54:44 +0000 (09:54 -0700)]
rustdoc: merge `table { border-collapse } into `.docblock table`

This was added in 510107815fe888319028c5e96001cdee70e7a931, to fix the
display of the module items and search results tables (see the discussion in
https://github.com/rust-lang/rust/pull/86725).

Those aren't tables any more. The only remaining table is in docblock, which
needs this attribute to look right.

21 months agorustdoc: remove unneeded CSS `td, th { padding 0 }`
Michael Howell [Mon, 26 Sep 2022 16:20:20 +0000 (09:20 -0700)]
rustdoc: remove unneeded CSS `td, th { padding 0 }`

This was added in 510107815fe888319028c5e96001cdee70e7a931, to fix
the display of the module items and search results tables (see the discussion
in https://github.com/rust-lang/rust/pull/86725).

Those aren't tables any more. The only remaining table is in docblock, which
has its own padding declarations.

21 months agoAuto merge of #102051 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum
bors [Mon, 26 Sep 2022 14:22:43 +0000 (14:22 +0000)]
Auto merge of #102051 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum

Update bootstrap compiler to 1.65.0

This PR updates the bootstrap compiler to Rust 1.65.0, removing the various `cfg(bootstrap)`s.

r? `@Mark-Simulacrum`

21 months agoaddress review
b-naber [Wed, 21 Sep 2022 15:57:30 +0000 (17:57 +0200)]
address review

21 months agoAuto merge of #102184 - chenyukang:fix-102087-add-binding-sugg, r=nagisa
bors [Mon, 26 Sep 2022 11:41:58 +0000 (11:41 +0000)]
Auto merge of #102184 - chenyukang:fix-102087-add-binding-sugg, r=nagisa

Suggest Default::default() when binding isn't initialized

Fixes #102087

21 months agobless tests
b-naber [Sun, 18 Sep 2022 20:02:56 +0000 (22:02 +0200)]
bless tests

21 months agodon't duplicate late-bound region names in print of Binder
b-naber [Thu, 15 Sep 2022 16:46:40 +0000 (18:46 +0200)]
don't duplicate late-bound region names in print of Binder

21 months agomacros: support diagnostic derive on enums
David Wood [Fri, 23 Sep 2022 11:49:02 +0000 (12:49 +0100)]
macros: support diagnostic derive on enums

Signed-off-by: David Wood <david.wood@huawei.com>
21 months agoImprove code example for Option::unwrap_or_default
Guillaume Gomez [Sun, 25 Sep 2022 21:58:33 +0000 (23:58 +0200)]
Improve code example for Option::unwrap_or_default