Open sffc opened 3 days ago
@Manishearth found the documentation for it:
It says:
As detailed in the chapter on documentation tests, you can add a compile_fail attribute to a doctest to state that the test should fail to compile. However, on nightly, you can optionally add an error number to state that a doctest should emit a specific error number:
```compile_fail,E0044 extern { fn some_func<T>(x: T); } ```
This is used by the error index to ensure that the samples that correspond to a given error number properly emit that error code. However, these error codes aren't guaranteed to be the only thing that a piece of code emits from version to version, so this is unlikely to be stabilized in the future.
Attempting to use these error numbers on stable will result in the code sample being interpreted as plain text.
We do run tests on nightly each night.
However, I'm a bit concerned by the last line. I think it would be nice if on stable we would still enforce the compile_fail. But maybe that's not necessary.
I wonder if it still produces the "this code does not compile" CSS styles in the rustdoc?
Huh I thought this was already stable.
Apparently (#5747) we can use notation such as
This isn't documented anywhere, but it is a feature for Rust developers according to @Manishearth. We should use it everywhere to make sure our
compile_fail
tests continue failing for the same reason.CC @robertbastian