Skip to content

Commit 8a7cde4

Browse files
Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
git-subtree-dir: src/tools/rust-analyzer git-subtree-mainline: 3c98486a0cdb6d92f0fca34ffb1fd46c0e498653 git-subtree-split: 977e12a
0 parents  commit 8a7cde4

File tree

1,698 files changed

+345854
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,698 files changed

+345854
-0
lines changed

.cargo/config.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[alias]
2+
xtask = "run --package xtask --bin xtask --"
3+
tq = "test -- -q"
4+
qt = "tq"
5+
lint = "clippy --all-targets -- -Aclippy::collapsible_if -Aclippy::needless_pass_by_value -Aclippy::nonminimal_bool -Aclippy::redundant_pattern_matching --cap-lints warn"
6+
7+
[target.x86_64-pc-windows-msvc]
8+
linker = "rust-lld"
9+
10+
[env]
11+
CARGO_WORKSPACE_DIR = { value = "", relative = true }

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# https://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
end_of_line = lf
8+
insert_final_newline = true
9+
indent_style = space
10+
11+
[*.{rs,toml}]
12+
indent_size = 4
13+
14+
[*.ts]
15+
indent_size = 4
16+
[*.js]
17+
indent_size = 4
18+
[*.json]
19+
indent_size = 4

.git-blame-ignore-revs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# for this file to take effect make sure you use git ^2.23 and
2+
# add ignoreFile to your git configuration:
3+
# ```
4+
# git config --global blame.ignoreRevsFile .git-blame-ignore-revs
5+
# ```
6+
7+
# prettier format
8+
f247090558c9ba3c551566eae5882b7ca865225f

.gitattributes

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
* text=auto eol=lf
2+
# git grep shouldn't match entries in this benchmark data
3+
bench_data/** binary
4+
crates/syntax/test_data/** -text eof=LF
5+
# Older git versions try to fix line endings on images, this prevents it.
6+
*.png binary
7+
*.jpg binary
8+
*.ico binary

.github/ISSUE_TEMPLATE/blank_issue.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Blank Issue
3+
about: Create a blank issue.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+

.github/ISSUE_TEMPLATE/bug_report.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Bug report
3+
about: Create a bug report for rust-analyzer.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
Troubleshooting guide: https://rust-analyzer.github.io/manual.html#troubleshooting
12+
Forum for questions: https://users.rust-lang.org/c/ide/14
13+
14+
Before submitting, please make sure that you're not running into one of these known issues:
15+
16+
1. extension doesn't load in VSCodium: #11080
17+
2. on-the-fly diagnostics are mostly unimplemented (`cargo check` diagnostics will be shown when saving a file): #3107
18+
19+
Otherwise please try to provide information which will help us to fix the issue faster. Minimal reproducible examples with few dependencies are especially lovely <3.
20+
-->
21+
22+
**rust-analyzer version**: (eg. output of "Rust Analyzer: Show RA Version" command)
23+
24+
**rustc version**: (eg. output of `rustc -V`)
25+
26+
**relevant settings**: (eg. client settings, or environment variables like `CARGO`, `RUSTUP_HOME` or `CARGO_HOME`)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Critical Nightly Regression
3+
about: You are using nightly rust-analyzer and the latest version is unusable.
4+
title: ''
5+
labels: ''
6+
assignees: 'matklad'
7+
8+
---
9+
10+
<!--
11+
Troubleshooting guide: https://rust-analyzer.github.io/manual.html#troubleshooting
12+
13+
Please try to provide information which will help us to fix the issue faster. Minimal reproducible examples with few dependencies are especially lovely <3.
14+
-->
15+
16+
This is a serious regression in nightly and it's important to fix it before the next release.
17+
@matklad, please take a look.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM node:slim
2+
3+
COPY . /action
4+
WORKDIR /action
5+
6+
RUN npm install --production
7+
8+
ENTRYPOINT ["node", "/action/main.js"]
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# github-release
2+
3+
Copy-pasted from
4+
https://github.com/bytecodealliance/wasmtime/tree/8acfdbdd8aa550d1b84e0ce1e6222a6605d14e38/.github/actions/github-release
5+
6+
An action used to publish GitHub releases for `wasmtime`.
7+
8+
As of the time of this writing there's a few actions floating around which
9+
perform github releases but they all tend to have their set of drawbacks.
10+
Additionally nothing handles deleting releases which we need for our rolling
11+
`dev` release.
12+
13+
To handle all this this action rolls-its-own implementation using the
14+
actions/toolkit repository and packages published there. These run in a Docker
15+
container and take various inputs to orchestrate the release from the build.
16+
17+
More comments can be found in `main.js`.
18+
19+
Testing this is really hard. If you want to try though run `npm install` and
20+
then `node main.js`. You'll have to configure a bunch of env vars though to get
21+
anything reasonably working.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: 'wasmtime github releases'
2+
description: 'wasmtime github releases'
3+
inputs:
4+
token:
5+
description: ''
6+
required: true
7+
name:
8+
description: ''
9+
required: true
10+
files:
11+
description: ''
12+
required: true
13+
runs:
14+
using: 'docker'
15+
image: 'Dockerfile'
+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
const core = require('@actions/core');
2+
const path = require("path");
3+
const fs = require("fs");
4+
const github = require('@actions/github');
5+
const glob = require('glob');
6+
7+
function sleep(milliseconds) {
8+
return new Promise(resolve => setTimeout(resolve, milliseconds));
9+
}
10+
11+
async function runOnce() {
12+
// Load all our inputs and env vars. Note that `getInput` reads from `INPUT_*`
13+
const files = core.getInput('files');
14+
const name = core.getInput('name');
15+
const token = core.getInput('token');
16+
const slug = process.env.GITHUB_REPOSITORY;
17+
const owner = slug.split('/')[0];
18+
const repo = slug.split('/')[1];
19+
const sha = process.env.HEAD_SHA;
20+
21+
core.info(`files: ${files}`);
22+
core.info(`name: ${name}`);
23+
24+
const options = {
25+
request: {
26+
timeout: 30000,
27+
}
28+
};
29+
const octokit = github.getOctokit(token, options);
30+
31+
// Delete the previous release since we can't overwrite one. This may happen
32+
// due to retrying an upload or it may happen because we're doing the dev
33+
// release.
34+
const releases = await octokit.paginate("GET /repos/:owner/:repo/releases", { owner, repo });
35+
for (const release of releases) {
36+
if (release.tag_name !== name) {
37+
continue;
38+
}
39+
const release_id = release.id;
40+
core.info(`deleting release ${release_id}`);
41+
await octokit.rest.repos.deleteRelease({ owner, repo, release_id });
42+
}
43+
44+
// We also need to update the `dev` tag while we're at it on the `dev` branch.
45+
if (name == 'nightly') {
46+
try {
47+
core.info(`updating nightly tag`);
48+
await octokit.rest.git.updateRef({
49+
owner,
50+
repo,
51+
ref: 'tags/nightly',
52+
sha,
53+
force: true,
54+
});
55+
} catch (e) {
56+
core.error(e);
57+
core.info(`creating nightly tag`);
58+
await octokit.rest.git.createTag({
59+
owner,
60+
repo,
61+
tag: 'nightly',
62+
message: 'nightly release',
63+
object: sha,
64+
type: 'commit',
65+
});
66+
}
67+
}
68+
69+
// Creates an official GitHub release for this `tag`, and if this is `dev`
70+
// then we know that from the previous block this should be a fresh release.
71+
core.info(`creating a release`);
72+
const release = await octokit.rest.repos.createRelease({
73+
owner,
74+
repo,
75+
name,
76+
tag_name: name,
77+
target_commitish: sha,
78+
prerelease: name === 'nightly',
79+
});
80+
const release_id = release.data.id;
81+
82+
// Upload all the relevant assets for this release as just general blobs.
83+
for (const file of glob.sync(files)) {
84+
const size = fs.statSync(file).size;
85+
const name = path.basename(file);
86+
87+
await runWithRetry(async function () {
88+
// We can't overwrite assets, so remove existing ones from a previous try.
89+
let assets = await octokit.rest.repos.listReleaseAssets({
90+
owner,
91+
repo,
92+
release_id
93+
});
94+
for (const asset of assets.data) {
95+
if (asset.name === name) {
96+
core.info(`delete asset ${name}`);
97+
const asset_id = asset.id;
98+
await octokit.rest.repos.deleteReleaseAsset({ owner, repo, asset_id });
99+
}
100+
}
101+
102+
core.info(`upload ${file}`);
103+
const headers = { 'content-length': size, 'content-type': 'application/octet-stream' };
104+
const data = fs.createReadStream(file);
105+
await octokit.rest.repos.uploadReleaseAsset({
106+
data,
107+
headers,
108+
name,
109+
url: release.data.upload_url,
110+
});
111+
});
112+
}
113+
}
114+
115+
async function runWithRetry(f) {
116+
const retries = 10;
117+
const maxDelay = 4000;
118+
let delay = 1000;
119+
120+
for (let i = 0; i < retries; i++) {
121+
try {
122+
await f();
123+
break;
124+
} catch (e) {
125+
if (i === retries - 1)
126+
throw e;
127+
128+
core.error(e);
129+
const currentDelay = Math.round(Math.random() * delay);
130+
core.info(`sleeping ${currentDelay} ms`);
131+
await sleep(currentDelay);
132+
delay = Math.min(delay * 2, maxDelay);
133+
}
134+
}
135+
}
136+
137+
async function run() {
138+
await runWithRetry(runOnce);
139+
}
140+
141+
run().catch(err => {
142+
core.error(err);
143+
core.setFailed(err.message);
144+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "wasmtime-github-release",
3+
"version": "0.0.0",
4+
"main": "main.js",
5+
"dependencies": {
6+
"@actions/core": "^1.6",
7+
"@actions/github": "^5.0",
8+
"glob": "^7.1.5"
9+
}
10+
}

0 commit comments

Comments
 (0)