]> git.lizzy.rs Git - rust.git/log
rust.git
17 months agoadd example of joining with a absolute path
Valdemar Erk [Fri, 20 Jan 2023 11:03:43 +0000 (12:03 +0100)]
add example of joining with a absolute path

17 months agoAdd note about absolute paths to Path::join
Valdemar Erk [Fri, 20 Jan 2023 10:16:38 +0000 (11:16 +0100)]
Add note about absolute paths to Path::join

17 months agoFix typo in opaque_types.rs
Ikko Eltociear Ashimine [Fri, 20 Jan 2023 08:56:29 +0000 (17:56 +0900)]
Fix typo in opaque_types.rs

paramters -> parameters

17 months agoAdd `compile_fail` to doctest for `bindings_with_variant_name`
--global [Tue, 8 Nov 2022 16:01:03 +0000 (11:01 -0500)]
Add `compile_fail` to doctest for `bindings_with_variant_name`

17 months agoChange `bindings_with_variant_name` to deny-by-default
--global [Tue, 8 Nov 2022 15:24:06 +0000 (10:24 -0500)]
Change `bindings_with_variant_name` to deny-by-default

17 months agoThinBox: Add intra-doc-links for Metadata
est31 [Fri, 20 Jan 2023 07:07:45 +0000 (08:07 +0100)]
ThinBox: Add intra-doc-links for Metadata

17 months agoRollup merge of #107068 - mejrs:use_derive, r=estebank
Matthias Krüger [Fri, 20 Jan 2023 06:25:30 +0000 (07:25 +0100)]
Rollup merge of #107068 - mejrs:use_derive, r=estebank

autoderive Subdiagnostic for AddtoExternBlockSuggestion

17 months agoRollup merge of #107065 - flip1995:clippyup, r=Manishearth
Matthias Krüger [Fri, 20 Jan 2023 06:25:29 +0000 (07:25 +0100)]
Rollup merge of #107065 - flip1995:clippyup, r=Manishearth

Clippy: Make sure to include in beta: Move `unchecked_duration_subtraction` to pedantic

This was merged one day too late in order to make it into the last sync. But since we talked about moving this lint to `pedantic` in the meeting, I'd like to get this in rather sooner than later.

https://github.com/rust-lang/rust-clippy/pull/10194

r? ``@Manishearth``

17 months agoRollup merge of #106928 - bvanjoi:print-keyword-raw-identifier, r=petrochenkov
Matthias Krüger [Fri, 20 Jan 2023 06:25:29 +0000 (07:25 +0100)]
Rollup merge of #106928 - bvanjoi:print-keyword-raw-identifier, r=petrochenkov

add raw identifier for keyword in suggestion

fix https://github.com/rust-lang/rust/issues/106841

17 months agoRollup merge of #106891 - estebank:issue-45727, r=petrochenkov
Matthias Krüger [Fri, 20 Jan 2023 06:25:28 +0000 (07:25 +0100)]
Rollup merge of #106891 - estebank:issue-45727, r=petrochenkov

Tweak "borrow closure argument" suggestion

Fix #45727.

17 months agoRollup merge of #106738 - compiler-errors:known-bugs-oops, r=jackh726
Matthias Krüger [Fri, 20 Jan 2023 06:25:28 +0000 (07:25 +0100)]
Rollup merge of #106738 - compiler-errors:known-bugs-oops, r=jackh726

Fix known-bug annotations

r? ``@Nilstrieb``

17 months agoRollup merge of #106699 - eholk:await-chains-drop-tracking, r=wesleywiser
Matthias Krüger [Fri, 20 Jan 2023 06:25:27 +0000 (07:25 +0100)]
Rollup merge of #106699 - eholk:await-chains-drop-tracking, r=wesleywiser

[drop tracking] Visit break expressions

This fixes https://github.com/rust-lang/rust/issues/102383 by remembering to visit the expression in `break expr` when building the drop tracking CFG. Missing this step was causing an off-by-one error which meant after a number of awaits we'd be
looking for dropped values at the wrong point in the code.

Additionally, this changes the order of traversal for assignment expressions to visit the rhs and then the lhs. This matches what is done elsewhere.

Finally, this improves some of the debugging output (for example, the CFG visualizer) to make it easier to figure out these sorts of issues.

17 months agoRollup merge of #107091 - clubby789:infer-ftl-missing-dollar, r=compiler-errors
Matthias Krüger [Fri, 20 Jan 2023 06:16:12 +0000 (07:16 +0100)]
Rollup merge of #107091 - clubby789:infer-ftl-missing-dollar, r=compiler-errors

Fix broken format strings in `infer.ftl`

Fixes #107088

17 months agoRollup merge of #107076 - megakorre:106419_add_test_case, r=compiler-errors
Matthias Krüger [Fri, 20 Jan 2023 06:16:11 +0000 (07:16 +0100)]
Rollup merge of #107076 - megakorre:106419_add_test_case, r=compiler-errors

Added const-generic ui test case for issue #106419

This PR adds a test case for #106419 which has been fixed in master by #105292

I also ran the test on f769d34291e489db19d3c972348ddb24b6b32481 (the commit before #105292 was merged)
and it did fail there with the following output.
```
--- stderr -------------------------------
error[E0308]: mismatched types
  --> /home/patrikk/src/rust/src/test/ui/const-generics/issue-106419-struct-with-multiple-const-params.rs:5:10
   |
LL | #[derive(Clone)]
   |          ^^^^^
   |          |
   |          expected `A`, found `B`
   |          expected `Bar<A, B>` because of return type
   |
   = note: expected struct `Bar<A, _>`
              found struct `Bar<B, _>`
   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
------------------------------------------
```

17 months agoRollup merge of #107067 - tmiasko:custom-mir-storage-statements, r=oli-obk
Matthias Krüger [Fri, 20 Jan 2023 06:16:11 +0000 (07:16 +0100)]
Rollup merge of #107067 - tmiasko:custom-mir-storage-statements, r=oli-obk

Custom MIR: Support storage statements

r? `@oli-obk` `@JakobDegen`

17 months agoRollup merge of #107058 - clubby789:eqeq-homoglyph, r=wesleywiser
Matthias Krüger [Fri, 20 Jan 2023 06:16:10 +0000 (07:16 +0100)]
Rollup merge of #107058 - clubby789:eqeq-homoglyph, r=wesleywiser

Recognise double-equals homoglyph

Recognise `⩵` as a homoglyph for `==`.

The first commit switches `char` to `&str`, as all previous homoglyphs corresponded to a single ASCII character, while the second implements the fix.

`@rustbot` label +A-diagnostics +A-parser

17 months agoRollup merge of #107053 - devnexen:sigstringrepr_haiku, r=thomcc
Matthias Krüger [Fri, 20 Jan 2023 06:16:10 +0000 (07:16 +0100)]
Rollup merge of #107053 - devnexen:sigstringrepr_haiku, r=thomcc

signal update string representation for haiku.

17 months agoRollup merge of #106979 - Nilstrieb:type-of-default-assoc-type, r=petrochenkov
Matthias Krüger [Fri, 20 Jan 2023 06:16:09 +0000 (07:16 +0100)]
Rollup merge of #106979 - Nilstrieb:type-of-default-assoc-type, r=petrochenkov

Document how to get the type of a default associated type

17 months agoRollup merge of #106973 - oli-obk:tait_ice_closure_in_impl_header, r=lcnr
Matthias Krüger [Fri, 20 Jan 2023 06:16:09 +0000 (07:16 +0100)]
Rollup merge of #106973 - oli-obk:tait_ice_closure_in_impl_header, r=lcnr

Don't treat closures from other crates as local

fixes #104817

r? `@lcnr`

Specialization can prefer an impl for an opaque type over a blanket impls that also matches. If the blanket impl only applies if an auto-trait applies, we look at the hidden type of the opaque type to see if that implements the auto trait. The hidden type can be a closure or generator, and thus we will end up seeing these types in coherence and have to handle them properly.

17 months agoRollup merge of #106783 - WaffleLapkin:break-my-ident, r=wesleywiser
Matthias Krüger [Fri, 20 Jan 2023 06:16:08 +0000 (07:16 +0100)]
Rollup merge of #106783 - WaffleLapkin:break-my-ident, r=wesleywiser

Recover labels written as identifiers

This adds recovery for `break label expr` and `continue label`, as well as a test for `break label`.

17 months agoAuto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb
bors [Fri, 20 Jan 2023 04:52:28 +0000 (04:52 +0000)]
Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb

Remove some `ref` patterns from the compiler

Previous PR: https://github.com/rust-lang/rust/pull/105368

r? `@Nilstrieb`

17 months agoFilter predicates first for fast-path type flags
Michael Goulet [Fri, 20 Jan 2023 03:20:17 +0000 (03:20 +0000)]
Filter predicates first for fast-path type flags

17 months agoAuto merge of #107083 - GuillaumeGomez:revert-104889, r=notriddle
bors [Fri, 20 Jan 2023 01:55:36 +0000 (01:55 +0000)]
Auto merge of #107083 - GuillaumeGomez:revert-104889, r=notriddle

rustdoc: Revert #104889

Reverts #104889.

I don't think I'll be able to finish https://github.com/rust-lang/rust/pull/107000 on time unfortunately so to prevent https://github.com/rust-lang/rust/issues/106373, better to revert it and to make it into the next release.

r? `@notriddle`

17 months agorustdoc: remove redundant CSS selector `.sidebar .current`
Michael Howell [Thu, 19 Jan 2023 23:30:05 +0000 (16:30 -0700)]
rustdoc: remove redundant CSS selector `.sidebar .current`

Since the current sidebar item is already a link, it doesn't
do anything.

17 months agoFix broken format strings in `infer.ftl`
clubby789 [Thu, 19 Jan 2023 23:13:01 +0000 (23:13 +0000)]
Fix broken format strings in `infer.ftl`

17 months agoAuto merge of #107072 - weihanglo:update-cargo, r=weihanglo
bors [Thu, 19 Jan 2023 22:40:12 +0000 (22:40 +0000)]
Auto merge of #107072 - weihanglo:update-cargo, r=weihanglo

Update cargo

3 commits in a5d47a72595dd6fbe7d4e4f6ec20dc5fe724edd1..50eb688c2bbea5de5a2e8496230a7428798089d1 2023-01-16 18:51:50 +0000 to 2023-01-19 10:09:05 +0000

- Normalize git deps when doing `cargo vendor` for resolving deps inherited from a workspace (rust-lang/cargo#11414)
- Ignore `workspace.default-members` when running `cargo install` on root package of a non-virtual workspace (rust-lang/cargo#11067)
- Corrected documentation of how to cache binaries installed with `cargo install` in CI workflows (rust-lang/cargo#11592)

r? `@ghost`

17 months agoMake bare known-bug an error
Michael Goulet [Wed, 11 Jan 2023 19:44:49 +0000 (19:44 +0000)]
Make bare known-bug an error

17 months agoFix known-bug, silence ICE stderr
Michael Goulet [Wed, 11 Jan 2023 19:42:27 +0000 (19:42 +0000)]
Fix known-bug, silence ICE stderr

17 months agoTweak "borrow closure argument" suggestion
Esteban Küber [Sat, 14 Jan 2023 23:53:56 +0000 (23:53 +0000)]
Tweak "borrow closure argument" suggestion

Fix #45727.

17 months agoRevert "Fix missing const expression items visit"
Guillaume Gomez [Thu, 19 Jan 2023 19:28:17 +0000 (20:28 +0100)]
Revert "Fix missing const expression items visit"

This reverts commit cdfc5051b1286938f56160243c28538f79dce6b1.

17 months agoRevert "Add regression test for impl blocks in const expr"
Guillaume Gomez [Thu, 19 Jan 2023 19:27:37 +0000 (20:27 +0100)]
Revert "Add regression test for impl blocks in const expr"

This reverts commit 9cce0bc583ee2cff88935ce0e08d8ec1eb1239a8.

17 months agoRevert "Update newly failing UI tests"
Guillaume Gomez [Thu, 19 Jan 2023 19:27:00 +0000 (20:27 +0100)]
Revert "Update newly failing UI tests"

This reverts commit 9c46173895430c63066731440e00faf0ab2195dd.

17 months agoRevert "Improve code readability"
Guillaume Gomez [Thu, 19 Jan 2023 19:26:01 +0000 (20:26 +0100)]
Revert "Improve code readability"

This reverts commit eb93d1bedeab64c6f5d661df6a309a5b8a9273ca.

17 months agoRevert "Speed up execution a bit by removing some walks"
Guillaume Gomez [Thu, 19 Jan 2023 19:25:53 +0000 (20:25 +0100)]
Revert "Speed up execution a bit by removing some walks"

This reverts commit a9d582f51f547583380f2f2894ae0c799b609a86.

17 months agoRevert "Improve code"
Guillaume Gomez [Thu, 19 Jan 2023 19:25:46 +0000 (20:25 +0100)]
Revert "Improve code"

This reverts commit a954d6334d000225ae38f65f5f9e9c182e6764ae.

17 months agoAuto merge of #107038 - compiler-errors:dont-wfcheck-non-local-rpit, r=oli-obk
bors [Thu, 19 Jan 2023 16:49:06 +0000 (16:49 +0000)]
Auto merge of #107038 - compiler-errors:dont-wfcheck-non-local-rpit, r=oli-obk

Don't wf-check non-local RPITs

We were using `ty::is_impl_trait_defn(..).is_none()` to check if we need to add WF obligations for an opaque type.

This is *supposed* to be checking if the type is a TAIT, since RPITs' wfness is implied by wf checking its parent item, but since `is_impl_trait_defn` returns `None` for non-local RPIT and async futures, we unnecessarily consider wf predicates for an RPIT if it is coming from a foreign crate.

Fixes #107036

r? `@oli-obk` but feel free to reassign

17 months agoClean up and document unord collections a bit.
Michael Woerister [Thu, 19 Jan 2023 16:37:59 +0000 (17:37 +0100)]
Clean up and document unord collections a bit.

17 months agoadd raw identifier for keyword in suggestion
bohan [Mon, 16 Jan 2023 07:09:05 +0000 (15:09 +0800)]
add raw identifier for keyword in suggestion

17 months agotrait solver: Implement Fn traits and tuple trait
Michael Goulet [Thu, 19 Jan 2023 01:20:34 +0000 (01:20 +0000)]
trait solver: Implement Fn traits and tuple trait

17 months agotrait solver: PointerSized
Michael Goulet [Wed, 18 Jan 2023 23:21:12 +0000 (23:21 +0000)]
trait solver: PointerSized

17 months agoswap Ambiguity and Unimplemented in new trait engine
Michael Goulet [Thu, 19 Jan 2023 04:50:14 +0000 (04:50 +0000)]
swap Ambiguity and Unimplemented in new trait engine

17 months agoAssert goal is fully normalized during assemble
Michael Goulet [Thu, 19 Jan 2023 15:32:20 +0000 (15:32 +0000)]
Assert goal is fully normalized during assemble

17 months agoConditionally encode boolean
Michael Goulet [Thu, 19 Jan 2023 16:09:10 +0000 (16:09 +0000)]
Conditionally encode boolean

17 months agoSpecial case `derive(Debug)` for fieldless enums
clubby789 [Thu, 19 Jan 2023 15:52:29 +0000 (15:52 +0000)]
Special case `derive(Debug)` for fieldless enums

17 months agoAdd test
Michael Goulet [Wed, 18 Jan 2023 18:11:19 +0000 (18:11 +0000)]
Add test

17 months agoEncode whether foreign opaques are TAITs or not
Michael Goulet [Wed, 18 Jan 2023 18:03:06 +0000 (18:03 +0000)]
Encode whether foreign opaques are TAITs or not

17 months agoAdd enum for fieldless unification
clubby789 [Sat, 14 Jan 2023 21:16:25 +0000 (21:16 +0000)]
Add enum for fieldless unification

17 months agoHACK: self ty ambiguity hack
Michael Goulet [Thu, 19 Jan 2023 03:26:54 +0000 (03:26 +0000)]
HACK: self ty ambiguity hack

17 months agoFix IndexVec::drain_enumerated
Michael Goulet [Thu, 19 Jan 2023 15:24:00 +0000 (15:24 +0000)]
Fix IndexVec::drain_enumerated

17 months agoAdded UI test case for issue #106419
Patrik Kårlin [Thu, 19 Jan 2023 14:39:05 +0000 (15:39 +0100)]
Added UI test case for issue #106419

17 months agoUpdate cargo
Weihang Lo [Thu, 19 Jan 2023 14:18:36 +0000 (14:18 +0000)]
Update cargo

3 commits in a5d47a72595dd6fbe7d4e4f6ec20dc5fe724edd1..50eb688c2bbea5de5a2e8496230a7428798089d1
2023-01-16 18:51:50 +0000 to 2023-01-19 10:09:05 +0000

- Normalize git deps when doing `cargo vendor` for resolving deps inherited from a workspace (rust-lang/cargo#11414)
- Ignore `workspace.default-members` when running `cargo install` on root package of a non-virtual workspace (rust-lang/cargo#11067)
- Corrected documentation of how to cache binaries installed with `cargo install` in CI workflows (rust-lang/cargo#11592)

17 months agoAuto merge of #106910 - aliemjay:alias-ty-in-regionck, r=oli-obk
bors [Thu, 19 Jan 2023 14:05:07 +0000 (14:05 +0000)]
Auto merge of #106910 - aliemjay:alias-ty-in-regionck, r=oli-obk

even more unify Projection/Opaque handling in region outlives code

edit: This continues ate the same pace as #106829. New changes are described in https://github.com/rust-lang/rust/pull/106910#issuecomment-1383251254.

~This touches `OutlivesBound`, `Component`, `GenericKind` enums.~

r? `@oli-obk` (because of overlap with #95474)

17 months agoAutoderive ExternBlockSuggestion
mejrs [Thu, 19 Jan 2023 12:52:15 +0000 (13:52 +0100)]
Autoderive ExternBlockSuggestion

17 months agoadd test for ICE fix
Ali MJ Al-Nasrawy [Sun, 15 Jan 2023 22:35:51 +0000 (01:35 +0300)]
add test for ICE fix

17 months agoeven more unify Projection/Opaque in outlives code
Ali MJ Al-Nasrawy [Sun, 15 Jan 2023 16:38:31 +0000 (19:38 +0300)]
even more unify Projection/Opaque in outlives code

17 months agoDon't treat closures from other crates as local
Oli Scherer [Tue, 17 Jan 2023 09:39:35 +0000 (09:39 +0000)]
Don't treat closures from other crates as local

17 months agoAuto merge of #107064 - GuillaumeGomez:rollup-pbgu6r3, r=GuillaumeGomez
bors [Thu, 19 Jan 2023 11:12:31 +0000 (11:12 +0000)]
Auto merge of #107064 - GuillaumeGomez:rollup-pbgu6r3, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #105977 (Transform async `ResumeTy` in generator transform)
 - #106927 (make `CastError::NeedsDeref` create a `MachineApplicable` suggestion)
 - #106931 (document + UI test `E0208` and make its output more user-friendly)
 - #107027 (Remove extra removal from test path)
 - #107037 (Fix Dominators::rank_partial_cmp to match documentation)

Failed merges:

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

17 months agoCustom MIR: Support storage statements
Tomasz Miąsko [Thu, 19 Jan 2023 00:00:00 +0000 (00:00 +0000)]
Custom MIR: Support storage statements

17 months agoRollup merge of #107037 - tmiasko:rank, r=oli-obk
Guillaume Gomez [Thu, 19 Jan 2023 10:19:36 +0000 (11:19 +0100)]
Rollup merge of #107037 - tmiasko:rank, r=oli-obk

Fix Dominators::rank_partial_cmp to match documentation

The only use site is also updated accordingly and there is no change in end-to-end behaviour.

17 months agoRollup merge of #107027 - GuillaumeGomez:rm-extra-removal, r=tmiasko
Guillaume Gomez [Thu, 19 Jan 2023 10:19:36 +0000 (11:19 +0100)]
Rollup merge of #107027 - GuillaumeGomez:rm-extra-removal, r=tmiasko

Remove extra removal from test path

I don't know how to describe it shortly so better show what it's doing instead. Currently, there is one extra "rust/" before the test folder when running tests:

```
failures:

---- [rustdoc] rust/tests/rustdoc/redirect.rs stdout ----
```

This is a bit annoying when copying the test path. This is due to the moving of the `tests` folder one level up, meaning we were trimming too much of the `root_path`.

Now it is again displaying the correct path:

```
failures:

---- [rustdoc] tests/rustdoc/redirect.rs stdout ----
```

17 months agoRollup merge of #106931 - Ezrashaw:docs-e0208, r=compiler-errors
Guillaume Gomez [Thu, 19 Jan 2023 10:19:35 +0000 (11:19 +0100)]
Rollup merge of #106931 - Ezrashaw:docs-e0208, r=compiler-errors

document + UI test `E0208` and make its output more user-friendly

Cleans up `E0208`'s output a lot. It could actually be useful for someone learning about variance now. I also added a UI test for it in `tests/ui/error-codes/` and wrote some docs for it.

r? `@GuillaumeGomez` another error code, can't be bothered to find the issue :P. Obviously there's some compiler stuff, so you'll have to hand it off.

Part of https://github.com/rust-lang/rust/issues/61137.

17 months agoRollup merge of #106927 - Ezrashaw:e0606-make-machine-applicable, r=estebank
Guillaume Gomez [Thu, 19 Jan 2023 10:19:34 +0000 (11:19 +0100)]
Rollup merge of #106927 - Ezrashaw:e0606-make-machine-applicable, r=estebank

make `CastError::NeedsDeref` create a `MachineApplicable` suggestion

Fixes #106903

Simple impl for the linked issue. I also made some other small changes:
- `CastError::ErrorGuaranteed` now owns an actual `ErrorGuaranteed`. This better enforces the static guarantees of `ErrorGuaranteed`.
- `CastError::NeedDeref` code simplified a bit, we now just suggest the `*`, instead of the whole expression as well.

17 months agoRollup merge of #105977 - Swatinem:async-mir-context, r=oli-obk
Guillaume Gomez [Thu, 19 Jan 2023 10:19:34 +0000 (11:19 +0100)]
Rollup merge of #105977 - Swatinem:async-mir-context, r=oli-obk

Transform async `ResumeTy` in generator transform

- Eliminates all the `get_context` calls that async lowering created.
- Replace all `Local` `ResumeTy` types with `&mut Context<'_>`.

The `Local`s that have their types replaced are:
- The `resume` argument itself.
- The argument to `get_context`.
- The yielded value of a `yield`.

The `ResumeTy` hides a `&mut Context<'_>` behind an unsafe raw pointer, and the `get_context` function is being used to convert that back to a `&mut Context<'_>`.

Ideally the async lowering would not use the `ResumeTy`/`get_context` indirection, but rather directly use `&mut Context<'_>`, however that would currently lead to higher-kinded lifetime errors.
See <https://github.com/rust-lang/rust/issues/105501>.

The async lowering step and the type / lifetime inference / checking are still using the `ResumeTy` indirection for the time being, and that indirection is removed here. After this transform, the generator body only knows about `&mut Context<'_>`.

---

Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1330 CC `@bjorn3`

r? `@compiler-errors`

17 months agoMove `unchecked_duration_subtraction` to pedantic
Alex Macleod [Fri, 13 Jan 2023 00:04:28 +0000 (00:04 +0000)]
Move `unchecked_duration_subtraction` to pedantic

17 months agoAllow for more efficient sorting when exporting Unord collections.
Michael Woerister [Wed, 18 Jan 2023 09:47:31 +0000 (10:47 +0100)]
Allow for more efficient sorting when exporting Unord collections.

17 months agoUse UnordMap instead of FxHashMap in define_id_collections!().
Michael Woerister [Tue, 17 Jan 2023 11:05:01 +0000 (12:05 +0100)]
Use UnordMap instead of FxHashMap in define_id_collections!().

17 months agoUse UnordSet instead of FxHashSet in define_id_collections!().
Michael Woerister [Fri, 2 Dec 2022 15:27:25 +0000 (16:27 +0100)]
Use UnordSet instead of FxHashSet in define_id_collections!().

17 months agoCreate new bootstrap team
Albert Larsan [Thu, 19 Jan 2023 08:15:57 +0000 (08:15 +0000)]
Create new bootstrap team

17 months agoAuto merge of #106989 - clubby789:is-zero-num, r=scottmcm
bors [Thu, 19 Jan 2023 08:04:26 +0000 (08:04 +0000)]
Auto merge of #106989 - clubby789:is-zero-num, r=scottmcm

Implement `alloc::vec::IsZero` for `Option<$NUM>` types

Fixes #106911

Mirrors the `NonZero$NUM` implementations with an additional `assert_zero_valid`.
`None::<i32>` doesn't stricly satisfy `IsZero` but for the purpose of allocating we can produce more efficient codegen.

17 months agoTransform async ResumeTy in generator transform
Arpad Borsos [Tue, 20 Dec 2022 14:15:29 +0000 (15:15 +0100)]
Transform async ResumeTy in generator transform

- Eliminates all the `get_context` calls that async lowering created.
- Replace all `Local` `ResumeTy` types with `&mut Context<'_>`.

The `Local`s that have their types replaced are:
- The `resume` argument itself.
- The argument to `get_context`.
- The yielded value of a `yield`.

The `ResumeTy` hides a `&mut Context<'_>` behind an unsafe raw pointer, and the
`get_context` function is being used to convert that back to a `&mut Context<'_>`.

Ideally the async lowering would not use the `ResumeTy`/`get_context` indirection,
but rather directly use `&mut Context<'_>`, however that would currently
lead to higher-kinded lifetime errors.
See <https://github.com/rust-lang/rust/issues/105501>.

The async lowering step and the type / lifetime inference / checking are
still using the `ResumeTy` indirection for the time being, and that indirection
is removed here. After this transform, the generator body only knows about `&mut Context<'_>`.

17 months agoAuto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkov
bors [Thu, 19 Jan 2023 05:23:40 +0000 (05:23 +0000)]
Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkov

Various cleanups around pre-TyCtxt queries and functions

part of #105462

based on https://github.com/rust-lang/rust/pull/106776 (everything starting at [0e2b39f](https://github.com/rust-lang/rust/pull/106810/commits/0e2b39fd1ffde51b50d45ccbe41de52b85136b8b) is new in this PR)

r? `@petrochenkov`

I think this should be most of the uncontroversial part of #105462.

17 months agoAdd double-equals homoglyph
clubby789 [Thu, 19 Jan 2023 02:25:24 +0000 (02:25 +0000)]
Add double-equals homoglyph

17 months agoUse strings for homoglyph replacements
clubby789 [Thu, 19 Jan 2023 02:24:51 +0000 (02:24 +0000)]
Use strings for homoglyph replacements

17 months agoAuto merge of #107052 - compiler-errors:rollup-vxr22g5, r=compiler-errors
bors [Thu, 19 Jan 2023 02:09:45 +0000 (02:09 +0000)]
Auto merge of #107052 - compiler-errors:rollup-vxr22g5, r=compiler-errors

Rollup of 8 pull requests

Successful merges:

 - #105796 (rustdoc: simplify JS search routine by not messing with lev distance)
 - #106753 (Make sure that RPITITs are not considered suggestable)
 - #106917 (Encode const mir for closures if they're const)
 - #107004 (Implement some candidates for the new solver (redux))
 - #107023 (Stop using `BREAK` & `CONTINUE` in compiler)
 - #107030 (Correct typo)
 - #107042 (rustdoc: fix corner cases with "?" JS keyboard command)
 - #107045 (rustdoc: remove redundant CSS rule `#settings .setting-line`)

Failed merges:

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

17 months agosignal update string representation for haiku.
David Carlier [Wed, 18 Jan 2023 23:06:59 +0000 (23:06 +0000)]
signal update string representation for haiku.

17 months agoRollup merge of #107045 - notriddle:notriddle/settings-css-setting-line, r=GuillaumeGomez
Michael Goulet [Wed, 18 Jan 2023 23:00:31 +0000 (18:00 -0500)]
Rollup merge of #107045 - notriddle:notriddle/settings-css-setting-line, r=GuillaumeGomez

rustdoc: remove redundant CSS rule `#settings .setting-line`

Since the current version of settings.js always nests things below a div with ID `settings`, this rule always overrode the one above.

17 months agoRollup merge of #107042 - notriddle:notriddle/rustdoc-js-question, r=GuillaumeGomez
Michael Goulet [Wed, 18 Jan 2023 23:00:31 +0000 (18:00 -0500)]
Rollup merge of #107042 - notriddle:notriddle/rustdoc-js-question, r=GuillaumeGomez

rustdoc: fix corner cases with "?" JS keyboard command

17 months agoRollup merge of #107030 - albertlarsan68:patch-3, r=lcnr
Michael Goulet [Wed, 18 Jan 2023 23:00:30 +0000 (18:00 -0500)]
Rollup merge of #107030 - albertlarsan68:patch-3, r=lcnr

Correct typo

https://github.com/rust-lang/rust/pull/106718#discussion_r1073508490

17 months agoRollup merge of #107023 - scottmcm:stop-shouting, r=Nilstrieb
Michael Goulet [Wed, 18 Jan 2023 23:00:30 +0000 (18:00 -0500)]
Rollup merge of #107023 - scottmcm:stop-shouting, r=Nilstrieb

Stop using `BREAK` & `CONTINUE` in compiler

Switching them to `Break(())` and `Continue(())` instead.

Entirely search-and-replace, though there's one spot where rustfmt insisted on a reformatting too.

libs-api would like to remove these constants (https://github.com/rust-lang/rust/pull/102697#issuecomment-1385705202), so stop using them in compiler to make the removal PR later smaller.

17 months agoRollup merge of #107004 - compiler-errors:new-solver-new-candidates-2, r=lcnr
Michael Goulet [Wed, 18 Jan 2023 23:00:29 +0000 (18:00 -0500)]
Rollup merge of #107004 - compiler-errors:new-solver-new-candidates-2, r=lcnr

Implement some candidates for the new solver (redux)

Based on #106718, so the diff is hard to read without it. See [here](https://github.com/rust-lang/rust/compare/98700cf481bce946bff316b56836cfffd885127b...compiler-errors:rust:new-solver-new-candidates-2) for an easier view until that one lands.

Of note:
44af916020fb43c12070125c45b6dee4ec303bbc fixes a bug where we need to make the query response *inside* of a probe, or else we make no inference progress (I think)
50daad5acd2f163d03e7ffab942534f09bc36e2e implements `consider_assumption` for traits and predicates. I'm not sure if using `sup` here is necessary or if `eq` is fine.
* We decided that all of the `instantiate_constituent_tys_for_*` functions are verbose but ok, since they need to be exhaustive and the logic between each of them is not similar enough, right?

r? ``@lcnr``

17 months agoRollup merge of #106917 - compiler-errors:const-closure-foreign, r=tmiasko
Michael Goulet [Wed, 18 Jan 2023 23:00:29 +0000 (18:00 -0500)]
Rollup merge of #106917 - compiler-errors:const-closure-foreign, r=tmiasko

Encode const mir for closures if they're const

Fixes #106913

17 months agoRollup merge of #106753 - compiler-errors:rpitit-not-suggestable, r=spastorino
Michael Goulet [Wed, 18 Jan 2023 23:00:28 +0000 (18:00 -0500)]
Rollup merge of #106753 - compiler-errors:rpitit-not-suggestable, r=spastorino

Make sure that RPITITs are not considered suggestable

Makes no sense to suggest `where impl Future<Output = ()>: Send`, for example.

17 months agoRollup merge of #105796 - notriddle:notriddle/rustdoc-search-stop-doing-demerits...
Michael Goulet [Wed, 18 Jan 2023 23:00:28 +0000 (18:00 -0500)]
Rollup merge of #105796 - notriddle:notriddle/rustdoc-search-stop-doing-demerits, r=GuillaumeGomez

rustdoc: simplify JS search routine by not messing with lev distance

Since the sorting function accounts for an `index` field, there's not much reason to also be applying changes to the levenshtein distance. Instead, we can just not treat `lev` as a filter if there's already a non-sentinel value for `index`.

<details>

This change gives slightly more weight to the index and path part, as search criteria, than it used to. This changes some of the test cases, but not in any obviously-"worse" way, and, in particular, substring matches are a bigger deal than levenshtein distances (we're assuming that a typo is less likely than someone just not typing the entire name).

The biggest change is the addition of a `path_lev` field to result items. It's always zero if the search query has no parent path part and for type queries, making the check in the `sortResults` function a no-op. When it's present, it is used to implement different precedence for the parent path and the tail.

Consider the query `hashset::insert`, a test case [that already exists and can be found here](https://github.com/rust-lang/rust/blob/5c6a1681a9a7b815febdd9de2f840da338984e68/src/test/rustdoc-js-std/path-ordering.js). We want the ordering shown in the test case:

```
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' },
        { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' },
```

We do not want this ordering, which is the ordering that would occur if substring position took priority over `path_lev`:

```
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
        { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' }, // BAD
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' },
```

We also do not want `HashSet::iter` to appear before `HashMap::insert`, which is what would happen if `path_lev` took priority over the appearance of any substring match. This is why the `sortResults` function has `path_lev` sandwiched between a `index < 0` check and a `index` comparison check:

```
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'iter' }, // BAD
        { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' },
```

The old code implemented a similar feature by manipulating the `lev` member based on whether a substring match was found and averaging in the path distance (`item.lev = name_lev + path_lev / 10`), so the path lev wound up acting like a tie breaker, but it gives slightly different results for `Vec::new`, [changing the test case](https://github.com/rust-lang/rust/pull/105796/files#diff-b346e2ef72a407915f438063c8c2c04f7a621df98923d441b41c0312211a5b21) because of the slight changes to ordering priority.

</details>

Based on https://github.com/rust-lang/rust/pull/103710#issuecomment-1296894296

Previews:

* https://notriddle.com/notriddle-rustdoc-demos/rustdoc-search-stop-doing-demerits/std/index.html
* https://notriddle.com/notriddle-rustdoc-demos/rustdoc-search-stop-doing-demerits-compiler/index.html

17 months agoAuto merge of #107041 - Nilstrieb:back-to-being-clueless-whether-it-really-is-a-liter...
bors [Wed, 18 Jan 2023 22:58:30 +0000 (22:58 +0000)]
Auto merge of #107041 - Nilstrieb:back-to-being-clueless-whether-it-really-is-a-literal, r=compiler-errors

Revert "Improve heuristics whether `format_args` string is a source literal"

This reverts commit e6c02aad9345925cfed74f86b414c4d0715d381b (from #106195).

Keeps the code improvements from the PR and the test (as a known-bug).

Works around #106408 while a proper fix is discussed more thoroughly in #106505, as proposed by `@tmandry.`

Reopens #106191

r? compiler-errors

17 months agoAuto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini
bors [Wed, 18 Jan 2023 19:49:02 +0000 (19:49 +0000)]
Auto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini

Ndk update redux

Blocked on https://github.com/rust-lang/blog.rust-lang.org/pull/1055

17 months agorustdoc: add test case for setting-line margin on settings.html
Michael Howell [Wed, 18 Jan 2023 19:48:24 +0000 (12:48 -0700)]
rustdoc: add test case for setting-line margin on settings.html

17 months agorustdoc: remove redundant rule `#settings .setting-line`
Michael Howell [Wed, 18 Jan 2023 19:39:13 +0000 (12:39 -0700)]
rustdoc: remove redundant rule `#settings .setting-line`

Since the current version of settings.js always nests things below
a div with ID `settings`, this rule always overrode the one above.

17 months agoRevert "Improve heuristics whether `format_args` string is a source literal"
Nilstrieb [Wed, 18 Jan 2023 18:47:22 +0000 (19:47 +0100)]
Revert "Improve heuristics whether `format_args` string is a source literal"

This reverts commit e6c02aad9345925cfed74f86b414c4d0715d381b.

Keeps the code improvements from the PR and the test (as a known-bug).

17 months agoci: add runners for vanilla LLVM 14 and 15
Josh Stone [Wed, 18 Jan 2023 19:14:40 +0000 (11:14 -0800)]
ci: add runners for vanilla LLVM 14 and 15

17 months agorustdoc: fix "?" keyboard command when radio button is focused
Michael Howell [Wed, 18 Jan 2023 18:52:31 +0000 (11:52 -0700)]
rustdoc: fix "?" keyboard command when radio button is focused

This extends the special case with checkbox settings to also cover radios.

17 months agorustdoc: put focus on the help link when opening it from keyboard
Michael Howell [Wed, 18 Jan 2023 18:41:34 +0000 (11:41 -0700)]
rustdoc: put focus on the help link when opening it from keyboard

This prevents some strange blur-event-related bugs with the "?" command
by ensuring that the focus remains in the same spot when the settings
area closes.

17 months agoAlso remove `#![feature(control_flow_enum)]` where possible
Scott McMurray [Wed, 18 Jan 2023 18:22:21 +0000 (10:22 -0800)]
Also remove `#![feature(control_flow_enum)]` where possible

17 months agoAuto merge of #106503 - cjgillot:remap-nofilter, r=oli-obk
bors [Wed, 18 Jan 2023 16:37:33 +0000 (16:37 +0000)]
Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obk

Do not filter substs in `remap_generic_params_to_declaration_params`.

The relevant filtering should have been performed by borrowck.

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

r? types

17 months agoFix Dominators::rank_partial_cmp to match documentation
Tomasz Miąsko [Wed, 18 Jan 2023 00:00:00 +0000 (00:00 +0000)]
Fix Dominators::rank_partial_cmp to match documentation

The only use site is also updated accordingly and there is no change in
end-to-end behaviour.

17 months agoUpdate `IsZero` documentation
clubby789 [Wed, 18 Jan 2023 15:48:53 +0000 (15:48 +0000)]
Update `IsZero` documentation

17 months agoImplement `alloc::vec::IsZero` for `Option<$NUM>` types
clubby789 [Tue, 17 Jan 2023 15:42:53 +0000 (15:42 +0000)]
Implement `alloc::vec::IsZero` for `Option<$NUM>` types

17 months agoHandle structural traits more gracefully
Michael Goulet [Wed, 18 Jan 2023 14:56:44 +0000 (14:56 +0000)]
Handle structural traits more gracefully

17 months agono subtyping in the new trait solver
Michael Goulet [Wed, 18 Jan 2023 14:40:16 +0000 (14:40 +0000)]
no subtyping in the new trait solver

17 months agoSized, Copy/Clone
Michael Goulet [Tue, 17 Jan 2023 20:24:58 +0000 (20:24 +0000)]
Sized, Copy/Clone

17 months agoAuto and alias traits
Michael Goulet [Tue, 17 Jan 2023 20:16:30 +0000 (20:16 +0000)]
Auto and alias traits