-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Make compiletests (run-pass, compile-fail, etc) usable for testing arbitrary rust programs #20458
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
Comments
If I understand this correctly, we would be able to write our own tests that ensure that a certain piece of code should not compile? If so, I'm in favor!. |
I'm a little unclear on what's desired here. Is support for testing that compilation fails the primary thing? Cargo can test standalone executables already. Would adding a 'compile-fail' mode to Cargo be sufficient, or is there really a need to distribute a standalone compiletest exe? compiletest is super-crufty (it's some of the oldest rust code in existence!) and currently tailored very specifically to rustc's in-tree needs. |
For my cases, something built into Cargo that says "this line should fail to compile with this error" would be more than sufficient. I don't want to claim that's what @Manishearth wants though 😸 |
Well, also the matching comments with warnings would be nice. We could also redesign the compile tests to be more similar to the |
Is this a dupe of #12335? |
I think something like: #[test] // or #[compile_test]
#[should_not_compile(expected = "compiler error message/error type")]
fn compile_test() {} would be very useful, if it is integrated with cargo. |
dupe of #12335 |
Custom lints and syntax extensions would benefit from some in built support for testing.
The text was updated successfully, but these errors were encountered: