playtranslate
Real-time screen translation app for Android for both language learners and casual gamers
そのコード、コンパイル通る? Rust のコードがコンパイルできるかを考える 10 問クイズ。
Translation pending
EducationRust · JavaScriptGitHub @rei78-4eOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗Rust のコードを見て「コンパイルが通るか」を考える 10 問クイズです。 基礎 3 問 + 応用 7 問がランダムに出題されます。判定はフロントエンドのみで行い、Cloudflare Workers (静的アセット) で動きます。
すべての問題の正解は、実際の rustc 1.99.1 でコンパイルして検証しています。
npm install
npm run dev # questions.json を生成して wrangler dev を起動
npm run deploy # Cloudflare Workers にデプロイ
npm test # 描画関数の round-trip テスト (rustc 不要)
npm run og # シェア用 OG 画像 (public/og/*.png) を再生成
シェアリンク (/?s=<点数>) の OG メタタグは src/worker.js がスコアに合わせて書き換え、
画像は public/og/<点数>.png を使います。画像はコミット済みで、称号 (public/ranks.js) や
デザインを変えたときだけ npm run og で作り直します (Noto Sans JP と Monaspace Radon のシステムフォントが必要)。
独自ドメインで公開する場合は、wrangler.jsonc の routes のコメントを外してください。
questions/basic/ (基礎) か questions/advanced/ (応用) に .rs ファイルを 1 つ置くだけです。
// ---
// topic: 借用
// answer: error
// edition: 2024
// explain: 解説文。`code` はインラインコードになります。
// キーのない行は前のキーの続き (改行) として扱われます。
// ---
fn main() {
// ここから下が出題されるコード
}
| キー | 必須 | 内容 |
|---|---|---|
answer | ○ | ok (コンパイルが通る) / error (コンパイルエラー) |
explain | ○ | 回答後に表示する解説 |
topic | 画面に表示するタグ (所有権、借用など) | |
edition | 2015 / 2018 / 2021 / 2024 (省略時は 2024) |
追加したら検証します。
rustup toolchain install 1.99.1 --profile minimal # 初回のみ
npm run verify # 全問題をコンパイルして answer と照合
npm run verify -- 036 # id の部分一致で絞り込み
npm run verify は結果と rustc のエラーメッセージを questions/verified.json に保存します。
このファイルはコミットしてください。npm run build はこの保存結果を使うので、rustc がないビルド環境でも動きます。
verified.json は更新されません (終了コード 1)。verified.json には問題ごとに、実行した rustc のバージョンと引数 (rustc +1.99.1 --edition 2024 main.rs) も保存されます。status と compiles の矛盾、エラー問題の output に error 行があるか、成功問題に error 行が混ざっていないかなども検査し、矛盾があれば失敗します。npm run verify -- 036 のように絞り込んだ場合、他の問題の検証結果はそのまま残ります。ただし toolchain が既存の結果と違う場合は混在を防ぐため書き込みません。別のツールチェインで検証する場合は RUST_TOOLCHAIN=1.100.0 npm run verify のように指定します。
全問を同じ toolchain で検証し直す必要があります。
GitHub Actions (.github/workflows/ci.yml) で以下を実行します。
npm test — 描画関数 (public/render.js) の round-trip テストnpm run verify — rustc 1.99.1 で全問をコンパイルquestions/verified.json が最新か (git diff --exit-code)npm run build — public/questions.json の生成