Commit Graph

23863 Commits

Author SHA1 Message Date
Maybe Waffle
b89c4f0a05 Implement postfix adjustment hints
I'd say "First stab at implementing..." but I've been working on this
for a month already lol
2023-01-09 13:27:59 +00:00
bors
ae659125a5 Auto merge of #13763 - rami3l:fix/gen-partial-eq-generic, r=Veykril
fix: add generic `TypeBoundList` in generated derivable impl

Potentially fixes #13727.

Continuing with the work in #13732, this fix tries to add correct type bounds in the generated `impl` block:

```diff
  enum Either<T, U> {
      Left(T),
      Right(U),
  }

- impl<T, U> PartialEq for Either<T, U> {
+ impl<T: PartialEq, U: PartialEq> PartialEq for Either<T, U> {
      fn eq(&self, other: &Self) -> bool {
          match (self, other) {
              (Self::Left(l0), Self::Left(r0)) => l0 == r0,
              (Self::Right(l0), Self::Right(r0)) => l0 == r0,
              _ => false,
          }
      }
  }
```
2023-01-09 13:02:09 +00:00
bors
fe8ee9c43a Auto merge of #13744 - vtta:numthreads, r=Veykril
feat: add the ability to limit the number of threads launched by `main_loop`

## Motivation
`main_loop` defaults to launch as many threads as cpus in one machine. When developing on multi-core remote servers on multiple projects, this will lead to thousands of idle threads being created. This is very annoying when one wants check whether his program under developing is running correctly via `htop`.

<img width="756" alt="image" src="https://user-images.githubusercontent.com/41831480/206656419-fa3f0dd2-e554-4f36-be1b-29d54739930c.png">

## Contribution
This patch introduce the configuration option `rust-analyzer.numThreads` to set the desired thread number used by the main thread pool.
This should have no effects on the performance as not all threads are actually used.
<img width="1325" alt="image" src="https://user-images.githubusercontent.com/41831480/206656834-fe625c4c-b993-4771-8a82-7427c297fd41.png">

## Demonstration
The following is a snippet of `lunarvim` configuration using my own build.
```lua
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "rust_analyzer" })
require("lvim.lsp.manager").setup("rust_analyzer", {
  cmd = { "env", "RA_LOG=debug", "RA_LOG_FILE=/tmp/ra-test.log",
    "/home/jlhu/Projects/rust-analyzer/target/debug/rust-analyzer",
  },
  init_options = {
    numThreads = 4,
  },
  settings = {
    cachePriming = {
      numThreads = 8,
    },
  },
})

```

## Limitations
The `numThreads` can only be modified via `initializationOptions` in early initialisation because everything has to wait until the thread pool starts including the dynamic settings modification support.
The `numThreads` also does not reflect the end results of how many threads is actually created, because I have not yet tracked down everything that spawns threads.
2023-01-09 11:53:23 +00:00
bors
1e20bf38b2 Auto merge of #13684 - unvalley:extract-expressions-from-format-string, r=Veykril
feat: extract_expressions_from_format_string

closes #13640
- rename to `extract_expressions_from_format_string`
- leave identifier from format string
	- but this is from rustc version 1.65.0
	- Should I add flag or something?

Note: the assist behaves below cases for now. I'll create an issue for these.
```rs
let var = 1 + 1;
// ok
format!("{var} {1+1}");   // → format!("{var} {}", 1+1);
format!("{var:?} {1+1}"); // → format!("{var:?} {}", 1 + 1);
format!("{var} {var} {1+1}"); // → format!("{var} {var} {}", 1 + 1);

// breaks (need to handle minimum width by postfix`$`)
format!("{var:width$} {1+1}"); // → format!("{var:width\$} {}", 1+1);
format!("{var:.prec$} {1+1}"); // → format!("{var:.prec\$} {}", 1+1);
format!("Hello {:1$}! {1+1}", "x" 5); // → format("Hello {:1\$}! {}", "x", 1+1);
format!("Hello {:width$}! {1+1}", "x", width = 5); // → println!("Hello {:width\$}! {}", "x", 1+1);
```

https://user-images.githubusercontent.com/38400669/204344911-f1f8fbd2-706d-414e-b1ab-d309376efb9b.mov
2023-01-09 11:40:48 +00:00
bors
814ff01620 Auto merge of #13458 - cameron1024:suggest-checked-wrapping-saturating, r=Veykril
add wrapping/checked/saturating assist

This addresses #13452

I'm not sure about the structure of the code. I'm not sure if it needs to be 3 separate assists, and if that means it needs to be in 3 separate files as well.

Most of the logic is in `util.rs`, which feels funny to me, but there seems to be a pattern of 1 assist per file, and this seems better than duplicating the logic.

Let me know if anything needs changes 😁
2023-01-09 11:24:44 +00:00
unvalley
9eabc2cde8 fix: add_format_like_completions to handle no exprs 2023-01-09 12:23:59 +01:00
unvalley
a310fc0cd5 docs: update assist comment 2023-01-09 12:23:06 +01:00
unvalley
872df2f413 chore: update assist label name 2023-01-09 12:22:29 +01:00
unvalley
285f09cfa8 feat: extract only expressions from format string 2023-01-09 12:22:29 +01:00
unvalley
29f3d7dee7 test: fix arg_type test 2023-01-09 12:22:29 +01:00
unvalley
13267adb12 fix: to leave Ident in parse_format_exprs 2023-01-09 12:22:29 +01:00
unvalley
796a106412 fix: ide assist handlers order 2023-01-09 12:22:25 +01:00
unvalley
9290399ec4 fix: rename to extract_expressions_from_format_string 2023-01-09 12:21:37 +01:00
Lukas Wirth
0dd2682178 Refactor replace_arith assists into one module 2023-01-09 11:59:17 +01:00
bors
25717af4aa Auto merge of #13905 - rust-lang:dependabot/npm_and_yarn/editors/code/d3-color-and-d3-graphviz-3.1.0, r=Veykril
Bump d3-color and d3-graphviz in /editors/code

Bumps [d3-color](https://github.com/d3/d3-color) to 3.1.0 and updates ancestor dependency [d3-graphviz](https://github.com/magjac/d3-graphviz). These dependencies need to be updated together.

Updates `d3-color` from 2.0.0 to 3.1.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/d3/d3-color/releases">d3-color's releases</a>.</em></p>
<blockquote>
<h2>v3.1.0</h2>
<ul>
<li>Add <a href="https://github.com/d3/d3-color/blob/main/README.md#rgb_clamp"><em>rgb</em>.clamp</a> and <a href="https://github.com/d3/d3-color/blob/main/README.md#hsl_clamp"><em>hsl</em>.clamp</a>. <a href="https://github-redirect.dependabot.com/d3/d3-color/issues/102">#102</a></li>
<li>Add <a href="https://github.com/d3/d3-color/blob/main/README.md#color_formatHex8"><em>color</em>.formatHex8</a>. <a href="https://github-redirect.dependabot.com/d3/d3-color/issues/103">#103</a></li>
<li>Fix <a href="https://github.com/d3/d3-color/blob/main/README.md#color_formatHsl"><em>color</em>.formatHsl</a> to clamp values to the expected range. <a href="https://github-redirect.dependabot.com/d3/d3-color/issues/83">#83</a></li>
<li>Fix catastrophic backtracking when parsing colors. <a href="https://github-redirect.dependabot.com/d3/d3-color/issues/89">#89</a> <a href="https://github-redirect.dependabot.com/d3/d3-color/issues/97">#97</a> <a href="https://github-redirect.dependabot.com/d3/d3-color/issues/99">#99</a> <a href="https://github-redirect.dependabot.com/d3/d3-color/issues/100">#100</a> <a href="https://security.snyk.io/vuln/SNYK-JS-D3COLOR-1076592">SNYK-JS-D3COLOR-1076592</a></li>
</ul>
<h2>v3.0.1</h2>
<ul>
<li>Make build reproducible.</li>
</ul>
<h2>v3.0.0</h2>
<ul>
<li>Adopt type: module.</li>
</ul>
<p>This package now requires Node.js 12 or higher. For more, please read <a href="https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c">Sindre Sorhus’s FAQ</a>.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="7a1573ed26"><code>7a1573e</code></a> 3.1.0</li>
<li><a href="75c19c40c2"><code>75c19c4</code></a> update LICENSE</li>
<li><a href="ef94e0125c"><code>ef94e01</code></a> update dependencies</li>
<li><a href="5e9f7579dd"><code>5e9f757</code></a> method shorthand</li>
<li><a href="e4bc34e46c"><code>e4bc34e</code></a> formatHex8 (<a href="https://github-redirect.dependabot.com/d3/d3-color/issues/103">#103</a>)</li>
<li><a href="ac660c6b6b"><code>ac660c6</code></a> {rgb,hsl}.clamp() (<a href="https://github-redirect.dependabot.com/d3/d3-color/issues/102">#102</a>)</li>
<li><a href="70e3a041f1"><code>70e3a04</code></a> clamp HSL format (<a href="https://github-redirect.dependabot.com/d3/d3-color/issues/101">#101</a>)</li>
<li><a href="994d8fd951"><code>994d8fd</code></a> avoid backtracking (<a href="https://github-redirect.dependabot.com/d3/d3-color/issues/100">#100</a>)</li>
<li><a href="7d61bbe6e4"><code>7d61bbe</code></a> 3.0.1</li>
<li><a href="93bc4ff542"><code>93bc4ff</code></a> related <a href="https://github-redirect.dependabot.com/d3/d3/issues/3">d3/d33</a>; extract copyrights from LICENSE</li>
<li>Additional commits viewable in <a href="https://github.com/d3/d3-color/compare/v2.0.0...v3.1.0">compare view</a></li>
</ul>
</details>
<br />

Updates `d3-graphviz` from 4.1.1 to 5.0.2
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/magjac/d3-graphviz/releases">d3-graphviz's releases</a>.</em></p>
<blockquote>
<h2>v5.0.2</h2>
<p>See the <a href="https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md#502">CHANGELOG</a> for details.</p>
<h2>v5.0.1</h2>
<p>See the <a href="https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md#501">CHANGELOG</a> for details.</p>
<h2>v5.0.0</h2>
<p>See the <a href="https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md#500">CHANGELOG</a> for details.</p>
<h2>v4.5.0</h2>
<p>See the <a href="https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md#450">CHANGELOG</a> for details.</p>
<h2>v4.4.0</h2>
<p>See the <a href="https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md#440">CHANGELOG</a> for details.</p>
<h2>v4.3.0</h2>
<p>See the <a href="https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md#430">CHANGELOG</a> for details.</p>
<h2>v4.2.0</h2>
<p>See the <a href="https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md#420">CHANGELOG</a> for details.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md">d3-graphviz's changelog</a>.</em></p>
<blockquote>
<h2>[5.0.2] – 2022-12-27</h2>
<h3>Fixed</h3>
<ul>
<li>Failed to resolve entry for package &quot;d3-graphviz&quot; <a href="https://github-redirect.dependabot.com/magjac/d3-graphviz/issues/263">#263</a></li>
</ul>
<h2>[5.0.1] – 2022-12-27</h2>
<h3>Fixed</h3>
<ul>
<li>Failed to resolve entry for package &quot;d3-graphviz&quot; (partial fix) <a href="https://github-redirect.dependabot.com/magjac/d3-graphviz/issues/263">#263</a></li>
</ul>
<h2>[5.0.0] – 2022-12-26</h2>
<p><strong>Note:</strong> This release contains breaking changes compared to version 4.5.0.</p>
<h3>Changed</h3>
<ul>
<li>Like <a href="https://github.com/d3/d3/blob/main/CHANGES.md#changes-in-d3-70">D3
v7</a>,
d3-graphviz now ships as a pure ES module and requires Node.js 14 or
higher. This is a <strong>breaking change</strong>. For more, please read <a href="https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c">Sindre
Sorhus’s
FAQ</a>. For
background and details, see <a href="https://github-redirect.dependabot.com/d3/d3/issues/3469">this D3
issue</a>.</li>
<li>Upgrade to <a href="https://github.com/d3/d3/blob/main/CHANGES.md#changes-in-d3-70">D3 version
7</a>
(version 3 of its
<a href="https://github.com/d3/d3#installing">microlibraries</a>).</li>
<li>Upgrade <code>`@​hpcc-js/wasm</code>` to 2.5.0 (Graphviz 7.0.5)</li>
</ul>
<h2>[4.5.0] – 2022-12-11</h2>
<h3>Changed</h3>
<ul>
<li>Upgrade <code>`@​hpcc-js/wasm</code>` to 1.16.6 (Graphviz 7.0.1)</li>
</ul>
<h2>[4.4.0] – 2022-09-12</h2>
<h3>Changed</h3>
<ul>
<li>Upgrade <code>`@​hpcc-js/wasm</code>` to 1.16.1 (Graphviz 6.0.1)</li>
</ul>
<h2>[4.3.0] – 2022-09-10</h2>
<h3>Changed</h3>
<ul>
<li>Upgrade <code>`@​hpcc-js/wasm</code>` to 1.15.7 (Graphviz unchanged at 5.0.1)  (thanks <a href="https://github.com/mrdrogdrog"><code>`@​mrdrogdrog</code></a>)</li>`
</ul>
<h2>[4.2.0] – 2022-09-06</h2>
<h3>Changed</h3>
<ul>
<li>Upgrade Graphviz to version 5.0.1 through <code>`@​hpcc-js/wasm</code>` version 1.15.4 (thanks <a href="https://github.com/mrdrogdrog"><code>`@​mrdrogdrog</code></a>)</li>`
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="21a1f57612"><code>21a1f57</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/magjac/d3-graphviz/issues/268">#268</a> from magjac/release-5.0.2</li>
<li><a href="3c96187ad3"><code>3c96187</code></a> add version 5.0.2 to CHANGELOG</li>
<li><a href="82c34adb33"><code>82c34ad</code></a> update version to 5.0.2</li>
<li><a href="493e14927c"><code>493e149</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/magjac/d3-graphviz/issues/267">#267</a> from magjac/fix-main-module-exports-in-package-json-a...</li>
<li><a href="1903eea4e5"><code>1903eea</code></a> add simple-default-export-test.js</li>
<li><a href="ccd6b90f36"><code>ccd6b90</code></a> correct default export in package.json</li>
<li><a href="d32e81cbfb"><code>d32e81c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/magjac/d3-graphviz/issues/266">#266</a> from magjac/release-5.0.1</li>
<li><a href="d0651e56ec"><code>d0651e5</code></a> add version 5.0.1 to CHANGELOG</li>
<li><a href="0c06f6246b"><code>0c06f62</code></a> update version to 5.0.1</li>
<li><a href="2df0d3a66f"><code>2df0d3a</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/magjac/d3-graphviz/issues/265">#265</a> from magjac/fix-main-module-exports-in-package-json</li>
<li>Additional commits viewable in <a href="https://github.com/magjac/d3-graphviz/compare/v4.1.1...v5.0.2">compare view</a></li>
</ul>
</details>
<br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` use these labels` will set the current labels as the default for future PRs for this repo and language
- ``@dependabot` use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- ``@dependabot` use these assignees` will set the current assignees as the default for future PRs for this repo and language
- ``@dependabot` use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/rust-lang/rust-analyzer/network/alerts).

</details>
2023-01-09 10:37:46 +00:00
bors
f77b68a3cb Auto merge of #13860 - danieleades:clippy, r=lnicola
fix a bunch of clippy lints

fixes a bunch of clippy lints for fun and profit

i'm aware of this repo's position on clippy. The changes are split into separate commits so they can be reviewed separately
2023-01-08 17:29:57 +00:00
dependabot[bot]
41d290d671
Bump d3-color and d3-graphviz in /editors/code
Bumps [d3-color](https://github.com/d3/d3-color) to 3.1.0 and updates ancestor dependency [d3-graphviz](https://github.com/magjac/d3-graphviz). These dependencies need to be updated together.


Updates `d3-color` from 2.0.0 to 3.1.0
- [Release notes](https://github.com/d3/d3-color/releases)
- [Commits](https://github.com/d3/d3-color/compare/v2.0.0...v3.1.0)

Updates `d3-graphviz` from 4.1.1 to 5.0.2
- [Release notes](https://github.com/magjac/d3-graphviz/releases)
- [Changelog](https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md)
- [Commits](https://github.com/magjac/d3-graphviz/compare/v4.1.1...v5.0.2)

---
updated-dependencies:
- dependency-name: d3-color
  dependency-type: indirect
- dependency-name: d3-graphviz
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-07 19:20:08 +00:00
bors
1bd1a09593 Auto merge of #13876 - lnicola:zip-artifacts, r=lnicola
feat: Package Windows release artifacts as ZIP and add symbols file

Closes #13872
Closes #7747
CC #10371

This allows us to ship a format that's easier to handle on Windows. As a bonus, we can also include the PDB, to get useful stack traces. Unfortunately, it adds a couple of dependencies to `xtask`, increasing the debug build times from 1.28 to 1.58 s (release from 1.60s to 2.20s) on my system.
2023-01-07 19:19:37 +00:00
bors
7449f9fa10 Auto merge of #13894 - lowr:patch/fallback-before-final-obligation-resolution, r=lnicola
Apply fallback before final obligation resolution

Fixes #13249
Fixes #13518

We've been applying fallback to type variables independently even when there are some unresolved obligations that associate them. This PR applies fallback to unresolved scalar type variables before the final attempt of resolving obligations, which enables us to infer more.

Unlike rustc, which has separate storages for each kind of type variables, we currently don't have a way to retrieve only integer/float type variables without folding/visiting every single type we've inferred. I've repurposed `TypeVariableData` as bitflags that also hold the kind of the type variable it's referring to so that we can "reconstruct" scalar type variables from their indices.

This PR increases the number of ??ty for rust-analyzer repo not because we regress and fail to infer the existing code but because we fail to infer the new code. It seems we have problems inferring some functions bitflags produces.
2023-01-07 19:03:34 +00:00
bors
f1a99014b3 Auto merge of #13898 - lnicola:option-env, r=Veykril
fix: Fix option_env expansion
2023-01-06 17:25:36 +00:00
Laurențiu Nicola
9f6567f20c Fix option_env expansion 2023-01-06 16:00:23 +02:00
Ryo Yoshida
d01630c8f3
Apply fallback to scalar type variables before final obligation resolution 2023-01-06 06:07:08 +09:00
Ryo Yoshida
b183612610
Add INTEGER and FLOAT flags for type variables 2023-01-05 23:10:06 +09:00
Ryo Yoshida
1bfc732b78
Store diverging flag for type variables as bitflags 2023-01-05 23:10:00 +09:00
bors
80cabf7260 Auto merge of #13893 - ntBre:master, r=lnicola
Complete record enum variants without parens when snippets are disabled

I didn't realize I only handled this for tuple variants in #13805. This is the same change but for record variants.
2023-01-04 18:38:34 +00:00
Brent Westbrook
150da92b5c return immediately from render_record_lit if snippet_cap is None
this is the record literal version of #13805, which handled the same issue for
tuple literals
2023-01-04 12:55:05 -05:00
bors
a97c71f92d Auto merge of #13887 - Veykril:rustc-diag-preferred, r=Veykril
Only set machine-applicable rustc diagnostics as preferred

If they aren't machine applicable, then they might not be what the user wants, disrupting the workflow.
Example being:
![image](https://user-images.githubusercontent.com/3757771/210380233-ae25aa04-954e-4634-8dd1-4377cc2bd837.png)
Prior to the PR this the diagnostic quickfix was at the top, but usually isn't what the user wants.
2023-01-03 14:47:18 +00:00
Lukas Wirth
b6bb1e9ae7 Only set machine-applicable rustc diagnostics as preferred 2023-01-03 15:46:08 +01:00
bors
0b14cd9671 Auto merge of #13886 - Veykril:inlay-ligatures, r=Veykril
Use ZWNJ to prevent VSCode from forming ligatures between hints and code

Turns out VSCode still has this issue for native hints as well, cc https://github.com/rust-lang/rust-analyzer/pull/6236
2023-01-03 11:33:17 +00:00
Lukas Wirth
c4d8cf1dad Use ZWNJ to prevent VSCode from forming ligatures between hints and code 2023-01-03 12:32:38 +01:00
bors
5033213fc9 Auto merge of #13885 - Veykril:bin-op-adjust, r=Veykril
Skip lifetime elision on fn pointers and fn trait types

These currently don't work correctly, so it's better to not render them at all there
2023-01-03 10:59:21 +00:00
Lukas Wirth
b996a54cd8 Skip lifetime elision on fn pointers and fn trait types 2023-01-03 11:58:31 +01:00
bors
50801b7d6a Auto merge of #13853 - veber-alex:diag_fix, r=Veykril
Use diagnostic code as link to full message

fixes #13823 by adding a vscode setting that will keeping the existing diagnostic code and use it as a link to the full compiler error message.
While I was there I also fixed `index` to fallback to `rendered.length` to make the previewRustcOutput feature work.
2023-01-03 09:40:20 +00:00
Alex Veber
ddc0147d53 Fix diagnostic code 2023-01-03 08:33:27 +02:00
bors
e75e2f8368 Auto merge of #13882 - Veykril:bin-op-adjust, r=Veykril
Write down adjustments introduced by binary operators
2023-01-02 22:17:11 +00:00
Lukas Wirth
506895fa2f Fix spelling mistake 2023-01-02 23:16:26 +01:00
Lukas Wirth
f51111aacb Write down adjustments introduced by binary operators 2023-01-02 23:16:09 +01:00
Daniel Eades
bb083b8202 remove useless casts 2023-01-02 15:02:54 +00:00
Daniel Eades
aa90d02079 remove useless operations 2023-01-02 15:02:54 +00:00
Daniel Eades
0a0817905e return value directly from if/else block 2023-01-02 15:02:54 +00:00
Daniel Eades
4f8ffd0ba4 remove unnecessary lifetimes that can be elided 2023-01-02 15:02:54 +00:00
Daniel Eades
8615bba105 use 'unwrap_or_default' 2023-01-02 15:02:54 +00:00
Daniel Eades
efd2c20e96 remove useless conversions 2023-01-02 15:02:54 +00:00
Daniel Eades
cc80c5bd07 remove unnecessary lazy evaluations 2023-01-02 15:02:54 +00:00
Daniel Eades
7530d76f00 use pointer args 2023-01-02 14:52:32 +00:00
Daniel Eades
ed128872eb remove needless borrows 2023-01-02 14:52:32 +00:00
Daniel Eades
77051679d7 use inline format args 2023-01-02 14:52:32 +00:00
bors
17cc78f169 Auto merge of #13832 - Veykril:discriminant-hints, r=Veykril
Enum variant discriminants hints

![image](https://user-images.githubusercontent.com/3757771/209320042-eced617a-9a47-4808-ac23-916f469dc90c.png)
2023-01-02 13:20:33 +00:00
bors
790759fb11 Auto merge of #13854 - lowr:fix/mbe-glue-punct, r=Veykril
Support multi-character punct tokens in MBE

Fixes #11497

In the context of MBE, consecutive puncts are parsed as multi-character punct tokens whenever possible. For example, `:::` is parsed as ``[Punct(`::`), Punct(`:`)]`` and shouldn't get matched to patterns like `: : :` or `: ::`.

We have implemented this behavior only for when we match puncts against `tt` fragments, but not when we match puncts literally. This PR extracts the multi-character punct handling procedure into a separate method and extends its support for literal matching.

For good measure, this PR adds support for `<-` token, which is still [considered as one token in rustc](e396186407/compiler/rustc_ast/src/token.rs (L249)) despite the placement syntax having been removed.
2023-01-02 13:07:42 +00:00
bors
e986de0b28 Auto merge of #13877 - lowr:fix/find-path-prefix-shadowed-prelude, r=Veykril
fix: prefix prelude items whose name collides in current scope

Fixes #13873

When we assemble path for prelude items whose name collides with other item in scope, we should always prefix it with module paths.
2023-01-02 12:11:30 +00:00