Commit Graph

215415 Commits

Author SHA1 Message Date
Michael Goulet
a4f0126bfa
Rollup merge of #107124 - DebugSteven:check-macro-expansion, r=albertlarsan68
fix check macro expansion

If the only argument to `check!` is the module name I get this error:

```
error: expected expression, found `,`
   --> src/tools/tidy/src/main.rs:63:42
    |
57  | /         macro_rules! check {
58  | |             ($p:ident $(, $args:expr)* ) => {
59  | |                 drain_handles(&mut handles);
60  | |
...   |
63  | |                     $p::check($($args),* , &mut flag);
    | |                                          ^ expected expression
...   |
69  | |             }
70  | |         }
    | |_________- in this expansion of `check!`
...
117 |           check!(hey);
    |           ----------- in this macro invocation
```

This change makes it so commas are added only when there are `args`.

r? ```@albertlarsan68```
2023-01-20 21:33:24 -05:00
Michael Goulet
7168aa5eb1
Rollup merge of #107112 - eltociear:patch-19, r=albertlarsan68
Fix typo in opaque_types.rs

paramters -> parameters
2023-01-20 21:33:23 -05:00
Michael Goulet
7565b9aa4a
Rollup merge of #107095 - notriddle:notriddle/sidebar-current, r=GuillaumeGomez
rustdoc: remove redundant CSS selector `.sidebar .current`

Since the current sidebar item is already a link, it doesn't do anything.
2023-01-20 21:33:23 -05:00
Michael Goulet
3452104715
Rollup merge of #107061 - compiler-errors:new-solver-new-candidates-3, r=lcnr
Implement some more new solver candidates and fix some bugs

First, fix some bugs:

1. `IndexVec::drain_enumerated(a..b)` does not give us an iterator of index keys + items enumerated from `a..b`, but from `0..(b-a)`... That caused a bug. See first commit for the fix.
2. Implement the `_: Trait` ambiguity hack. I put it in assemble, let me know if it should live elsewhere. This is important, since we otherwise consider `_: Sized` to have no solutions, and nothing passes!
3. Swap `Ambiguity` and `Unimplemented` cases for the new solver. Sorry for accidentally swapping them 😄
4. Check GATs' own predicates during projection confirmation.

Then implement a few builtin traits:

5. Implement `PointerSized`. Pretty independent.
6. Implement `Fn` family of traits for fnptr, fndef, and closures. Closures are currently broken because `FulfillCtxt::relationships` is intentionally left unimplemented. See comment in the test.

r? ```@lcnr```
2023-01-20 21:33:22 -05:00
Michael Goulet
d26c88c752
Rollup merge of #107048 - DebugSteven:newer-x-check-cargo, r=albertlarsan68
check for x version updates

This PR adds a check to tidy to assert that the installed version of `x` is equal to the version in `src/tools/x/Cargo.toml`. It checks the installed version of `x` by parsing the output of `cargo install --list` (as an option proposed in this [issue](https://github.com/rust-lang/rust/issues/106469)).

It does not warn if `x` has not yet been installed, on the assumption that the user isn't interested in using it.
2023-01-20 21:33:22 -05:00
Michael Goulet
68b390ae2a
Rollup merge of #104672 - Voultapher:unify-sort-modules, r=thomcc
Unify stable and unstable sort implementations in same core module

This moves the stable sort implementation to the core::slice::sort module. By virtue of being in core it can't access `Vec`. The two `Vec` used by merge sort, `buf` and `runs`, are modelled as custom types that implement the very limited required `Vec` interface with the help of provided allocation and free functions. This is done to allow future re-use of functions and logic between stable and unstable sort. Such as `insert_head`.

This is in preparation of #100856 and #104116. It only moves code, it *doesn't* change any of the sort related logic. This unlocks the ability to share `insert_head`, `insert_tail`, `swap_if_less` `merge` and more.

Tagging ````@Mark-Simulacrum```` I hope this allows progress on #100856, by moving `merge_sort` here I hope future changes will be easier to review.
2023-01-20 21:33:21 -05:00
Michael Goulet
bf75f8177b
Rollup merge of #104347 - notriddle:notriddle/import-macro-from-self-fixup, r=TaKO8Ki
diagnostics: suggest changing `s@self::{macro}@::macro` for exported

Fixes #99695
2023-01-20 21:33:21 -05:00
Michael Goulet
e6400693b8
Rollup merge of #104154 - timrobertsdev:deny-by-default-bindings_with_variant_name, r=scottmcm
Change `bindings_with_variant_name` to deny-by-default

Changed the `bindings_with_variant_name` lint to deny-by-default and fixed up the affected tests.

Addresses #103442.
2023-01-20 21:33:20 -05:00
Michael Howell
c07a722847 diagnostics: remvoe unnecessary use of source_map.start_point 2023-01-20 14:53:34 -07:00
Michael Howell
dca160a06a diagnostics: use module_path to check crate import instead of strings 2023-01-20 14:53:34 -07:00
Michael Howell
e237690a28 diagnostics: add }; only if { was added too 2023-01-20 14:53:33 -07:00
Michael Howell
e9d8d238ef diagnostics: suggest changing s@self::{macro}@::macro for exported
Fixes #99695
2023-01-20 14:52:24 -07:00
bors
94a300b9b8 Auto merge of #105102 - compiler-errors:copy-impl-considering-regions, r=lcnr
Check ADT fields for copy implementations considering regions

Fixes #88901
r? `@ghost`
2023-01-20 21:29:52 +00:00
bors
5ce39f42bd Auto merge of #107120 - weihanglo:update-cargo, r=weihanglo
Update cargo

3 commits in 50eb688c2bbea5de5a2e8496230a7428798089d1..985d561f0bb9b76ec043a2b12511790ec7a2b954

2023-01-19 10:09:05 +0000 to 2023-01-20 14:39:28 +0000
- Stabilize sparse-registry (rust-lang/cargo#11224)
- Wrapper type for data that should never be logged (rust-lang/cargo#11545)
- Add semver rule for lints (rust-lang/cargo#11596)

r? `@ghost`
2023-01-20 18:25:42 +00:00
DebugSteven
a641b929ad remove leading comma when there are no args in check macro expansion 2023-01-20 10:10:47 -07:00
DebugSteven
540ca2ff2a run cargo install to check for x installation and version 2023-01-20 10:05:19 -07:00
Weihang Lo
ea4620a710
Update cargo
3 commits in 50eb688c2bbea5de5a2e8496230a7428798089d1..985d561f0bb9b76ec043a2b12511790ec7a2b954

2023-01-19 10:09:05 +0000 to 2023-01-20 14:39:28 +0000
- Stabilize sparse-registry (rust-lang/cargo#11224)
- Wrapper type for data that should never be logged (rust-lang/cargo#11545)
- Add semver rule for lints (rust-lang/cargo#11596)
2023-01-20 15:53:13 +00:00
bors
a6269dad38 Auto merge of #107106 - matthiaskrgr:rollup-g7r1ep0, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #106699 ([drop tracking] Visit break expressions )
 - #106738 (Fix known-bug annotations)
 - #106891 (Tweak "borrow closure argument" suggestion)
 - #106928 (add raw identifier for keyword in suggestion)
 - #107065 (Clippy: Make sure to include in beta: Move `unchecked_duration_subtraction` to pedantic)
 - #107068 (autoderive Subdiagnostic for AddtoExternBlockSuggestion)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-20 15:28:40 +00:00
bors
04a41f889f Auto merge of #107105 - matthiaskrgr:rollup-rkz9t7r, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #106783 (Recover labels written as identifiers)
 - #106973 (Don't treat closures from other crates as local)
 - #106979 (Document how to get the type of a default associated type)
 - #107053 (signal update string representation for haiku.)
 - #107058 (Recognise double-equals homoglyph)
 - #107067 (Custom MIR: Support storage statements)
 - #107076 (Added const-generic ui test case for issue #106419)
 - #107091 (Fix broken format strings in `infer.ftl`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-20 12:58:13 +00:00
Ikko Eltociear Ashimine
1adb4d6e5f
Fix typo in opaque_types.rs
paramters -> parameters
2023-01-20 17:56:29 +09:00
--global
1cbce729c7 Add compile_fail to doctest for bindings_with_variant_name 2023-01-20 02:26:12 -05:00
--global
734f375019 Change bindings_with_variant_name to deny-by-default 2023-01-20 02:26:12 -05:00
Matthias Krüger
c44c60caba
Rollup merge of #107068 - mejrs:use_derive, r=estebank
autoderive Subdiagnostic for AddtoExternBlockSuggestion
2023-01-20 07:25:30 +01:00
Matthias Krüger
12d2136116
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``
2023-01-20 07:25:29 +01:00
Matthias Krüger
da7a0c0b30
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
2023-01-20 07:25:29 +01:00
Matthias Krüger
5f2ad80e18
Rollup merge of #106891 - estebank:issue-45727, r=petrochenkov
Tweak "borrow closure argument" suggestion

Fix #45727.
2023-01-20 07:25:28 +01:00
Matthias Krüger
720a9f1d9b
Rollup merge of #106738 - compiler-errors:known-bugs-oops, r=jackh726
Fix known-bug annotations

r? ``@Nilstrieb``
2023-01-20 07:25:28 +01:00
Matthias Krüger
3d79cbc3c1
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.
2023-01-20 07:25:27 +01:00
Matthias Krüger
c42fad8ff3
Rollup merge of #107091 - clubby789:infer-ftl-missing-dollar, r=compiler-errors
Fix broken format strings in `infer.ftl`

Fixes #107088
2023-01-20 07:16:12 +01:00
Matthias Krüger
75655a9246
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 f769d34291 (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`.
------------------------------------------
```
2023-01-20 07:16:11 +01:00
Matthias Krüger
66a9006759
Rollup merge of #107067 - tmiasko:custom-mir-storage-statements, r=oli-obk
Custom MIR: Support storage statements

r? `@oli-obk` `@JakobDegen`
2023-01-20 07:16:11 +01:00
Matthias Krüger
3693399ffc
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
2023-01-20 07:16:10 +01:00
Matthias Krüger
35d488f23d
Rollup merge of #107053 - devnexen:sigstringrepr_haiku, r=thomcc
signal update string representation for haiku.
2023-01-20 07:16:10 +01:00
Matthias Krüger
a2712cb4b6
Rollup merge of #106979 - Nilstrieb:type-of-default-assoc-type, r=petrochenkov
Document how to get the type of a default associated type
2023-01-20 07:16:09 +01:00
Matthias Krüger
240cc81768
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.
2023-01-20 07:16:09 +01:00
Matthias Krüger
df88f7e02c
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`.
2023-01-20 07:16:08 +01:00
bors
56ee85274e 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`
2023-01-20 04:52:28 +00:00
bors
51d50ea96e 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`
2023-01-20 01:55:36 +00:00
Michael Howell
05889fc52e rustdoc: remove redundant CSS selector .sidebar .current
Since the current sidebar item is already a link, it doesn't
do anything.
2023-01-19 16:30:05 -07:00
clubby789
f3cde8e9da Fix broken format strings in infer.ftl 2023-01-19 23:13:01 +00:00
bors
a2bf475d01 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`
2023-01-19 22:40:12 +00:00
Michael Goulet
a3d5be6631 Make bare known-bug an error 2023-01-19 20:20:58 +00:00
Michael Goulet
3eecdd10a2 Fix known-bug, silence ICE stderr 2023-01-19 20:20:58 +00:00
Esteban Küber
33e11a3b2e Tweak "borrow closure argument" suggestion
Fix #45727.
2023-01-19 19:35:49 +00:00
Guillaume Gomez
a22cd9cdfa Revert "Fix missing const expression items visit"
This reverts commit cdfc5051b1.
2023-01-19 20:32:24 +01:00
Guillaume Gomez
13239a9b8e Revert "Add regression test for impl blocks in const expr"
This reverts commit 9cce0bc583.
2023-01-19 20:27:37 +01:00
Guillaume Gomez
69de8fbbeb Revert "Update newly failing UI tests"
This reverts commit 9c46173895.
2023-01-19 20:27:00 +01:00
Guillaume Gomez
8b80bc1bf4 Revert "Improve code readability"
This reverts commit eb93d1bede.
2023-01-19 20:26:01 +01:00
Guillaume Gomez
286a632e72 Revert "Speed up execution a bit by removing some walks"
This reverts commit a9d582f51f.
2023-01-19 20:25:53 +01:00
Guillaume Gomez
5feeca0156 Revert "Improve code"
This reverts commit a954d6334d.
2023-01-19 20:25:46 +01:00