Commit Graph

206302 Commits

Author SHA1 Message Date
Yuki Okushi
f0daff20ca
Rollup merge of #102347 - nnethercote:unescaping-cleanups, r=matklad
Unescaping cleanups

Some minor improvements.

r? `@matklad`
2022-09-28 13:07:18 +09:00
Yuki Okushi
b263b7e64c
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.
2022-09-28 13:07:18 +09:00
Yuki Okushi
9436ffc226
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`.
2022-09-28 13:07:17 +09:00
Yuki Okushi
07bb2e6527
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
2022-09-28 13:07:17 +09:00
Yuki Okushi
49bc668493
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.
2022-09-28 13:07:16 +09:00
mejrs
4ff83cee95 Deduplicate some logic 2022-09-28 02:36:58 +02:00
Matthew Kelly
c0d32fd2cc review updates 2022-09-27 19:23:59 -04:00
bors
90c34fafcf 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
2022-09-27 22:41:47 +00:00
Nicholas Nethercote
94cb5e86ea 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.
2022-09-28 08:31:24 +10:00
mejrs
e9224b3796 Add newline 2022-09-27 23:12:52 +02:00
bors
470e518c4b 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)
2022-09-27 19:42:46 +00:00
Matthias Krüger
f28ac30527
Rollup merge of #102369 - GuillaumeGomez:results-colors, r=notriddle
Fix search result colors

Fixes regression introduced in 99c00714cf.

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`
2022-09-27 21:42:25 +02:00
Matthias Krüger
5971b1a921
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 cd3f4da244, 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.
2022-09-27 21:42:25 +02:00
Matthias Krüger
3ca0cd0f94
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.
2022-09-27 21:42:24 +02:00
Matthias Krüger
e1fb698c44
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.
2022-09-27 21:42:24 +02:00
Matthias Krüger
b32ce95911
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 34bd2b845b, source links were nested below headers.

34bd2b845b/src/librustdoc/html/render.rs (L4015-L4019)

Now, thanks to 458e7219bc, they are now siblings of headers, and thanks to 270d09dca9, they have the same font size that they would've had anyway.
2022-09-27 21:42:23 +02:00
Matthias Krüger
8b635cba1d
Rollup merge of #102284 - compiler-errors:missing-type-in-raw-ptr, r=davidtwco
Structured suggestion for missing `mut`/`const` in raw pointer

Fixes #102261
2022-09-27 21:42:23 +02:00
Matthias Krüger
8d2faa2ae8
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
2022-09-27 21:42:22 +02:00
Matthias Krüger
4cef648c1e
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`
2022-09-27 21:42:22 +02:00
Matthias Krüger
ad57d5f27c
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
2022-09-27 21:42:21 +02:00
mejrs
f3ac328d58 Address feedback 2022-09-27 21:42:09 +02:00
mejrs
c4c9415132 Wrapper suggestions 2022-09-27 21:42:09 +02:00
Guillaume Gomez
a925e203d1 Add GUI regression test for search results colors 2022-09-27 20:23:00 +02:00
Guillaume Gomez
ef410f1b01 Fix regression for results colors 2022-09-27 20:22:46 +02:00
Michael Howell
3bbb328e68 rustdoc: remove redundant #help-button CSS
When the separate top and bottom styles were added in
cd3f4da244, 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.
2022-09-27 10:52:08 -07:00
Jacob Hoffman-Andrews
b5b77a2959 Update src/test/rustdoc-gui/sidebar-mobile-scroll.goml
Co-authored-by: Michael Howell <michael@notriddle.com>
2022-09-27 10:52:05 -07:00
Michael Goulet
ca2e0bb51a Deny associated type bindings within associated type bindings 2022-09-27 17:41:34 +00:00
Weihang Lo
5095f54219
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)
2022-09-27 17:46:42 +01:00
Jacob Hoffman-Andrews
8846c0853d 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.
2022-09-27 09:21:24 -07:00
Urgau
9ad2f00f6a Stabilize bench_black_box 2022-09-27 17:38:51 +02:00
Ralf Jung
67fd09d3b8 also query type_uninhabited_from 2022-09-27 16:20:23 +02:00
bors
57ee5cf5a9 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`
2022-09-27 10:45:57 +00:00
David Wood
2286888ef9 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>
2022-09-27 11:01:49 +01:00
lcnr
1fc86a63f4 rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00
bors
d9297d22ad 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`
2022-09-27 07:30:11 +00:00
Nicholas Nethercote
c91c64708b Fix an incorrect comment.
If a `\x` escape occurs in a non-byte literals (e.g. char literal,
string literal), it must be <= 0xff.
2022-09-27 15:25:34 +10:00
bors
de0b511daa 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`
2022-09-27 04:39:25 +00:00
Michael Goulet
594134d873 Structured suggestion for missing mut/const in pointer 2022-09-27 02:47:07 +00:00
bors
cd4d9d934f 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
2022-09-27 01:58:36 +00:00
Takayuki Maeda
5d05908c70 fix a ui test 2022-09-27 10:28:53 +09:00
Takayuki Maeda
4f44dee501 add a label to struct/enum/union ident name 2022-09-27 10:28:50 +09:00
Takayuki Maeda
e123a61297 create a new local var 2022-09-27 10:22:46 +09:00
Matthew Kelly
0d9c01480b remove implied link bound per review
also update .stderr outputs
2022-09-26 20:50:33 -04:00
Matthew Kelly
24aab524cb Merge remote-tracking branch 'origin/master' into mpk/add-long-error-message-for-E0311 2022-09-26 19:59:52 -04:00
Josh Stone
35adb36779 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.
2022-09-26 16:51:18 -07:00
bors
f3a6fbf2f2 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`
2022-09-26 23:17:52 +00:00
Michael Howell
7381d7d8b2
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.
2022-09-26 15:40:55 -07:00
Michael Howell
76b21341a8
Rollup merge of #102325 - notriddle:notriddle/line-number, r=GuillaumeGomez
rustdoc: give `.line-number` / `.line-numbers` meaningful names
2022-09-26 15:40:55 -07:00
Michael Howell
66bab6b781
Rollup merge of #102322 - sigaloid:master, r=GuillaumeGomez
Document that Display automatically implements ToString

Closes #92941

r? rust-lang/docs
2022-09-26 15:40:54 -07:00
Michael Howell
0415560382
Rollup merge of #102321 - aDotInTheVoid:rdj-prim-impls, r=GuillaumeGomez
Rustdoc-Json: List impls for primitives

 Closes #101695

 Partially addresses #100961

r? ``@GuillaumeGomez``
2022-09-26 15:40:54 -07:00