Skip to content

Lint on FileCheck directives with missing colon #130981

Description

@jieyouxu

In current compiletest -> FileCheck setup (e.g. codegen/assembly tests), if you forgor a colon : in one of the FileCheck directives, it gets silently ignored by both compilest and FileCheck, meaning that you aren't testing anything.

// tests/assembly/selftest.rs

//@ assembly-output: emit-asm

#![crate_type = "lib"]

// CHECK-LABEL: foo:
//-- CHECK-LABEL: bar: # <- make sure this test is actually testing
// CHECK-NOT ret       # <- notice the missing `:`?
#[no_mangle]
pub fn foo(x: u8) {}

This test currently will just silently pass, even though we wanted to check ret doesn't exist (made-up example for illustration purposes). Realized while reviewing #128018.

Example missing colon (real example): #125626.

We should probably aim to lint on cases like this.

Activity

  1. added
    A-compiletestArea: The compiletest test runner
    A-testsuiteArea: The testsuite used to check the correctness of rustc
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    on Sep 28, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 28, 2024
  3. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 28, 2024
  4. added
    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
    and removed
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Oct 17, 2024
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

    A-compiletestArea: The compiletest test runnerA-testsuiteArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions