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```
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```
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.
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.
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.
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`
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)
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
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``
[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.
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`.
------------------------------------------
```
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
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.
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`