Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint on FileCheck directives with missing colon #130981

Open
jieyouxu opened this issue Sep 28, 2024 · 0 comments
Open

Lint on FileCheck directives with missing colon #130981

jieyouxu opened this issue Sep 28, 2024 · 0 comments
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jieyouxu
Copy link
Member

jieyouxu commented Sep 28, 2024

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.

@jieyouxu jieyouxu added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Sep 28, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 28, 2024
@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 28, 2024
@jieyouxu jieyouxu added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
Development

No branches or pull requests

2 participants