rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.71k stars 12.5k forks source link

Negative UI test error annotations #129460

Open jieyouxu opened 3 weeks ago

jieyouxu commented 3 weeks ago

I wish there is a negative assertion, saying that here one shall not expect a HELP note.

_Originally posted by @dingxiangfei2009 in https://github.com/rust-lang/rust/pull/107251#discussion_r1725678959_


Something that might be nice-to-have is negative ui test error annotations, i.e. that we explicitly want to make sure some diagnostic is not emitted (analogous to FileCheck check-NOT annotations).

Obviously, you can rely on checking the blessed stderr, but a negative ui test annotation could help communicate intent in the test itself and is less prone to accidentally letting the blessed stderr though.

Note: we should probably try to make the directive parser more robust and less hacky before attempting to add more syntax.

dingxiangfei2009 commented 3 weeks ago

Let me know if we would like to go ahead with this feature. I am getting my hands dirty enough with compiletest that I feel like I know how to. 😄

jieyouxu commented 3 weeks ago

@dingxiangfei2009 Thanks for the interest. I would be happy to aid and review this feature, but I feel like we want to make compiletest a bit more maintainable first, see e.g. https://github.com/rust-lang/rust/pull/128070. I think we should not hack on more syntax for directives and error annotations before we figure out how to make the directive and annotation parser itself a bit more robust, lol.

fmease commented 2 weeks ago

Related: #46667 (2017).