Commit Graph

199717 Commits

Author SHA1 Message Date
Dylan DPC
0d61a507f5
Rollup merge of #101399 - cjgillot:borrowck-binding-span, r=estebank
Shrink span for bindings with subpatterns.

Bindings with nested patterns (`binding @ pat` syntax) currently point to the full pattern.  This PR proposes to shrink the span to stop before the ````@`.```  This makes the diagnostics for move/mutability conflicts clearer, as they not point to the `binding` only, instead of the full pat.

r? ```@estebank```
2022-09-08 11:55:06 +05:30
Dylan DPC
e3ea8008cc
Rollup merge of #101153 - IntQuant:issue-100717-infer-2, r=davidtwco
Migrate another part of rustc_infer to session diagnostic

Probably will migrate another file before marking this one as ready-to-merge.

`@rustbot` label +A-translation
r? rust-lang/diagnostics
cc https://github.com/rust-lang/rust/issues/100717
2022-09-08 11:55:06 +05:30
Nicholas Nethercote
e67f39f8bc Introduce DotDotPos.
This shrinks `hir::Pat` from 88 to 72 bytes.
2022-09-08 15:25:50 +10:00
Nicholas Nethercote
4314615ff8 Arena-allocate hir::Lifetime.
This shrinks `hir::Ty` from 72 to 48 bytes.

`visit_lifetime` is added to the HIR stats collector because these types
are now stored in memory on their own, instead of being within other
types.
2022-09-08 15:07:19 +10:00
bors
44adfccffe Auto merge of #101504 - lqd:rust-lld-fix, r=petrochenkov
Fix `-Zgcc-ld=lld`

`-Zgcc-ld=lld` is currently broken. CI is currently ignoring its tests.

cc `@Mark-Simulacrum` on the `compiletest` change: I'm not sure which of `bootstrap`'s test step or `compiletest` is currently incorrect wrt windows' `--compile-lib-path`. Since `sysroot/bin` is passed on windows, that means that `compiletest` can't find `rust-lld` on windows and tests are currently ignored: it's looking for something that is in `sysroot/lib` instead.

They are currently ignored on unixes for a different reason: the lld wrapper has a different name than what is checked.

(I've changed `compiletest` in this PR, just because I could make a very targeted change there, whereas completely changing the intentional lib path that is passed seemed it'd have wider reaching implications on all tests.)

And in both unix/win cases, I've changed the detection to look for `rust-lld` rather than the wrappers in `bin/gcc-ld/`. It seems like the more stable of all these executable names.

r? `@petrochenkov`

I've tested the `lld-wrapper` change on linux and osx, but couldn't test on windows gnu targets (I only have MSVC targets, and these can't use `rust-lld` via `-Zgcc-ld=lld`, nor do they use the lld wrapper IIUC).

I'd expect it to work whether or not the wrapper is called with or without an executable suffix. But at least now CI should test it in these targets.

Fixes #101370.
2022-09-08 05:02:32 +00:00
Michael Goulet
97668a5589 We can print futures with {integer} too 2022-09-08 02:52:57 +00:00
Michael Goulet
2c94102df5 Generator return doesn't need to be a lang item 2022-09-08 02:52:57 +00:00
bors
4af35b8e30 Auto merge of #101303 - jyn514:jnelson/handle-cycle-enum, r=cjgillot
Make `HandleCycleError` an enum instead of a macro-generated closure

Helps with https://github.com/rust-lang/rust/issues/96524. Based on https://github.com/rust-lang/rust/pull/100943 to avoid merge conflicts, so it looks larger than it is (only the last commit is relevant).

cc https://rust-lang.zulipchat.com/#narrow/stream/241847-t-compiler.2Fwg-incr-comp/topic/Moving.20.60Value.60.20to.20rustc_query_system.20.2396524

r? `@cjgillot`
2022-09-08 02:21:16 +00:00
Michael Goulet
48281b003f Adjust spacing in suggestion, add a test 2022-09-08 02:06:48 +00:00
Michael Goulet
30e3673d43 Add associated item binding to non-param-ty where clause suggestions 2022-09-08 02:06:48 +00:00
Michael Goulet
0dbbf0f493 Remove TypeParamVisitor 2022-09-08 01:54:59 +00:00
Michael Goulet
d0746e8863 Simplify printing operator lang item paths in error message 2022-09-08 01:54:59 +00:00
Michael Goulet
00c9d3d2ee Avoid source-map call in operator error 2022-09-08 01:54:59 +00:00
Michael Howell
6d2935da17 rustdoc: remove unused CSS #implementations-list > h3 > span.in-band
This was added in 51f26acaea to help with the
display of an `<h3>` tag that has a `<span class='in-band'>` inside.

The way implementation lists were rendered was changed in
34bd2b845b to have `<code class='in-band'>`,
making this CSS unused.

Then it was turned into a `<div>` in 9077d540da
without issue.

Finally, the header itself acquired the `in-band` class in
76a3b609d0.
2022-09-07 17:52:33 -07:00
bors
512bd84f51 Auto merge of #94075 - mikebenfield:wip-enum, r=oli-obk
Use niche-filling optimization even when multiple variants have data.

Fixes #46213
2022-09-07 23:40:06 +00:00
Eric Holk
578fc49fc1 Use HashStable_Generic in rustc_type_ir
A lot of the types in this crate implemented HashStable directly to
avoid circular dependencies. One way around that is to use
HashStable_Generic. We adopt that here to avoid a lot of boilerplate.

This doesn't update all the types, because some would require
`I: Interner + HashStable`.
2022-09-07 16:05:06 -07:00
bors
c2804e6ec2 Auto merge of #101544 - matthiaskrgr:rollup-4urx917, r=matthiaskrgr
Rollup of 14 pull requests

Successful merges:

 - #101343 (Add -api-level to pm command)
 - #101416 (stdio: Document no support for writing to non-blocking stdio/stderr)
 - #101435 (Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH`)
 - #101493 (Pass ImplTraitContext as &mut to avoid the need of ImplTraitContext::reborrow)
 - #101502 (Do not suggest a semicolon for a macro without `!`)
 - #101503 (Add debug calls)
 - #101506 (rustdoc: remove unused CSS `#main-content > .since`)
 - #101507 (rustdoc: remove unused CSS `#main-content > table td`)
 - #101521 (Rustdoc-Json: More accurate struct type.)
 - #101525 (Fix typo in pass_manager.rs)
 - #101534 (rustdoc: remove unused mobile CSS `.rustdoc { flex-direction }`)
 - #101535 (Fix error printing mistake in tidy)
 - #101536 (Add documentation for Attr::is_doc_comment)
 - #101538 (rustdoc: remove unused CSS `.content .methods > div`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-07 21:17:30 +00:00
Takayuki Maeda
bdc865d8f7 remove unnecessary PartialOrd and Ord 2022-09-08 06:15:33 +09:00
Santiago Pastorino
36fa12f1a4
Allow lower_lifetime_binder receive a closure 2022-09-07 18:01:01 -03:00
Michael Benfield
d7a750b504 Use niche-filling optimization even when multiple variants have data.
Fixes #46213
2022-09-07 20:12:45 +00:00
Michael Benfield
1a08b96a0b Change name of "dataful" variant to "untagged"
This is in anticipation of a new enum layout, in which the niche
optimization may be applied even when multiple variants have data.
2022-09-07 20:12:45 +00:00
bors
617417e9ad Auto merge of #9365 - c410-f3r:arith, r=Alexendoo
[Arithmetic] Consider literals

Fixes https://github.com/rust-lang/rust-clippy/issues/9307 and makes the `arithmetic` lint behave like `integer_arithmetic`.

It is worth noting that literal integers of a binary operation (`1 + 1`, `i32::MAX + 1`), **regardless if they are in a constant environment**, won't trigger the lint. Assign operations also have similar reasoning.

changelog: Consider literals in the arithmetic lint
2022-09-07 19:55:34 +00:00
Matthias Krüger
eae48c31cb
Rollup merge of #101538 - notriddle:notriddle/content-methods-div, r=GuillaumeGomez
rustdoc: remove unused CSS `.content .methods > div`

This selector has its roots in these commits:

  * current version:

    `.content .methods > div:not(.notable-traits):not(.method)` from 9077d540da

  * intermediate version:

    `.content .methods > div:not(.important-traits)` from d86621f69e

  * original version:

    `.content .methods > div { margin-left: 40px; }` from 0a46933c4d

Based on the call stack, where [`class='methods'`] calls `trait_item` and [`trait_item`] calls [`document`], this div selector was probably intended to target docblock and stability tags.

In the current version of the code, neither of these can possibly be nested directly below the `class='methods'` wrapper, because the [current version of the `trait_item` function] always wraps them in a `<details>` tag if they exist. The only div tag that can possibly be nested directly below it now is the one with class `method`, which is explicitly excluded.

[`class='methods'`]: 0a46933c4d/src/librustdoc/html/render.rs (L1811-L1842)

[`trait_item`]: 0a46933c4d/src/librustdoc/html/render.rs (L1807)

[`document`]: 0a46933c4d/src/librustdoc/html/render.rs (L1515-L1523)

[current version of the `trait_item` function]: e7c7aa7288/src/librustdoc/html/render/print_item.rs (L710)
2022-09-07 21:48:23 +02:00
Matthias Krüger
41e1830a43
Rollup merge of #101536 - GuillaumeGomez:is_doc_comment-doc, r=lqd
Add documentation for Attr::is_doc_comment

The function name is very misleading, some explanations won't hurt.

r? `@lqd`
2022-09-07 21:48:23 +02:00
Matthias Krüger
497e170503
Rollup merge of #101535 - est31:tidy_error_fix, r=Mark-Simulacrum
Fix error printing mistake in tidy

Fixes a small bug in the error printing code added by #100591 .
2022-09-07 21:48:22 +02:00
Matthias Krüger
09e7bb427e
Rollup merge of #101534 - rust-lang:notriddle/rustdoc-flex-direction, r=GuillaumeGomez
rustdoc: remove unused mobile CSS `.rustdoc { flex-direction }`

According to MDN, [flex-direction] only applies to [flex containers], which are boxes with `display: flex` or `inline-flex`.

However, the `.rustdoc` body container is not a flex-container on mobile. A few lines above, it's set to `display: block`, so this selector does not have any effect.

[flex-direction]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction

[flex containers]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox#the_flex_container
2022-09-07 21:48:21 +02:00
Matthias Krüger
acb3d11f1b
Rollup merge of #101525 - eltociear:patch-16, r=cjgillot
Fix typo in pass_manager.rs

overriden -> overridden
2022-09-07 21:48:20 +02:00
Matthias Krüger
8d21e97d64
Rollup merge of #101521 - aDotInTheVoid:rdj-structkind, r=GuillaumeGomez
Rustdoc-Json: More accurate struct type.

Closes #101489

r? `@GuillaumeGomez`
2022-09-07 21:48:19 +02:00
Matthias Krüger
fbae06e75f
Rollup merge of #101507 - notriddle:notriddle/main-content-table-td, r=GuillaumeGomez
rustdoc: remove unused CSS `#main-content > table td`

This rule was added in 4e2c59a970 to benefit the module items table. However, the module items table stopped using table tags when 6020c79dde switched us over to grid layout.

You can see when this one used to be triggered by visiting <https://doc.rust-lang.org/1.54.0/alloc/slice/index.html#structs-1> in a very narrow window, but it doesn't any more, because the module table is now rendered using `<div>` tags.
2022-09-07 21:48:18 +02:00
Matthias Krüger
46fe72b359
Rollup merge of #101506 - notriddle:notriddle/rustdoc-main-since-2, r=GuillaumeGomez
rustdoc: remove unused CSS `#main-content > .since`

I missed one from #101298
2022-09-07 21:48:17 +02:00
Matthias Krüger
0a1c816dcd
Rollup merge of #101503 - spastorino:add-debug-calls, r=compiler-errors
Add debug calls

`@oli-obk` requested this and other changes as a way of simplifying https://github.com/rust-lang/rust/pull/101345. This is just going to make the diff of https://github.com/rust-lang/rust/pull/101345 smaller.

r? `@oli-obk` `@cjgillot`
2022-09-07 21:48:16 +02:00
Matthias Krüger
c365ce3ffd
Rollup merge of #101502 - TaKO8Ki:do-not-suggest-semicolon-for-macro-without-exclamation-mark, r=wesleywiser
Do not suggest a semicolon for a macro without `!`

Fixes a regression in #101490
2022-09-07 21:48:15 +02:00
Matthias Krüger
9361297dfc
Rollup merge of #101493 - spastorino:borrow-mut-impl-trait-context, r=oli-obk
Pass ImplTraitContext as &mut to avoid the need of ImplTraitContext::reborrow

`@oli-obk` requested this and other changes as a way of simplifying #101345. This is just going to make the diff of #101345 smaller.

r? `@oli-obk` `@cjgillot`
2022-09-07 21:48:14 +02:00
Matthias Krüger
1d65e9619d
Rollup merge of #101435 - JakobDegen:bitwidth-tests, r=wesleywiser
Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH`

This commit removes the annotation only for those tests where the 32 bit and 64 bit files were exactly identical. I didn't touch anything in the `mir-opt/const` directory, since having this annotation there seems more principled, even if it doesn't make a difference.

This also removes four additional files related to the `separate_const_switch.rs` test. The associated annotations were removed in #100827 , but I forgot to remove the files as well. (#97564 is the issue tracking an automated check here)

r? ```@wesleywiser```
2022-09-07 21:48:13 +02:00
Matthias Krüger
d1ebba41c1
Rollup merge of #101416 - uarif1:doc_non_blocking_stdio, r=joshtriplett
stdio: Document no support for writing to non-blocking stdio/stderr

Printing to stdio/stderr that have been opened with non-blocking
(O_NONBLOCK in linux) can result in an error, which is not handled
by std::io module causing a panic.

Signed-off-by: Usama Arif <usama.arif@bytedance.com>
2022-09-07 21:48:12 +02:00
Matthias Krüger
870a46df88
Rollup merge of #101343 - diminishedprime:patch-3, r=tmandry
Add -api-level to pm command

As of ~Aug 30th, `pm build` commands require an `api-level` flag. This flag should match the fuchsia api-level that's being targeted by the code. Since this is dependent on the version of the SDK that's being used, we may want to change this to something a bit more robust in the future.
2022-09-07 21:48:11 +02:00
bors
da29f8928d Auto merge of #9441 - Jarcho:hang_9433, r=Alexendoo
Fix hang in `vec_init_then_push`

fixes #9433
changelog: Fix infinite loop in `vec_init_then_push`
2022-09-07 19:43:00 +00:00
Jason Newcomb
15859323ea Fix hang in vec_init_then_push 2022-09-07 15:26:44 -04:00
bors
9682b5d3a3 Auto merge of #101476 - ChrisDenton:BCryptRandom-fix, r=thomcc
Open a BCrypt algorithm handle

Fixes #101474, supplants #101456.

Replaces use of a pseduo handle with manually opening a algorithm handle.

Most interesting thing here is the atomics.

r? `@thomcc`
2022-09-07 18:54:03 +00:00
Michael Howell
43681db48d rustdoc: remove unused CSS #main-content > table td
This rule was added in 4e2c59a970
to benefit the module items table. However, the module items table stopped
using table tags when 6020c79dde
switched us over to grid layout.

You can see when this one used to be triggered by visiting
<https://doc.rust-lang.org/1.54.0/alloc/slice/index.html#structs-1> in a
very narrow window, but it doesn't any more, because the module table is
now rendered using `<div>` tags.
2022-09-07 09:52:49 -07:00
bors
f91ca2878a Auto merge of #101522 - oli-obk:miriup, r=oli-obk
Update miri submodule

fixes #101344

cc `@rust-lang/miri`

r? `@ghost`
2022-09-07 16:31:39 +00:00
Maurits van Riezen
5fbe485ecc
Typo 2022-09-07 17:53:47 +02:00
Michael Howell
10fc2ff806 rustdoc: remove unused CSS .content .methods > div
This selector has its roots in these commits:

  * current version:

    `.content .methods > div:not(.notable-traits):not(.method)` from
    9077d540da

  * intermediate version:

    `.content .methods > div:not(.important-traits)` from
    d86621f69e

  * original version:

    `.content .methods > div { margin-left: 40px; }` from
    0a46933c4d

Based on the call stack, where [`class='methods'`] calls `trait_item` and
[`trait_item`] calls [`document`], this div selector was probably intended to
target docblock and stability tags.

In the current version of the code, neither of these can possibly be nested
directly below the `class='methods'` wrapper, because the [current version of
the `trait_item` function] always wraps them in a `<details>` tag if they
exist. The only div tag that can possibly be nested directly below it now is
the one with class `method`, which is explicitly excluded.

[`class='methods'`]: 0a46933c4d/src/librustdoc/html/render.rs (L1811-L1842)

[`trait_item`]: 0a46933c4d/src/librustdoc/html/render.rs (L1807)

[`document`]: 0a46933c4d/src/librustdoc/html/render.rs (L1515-L1523)

[current version of the `trait_item` function]: e7c7aa7288/src/librustdoc/html/render/print_item.rs (L710)
2022-09-07 08:42:31 -07:00
Oli Scherer
419c4e1c4f Update miri submodule 2022-09-07 15:42:12 +00:00
Maurits van Riezen
0a9b49c794
Add doctest 2022-09-07 16:36:32 +02:00
bors
567e1bbca7 Auto merge of #101432 - nnethercote:shrink-PredicateS, r=lcnr
Shrink `PredicateS`

r? `@ghost`
2022-09-07 13:49:58 +00:00
bors
a4d034126d Auto merge of #101432 - nnethercote:shrink-PredicateS, r=lcnr
Shrink `PredicateS`

r? `@ghost`
2022-09-07 13:49:58 +00:00
est31
dc2af5f876 Fix error printing mistake in tidy 2022-09-07 15:48:11 +02:00
Santiago Pastorino
d42afd2bd1
Format hir_id_validator error using pretty print 2022-09-07 10:46:17 -03:00
Santiago Pastorino
e3a738a942
Add instrument and debug calls 2022-09-07 10:46:14 -03:00