← Back to Pull requests

Reject `Some` without parentheses when implicit_some is enabled #655

Closed
unknown closed this pull request without merging on Oct 31, 2026 12:41 UTC
View on GitHub
unknown unknown commented on Oct 31, 2026 07:50 UTC
Author

implicit_some drops a Some that is not followed by (

deserialize_option in src/de/mod.rs consumes Some and the whitespace after it before checking for (. Without implicit_some a missing ( falls through to ExpectedOption, but with the extension it falls through to the implicit Some branch instead, so the consumed Some is silently discarded and whatever follows is read as the inner value. Any document can enable the extension itself, so this is accepted:

#[derive(Deserialize)]
struct Config { name: Option<String>, ports: Option<Vec<u16>>, limit: Option<Option<u32>> }

// Ok(Config { name: Some("admin"), ports: Some([80]), limit: Some(Some(5)) })
ron::from_str::<Config>(r#"#![enable(implicit_some)] (name: Some "admin", ports: Some[80], limit: Some 5)"#);
// Ok(Seq([Option(Some(Number(U8(5))))]))
ron::from_str::<ron::Value>("#![enable(implicit_some)] [Some 5]");

The grammar requires Some, ws, (, the serializer never writes this form, and the same input without the extension is rejected with ExpectedOption.

A Some that is not followed by ( now returns ExpectedOption at the same position with or without implicit_some. Restoring the cursor to before Some instead would not work for deserialize_any (e.g. Option<Value>), which would see the same Some again and recurse through the implicit branch until the recursion limit. The new test in tests/367_implicit_some.rs fails on master and passes with the fix. cargo hack test --feature-powerset passes apart from the timing test in tests/607_quadratic_float_parsing.rs, which also fails on master locally, and cargo +1.64.0 hack clippy --feature-powerset --no-dev-deps is clean with the minimal-versions lockfile.

  • I've included my change in CHANGELOG.md
  • Diff: 224 lines (+168 / -56) across 2 files Reviewer: juntyr Review duration: 291m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 224 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.324
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #655"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.9% (MEDIUM) · Higher = larger blast radius
    36.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.6% · Safe to merge
    14.6%
    Repository