サンプル
syn 3.0.3: syn::ExprClosure
検証済みサンプル — cargo syn 3.0.3: syn::ExprClosure. rust 1 · linux alpine/x64 · docker で contract を実行し、成功しました: syn::ExprClosure parses closure with typed…
sha256:7382f5bf7a090cfbbeeb65095c31063090fe9a5385a217f2375d9fe4390c16ac
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux · musl x64 cargo
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| rust 1 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · cargo@1rust:1-alpine@sha256:a10e64dd139b… |
2026-09-17 |
ケース
HOW- ゴール
- verify syn::ExprClosure in pkg:cargo/syn@3.0.3
- パッケージ
- シンボル
-
- syn::ExprClosure
- 作成日
- 2026-09-17T14:25:33Z
コントラクト
- syn::ExprClosure parses closure with typed parameters and expression body
- syn::ExprClosure parses move closure with capture token
- syn::ExprClosure parses async closure with async token
- syn::ExprClosure parses closure with explicit return type and block body
- syn::ExprClosure parses closure with higher-ranked lifetime bounds
- syn::ExprClosure rejects invalid closure syntax
ファイル
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
ソース
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "proc-macro2"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
dependencies = [
"proc-macro2",
]
[[package]]
name = "sample-syn-expr-closure"
version = "1.0.0"
dependencies = [
"syn",
]
[[package]]
name = "syn"
version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
[package]
name = "sample-syn-expr-closure"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
syn = { version = "=3.0.3", features = ["full", "extra-traits"] }
[[bin]]
name = "contract"
path = "test/contract.rs"
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify syn::ExprClosure in pkg:cargo/syn@3.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/syn@3.0.3
Demonstrate these symbols/APIs:
- syn::ExprClosure
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:94525718de98c993202d1ce95fb087a91c6b7103500e353ebf12c31d80de9e2b","contract":["syn::ExprClosure parses closure with typed parameters and expression body","syn::ExprClosure parses move closure with capture token","syn::ExprClosure parses async closure with async token","syn::ExprClosure parses closure with explicit return type and block body","syn::ExprClosure parses closure with higher-ranked lifetime bounds","syn::ExprClosure rejects invalid closure syntax"],"goal":"verify syn::ExprClosure in pkg:cargo/syn@3.0.3","kind":"HOW","packages":["pkg:cargo/syn@3.0.3"],"schemaVersion":1,"symbols":["syn::ExprClosure"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","libc":"musl","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/syn@3.0.3"],"schemaVersion":1,"subject":"pkg:cargo/syn@3.0.3","symbols":["syn::ExprClosure"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify syn::ExprClosure in pkg:cargo/syn@3.0.3",
"kind": "HOW",
"packages": [
"pkg:cargo/syn@3.0.3"
],
"symbols": [
"syn::ExprClosure"
]
}
//! Clean-room verification sample for syn::ExprClosure.
pub use syn::ExprClosure;
use syn::{parse_str, Expr, ExprClosure, ReturnType};
fn main() {
// 1. syn::ExprClosure parses closure with typed parameters and expression body
let code1 = "|x: i32| x + 1";
let closure1: ExprClosure = parse_str(code1).expect("failed to parse basic closure");
assert_eq!(closure1.inputs.len(), 1);
assert!(closure1.capture.is_none());
assert!(closure1.asyncness.is_none());
assert!(closure1.constness.is_none());
assert!(closure1.lifetimes.is_none());
assert!(matches!(closure1.output, ReturnType::Default));
assert!(matches!(*closure1.body, Expr::Binary(_)));
// 2. syn::ExprClosure parses move closure with capture token
let code2 = "move |a, b| a + b";
let closure2: ExprClosure = parse_str(code2).expect("failed to parse move closure");
assert_eq!(closure2.inputs.len(), 2);
assert!(closure2.capture.is_some());
assert!(closure2.asyncness.is_none());
// 3. syn::ExprClosure parses async closure with async token
let code3 = "async || 42";
let closure3: ExprClosure = parse_str(code3).expect("failed to parse async closure");
assert!(closure3.inputs.is_empty());
assert!(closure3.asyncness.is_some());
assert!(closure3.capture.is_none());
// 4. syn::ExprClosure parses closure with explicit return type and block body
let code4 = "|x: i32| -> i32 { x * 2 }";
let closure4: ExprClosure = parse_str(code4).expect("failed to parse closure with return type");
assert_eq!(closure4.inputs.len(), 1);
assert!(matches!(closure4.output, ReturnType::Type(_, _)));
assert!(matches!(*closure4.body, Expr::Block(_)));
// 5. syn::ExprClosure parses closure with higher-ranked lifetime bounds
let code5 = "for<'a> |x: &'a i32| *x";
let closure5: ExprClosure = parse_str(code5).expect("failed to parse closure with lifetimes");
assert!(closure5.lifetimes.is_some());
assert_eq!(closure5.inputs.len(), 1);
// 6. syn::ExprClosure rejects invalid closure syntax
assert!(parse_str::<ExprClosure>("fn not_a_closure() {}").is_err());
assert!(parse_str::<ExprClosure>("let x = 1;").is_err());
println!("All syn::ExprClosure contract assertions passed successfully.");
}
オリジンシーダー
匿名