Sample
syn 3.0.3: syn::ExprMethodCall
Verified sample for cargo syn 3.0.3: syn::ExprMethodCall. The contract ran on rust 1 · linux alpine/x64 · docker and passed: syn::parse_str parses a basic…
sha256:106ad4546b87d27088ad88d577df206b0c40634716469f8193947888b6fdf970
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux · alpine · musl x64 cargo
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-19 |
Case
HOW- Goal
- verify syn::ExprMethodCall in pkg:cargo/syn@3.0.3
- Packages
- Symbols
-
- syn::ExprMethodCall
- Created
- 2026-09-17T16:03:11Z
Contract
- syn::parse_str parses a basic method call into syn::ExprMethodCall with receiver and method ident
- syn::parse_str parses a method call with turbofish generic arguments into syn::ExprMethodCall with AngleBracketedGenericArguments
- syn::parse_str parses chained method calls into nested syn::ExprMethodCall receivers
- syn::parse_str parses method calls with multiple arguments preserving argument order
- syn::parse_str parses method calls with outer attributes into syn::ExprMethodCall with attrs
- syn::parse_str distinguishes method calls from field access returning Expr::MethodCall vs Expr::Field
Files
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
Source
# 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"
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.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab72a15cf68d77cb0987d3684aa8a45c5ef827e8cb49ee2f30bfd7ba2feb519f"
[package]
name = "sample-syn"
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::ExprMethodCall 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::ExprMethodCall
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:800ab95f196f7ac31242049fa52650bff4cfa188091de76cffd71629b781265f","contract":["syn::parse_str parses a basic method call into syn::ExprMethodCall with receiver and method ident","syn::parse_str parses a method call with turbofish generic arguments into syn::ExprMethodCall with AngleBracketedGenericArguments","syn::parse_str parses chained method calls into nested syn::ExprMethodCall receivers","syn::parse_str parses method calls with multiple arguments preserving argument order","syn::parse_str parses method calls with outer attributes into syn::ExprMethodCall with attrs","syn::parse_str distinguishes method calls from field access returning Expr::MethodCall vs Expr::Field"],"goal":"verify syn::ExprMethodCall in pkg:cargo/syn@3.0.3","kind":"HOW","packages":["pkg:cargo/syn@3.0.3"],"schemaVersion":1,"symbols":["syn::ExprMethodCall"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","distro":"alpine","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::ExprMethodCall"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify syn::ExprMethodCall in pkg:cargo/syn@3.0.3",
"kind": "HOW",
"packages": [
"pkg:cargo/syn@3.0.3"
],
"symbols": [
"syn::ExprMethodCall"
]
}
//! Clean-room verification sample for syn::ExprMethodCall.
pub use syn::*;
use syn::{parse_str, Expr, ExprField, ExprMethodCall, GenericArgument, Lit, Type};
fn main() {
// 1. syn::parse_str parses a basic method call into syn::ExprMethodCall with receiver and method ident
let expr: Expr = parse_str("receiver.do_something()").expect("failed to parse basic method call");
match expr {
Expr::MethodCall(call) => {
assert_eq!(call.method.to_string(), "do_something");
match *call.receiver {
Expr::Path(ref p) => assert_eq!(p.path.segments[0].ident.to_string(), "receiver"),
_ => panic!("expected Expr::Path for receiver"),
}
assert!(call.turbofish.is_none());
assert!(call.args.is_empty());
}
_ => panic!("expected Expr::MethodCall"),
}
// 2. syn::parse_str parses a method call with turbofish generic arguments into syn::ExprMethodCall with AngleBracketedGenericArguments
let expr: Expr = parse_str("iter.collect::<Vec<i32>>()").expect("failed to parse turbofish method call");
match expr {
Expr::MethodCall(call) => {
assert_eq!(call.method.to_string(), "collect");
let turbofish = call.turbofish.expect("expected turbofish generic arguments");
assert_eq!(turbofish.args.len(), 1);
match turbofish.args.first().unwrap() {
GenericArgument::Type(Type::Path(type_path)) => {
assert_eq!(type_path.path.segments[0].ident.to_string(), "Vec");
}
_ => panic!("expected Type::Path for generic argument"),
}
}
_ => panic!("expected Expr::MethodCall"),
}
// 3. syn::parse_str parses chained method calls into nested syn::ExprMethodCall receivers
let expr: Expr = parse_str("builder.step_one().step_two()").expect("failed to parse chained method calls");
match expr {
Expr::MethodCall(outer) => {
assert_eq!(outer.method.to_string(), "step_two");
match *outer.receiver {
Expr::MethodCall(inner) => {
assert_eq!(inner.method.to_string(), "step_one");
match *inner.receiver {
Expr::Path(p) => assert_eq!(p.path.segments[0].ident.to_string(), "builder"),
_ => panic!("expected Expr::Path for base receiver"),
}
}
_ => panic!("expected Expr::MethodCall for outer receiver"),
}
}
_ => panic!("expected Expr::MethodCall"),
}
// 4. syn::parse_str parses method calls with multiple arguments preserving argument order
let expr: Expr = parse_str("map.insert(\"key\", 42)").expect("failed to parse method call with arguments");
match expr {
Expr::MethodCall(call) => {
assert_eq!(call.method.to_string(), "insert");
assert_eq!(call.args.len(), 2);
match (&call.args[0], &call.args[1]) {
(Expr::Lit(lit0), Expr::Lit(lit1)) => {
match (&lit0.lit, &lit1.lit) {
(Lit::Str(s), Lit::Int(i)) => {
assert_eq!(s.value(), "key");
assert_eq!(i.base10_parse::<i32>().unwrap(), 42);
}
_ => panic!("expected Lit::Str and Lit::Int arguments"),
}
}
_ => panic!("expected Expr::Lit arguments"),
}
}
_ => panic!("expected Expr::MethodCall"),
}
// 5. syn::parse_str parses method calls with outer attributes into syn::ExprMethodCall with attrs
let expr: Expr = parse_str("#[inline] target.run()").expect("failed to parse method call with attribute");
match expr {
Expr::MethodCall(call) => {
assert_eq!(call.attrs.len(), 1);
assert_eq!(call.method.to_string(), "run");
}
_ => panic!("expected Expr::MethodCall"),
}
// 6. syn::parse_str distinguishes method calls from field access returning Expr::MethodCall vs Expr::Field
let field_expr: Expr = parse_str("obj.field").expect("failed to parse field access");
assert!(matches!(field_expr, Expr::Field(ExprField { .. })));
let method_expr: Expr = parse_str("obj.method()").expect("failed to parse method call");
assert!(matches!(method_expr, Expr::MethodCall(ExprMethodCall { .. })));
println!("All syn::ExprMethodCall contract assertions passed successfully.");
}
Origin Seeder
anonymous