-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
turn errors from loading external docs into a proper lint #46567
turn errors from loading external docs into a proper lint #46567
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I don't get why the test isn't emitting an error for compiletest. I just copied the file out to a different project and built it with my local rustc, and it gave me exactly the error i expected ("error: couldn't read src/no-docs.md: No such file or directory (os error 2)"), but it looks like compiletest doesn't see an error at all? I don't know what i'm missing. |
Found it! I forgot that compile-fail tests need a main function. Kinda confusing that it didn't emit that error to compiletest, though... |
What are the use cases for this? |
Use cases for what? This is a means of better handling errors that can arise from a feature that has already gone through the RFC process. |
The RFC text states:
Is there a discussion somewhere about this change? Perhaps a more specific question would be useful. When would you want rustc to emit a warning instead of an error if it can't load a file? |
Ah, I missed that it mentioned making it a total compilation error. In that case i can scrap this change and just make it a full error in libsyntax instead. |
@QuietMisdreavus So does this comment mean this PR should be closed or are you going to be modifying this PR? |
@carols10cents I'll close this PR and open a new one. |
Part of #44732
Based on discussion surrounding the original implementation, i wanted (1) the ability to test for errors that can occur during loading the file, and (2) the ability to let people silence them if they don't care about the docs, while also making rustdoc give an error for them.
The current design goes like this:
#[doc(include="filename")]
into a#[doc(include(file="filename, error="error message"))]
if it can't load the file (or if it's not UTF-8).external_doc_error
lint picks up this format and emits a warning if it finds any.#[allow(warnings)]
.I added a test for it, but for some reason it doesn't seem to generate the error i expected. When running compiletest on my own system it didn't seem to generate an error or warning at all. Hence the current WIP status.