Skip to content

rust: a same-named function's test in another module lends exposed to an unasserted match arm #6537

Closed

Description

@EffortlessSteven

Found by the false-credit trap corpus (case trap-delay-borrowed-same-name, subject authored-trap-kit), main 1273096.

Repro

Two sibling modules define the same enum and function:

// src/heaters.rs (edited)          // src/coolers.rs (untouched)
pub fn delay(mode: Mode) -> u32 {   pub fn delay(mode: Mode) -> u32 {
    match mode {                        match mode {
        Mode::Warm => 5,  // edit           Mode::Warm => 5,
        Mode::Cold => 50,                   Mode::Cold => 50,
    }                                   }
}                                   }
#[test] fn cold_delay() {           #[test] fn warm_delay() {
    assert_eq!(delay(Mode::Cold), 50);  assert_eq!(delay(Mode::Warm), 5);
}                                   }

Edit heaters.rs: Mode::Warm => 5, → Mode::Warm => 2 + 3,.

ripr: exposed, confidence 1.00. "Related tests appear to reach delay: cold_delay, warm_delay". warm_delay calls coolers::delay, not heaters::delay.

Truth (rustc 1.95, cargo test): mutants 6, 0, 1 of the Warm arm in heaters all pass. Not discriminated. This is a false exposed.

The control that isolates the shape: the same module with a uniquely named enum and function (trap-delay-sibling-arm, Tier::Basic edited and only Tier::Premium asserted) reads weakly_exposed, which is correct. So the credit comes from the other module's test, not from the shared Enum:: qualifier alone.

Related

Expected

A test whose call resolves to a different module's function (by path, use, or super::) does not relate to the owner and supplies neither reach nor a confirming token. With only cold_delay left, the arm reads weakly_exposed.

Goal it hurts

Trustworthy verdicts. A false exposed hides a real gap.

Owner

The "Kill false strong verdicts" thread.

Activity

  1. EffortlessSteven commented on Oct 5, 2026

    @EffortlessSteven
    MemberAuthor

    The corpus case behind this issue is trap-delay-borrowed-same-name in #6687. It is now isolated: heaters has no test of its own, so the only credit available comes from coolers::tests::warm_delay, which calls coolers::delay. ripr still reports exposed on main 6487826 (corpus 2026-10-04.8). The sibling-arm shape on its own now has a separate case, trap-quota-sibling-arm, which reads correctly as weakly_exposed.


    Generated by Claude Code

  2. EffortlessSteven commented on Oct 5, 2026

    @EffortlessSteven
    MemberAuthor

    Acceptance addition: the fix should graduate this shape into fixtures/evidence-promotion-honesty-corpus/corpus.json with must_not_promote, per AGENTS.md "graduate confirmed false-promotions". The verdict-corpus case trap-delay-borrowed-same-name (#6687) should then flip from false_exposed to ideal.


    Generated by Claude Code

  3. EffortlessSteven commented on Oct 17, 2026

    @EffortlessSteven
    MemberAuthor

    Closing as fixed on main.

    Residual: the case abstains rather than reading the ideal gap. If that matters, file it as a separate abstention-narrowing issue.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions