-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
refactor and reword intra-doc link errors #74528
Conversation
r? @ollie27 (rust_highfive has picked a reviewer for you, use r? to override) |
r? @jyn514 |
} | ||
|
||
diag.help( | ||
r#"to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`"#, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're cleaning up things, I think 'just' is a little dismissive.
r#"to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`"#, | |
r#"to escape `[` and `]` characters, add '\' before them: `\[` or `\]`"#, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. What I'd really like to do here is use a structured suggestion but I don't think that's feasible until pulldown-cmark/pulldown-cmark#373 is fixed.
} | ||
|
||
// FIXME: Create a version of this suggestion for when we don't have the span. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would we not have a span? If it's expanded from a macro or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, or if raw #[doc]
attributes are used.
if extra_fragment.is_some() { | ||
return Err(ErrorKind::AnchorFailure( | ||
"primitive types cannot be followed by anchors", | ||
)); | ||
return Err(ErrorKind::AnchorFailure(AnchorFailure::Primitive)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to factor all this out somehow ... but I don't have a clear idea for how to do so.
063da65
to
3b4c3e2
Compare
The CI failure is from |
This commit refactors intra-doc link error reporting to deduplicate code and decouple error construction from the type of error. This greatly improves flexibility at each error construction site, while reducing the complexity of the diagnostic creation. This commit also rewords the diagnostics for clarity and style: - Diagnostics should not end in periods. - It's unnecessary to say "ignoring it". Since this is a warning by default, it's already clear that the link is ignored.
3b4c3e2
to
7f3e2c0
Compare
@bors r+ |
📌 Commit 7f3e2c0 has been approved by |
🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened |
refactor and reword intra-doc link errors This commit refactors intra-doc link error reporting to deduplicate code and decouple error construction from the type of error. This greatly improves flexibility at each error construction site, while reducing the complexity of the diagnostic creation. This commit also rewords the diagnostics for clarity and style: - Diagnostics should not end in periods. - It's unnecessary to say "ignoring it". Since this is a warning by default, it's already clear that the link is ignored.
…arth Rollup of 9 pull requests Successful merges: - rust-lang#73655 (va_args implementation for AAPCS.) - rust-lang#73893 (Stabilize control-flow-guard codegen option) - rust-lang#74237 (compiletest: Rewrite extract_*_version functions) - rust-lang#74454 (small coherence cleanup) - rust-lang#74528 (refactor and reword intra-doc link errors) - rust-lang#74568 (Apply rust-lang#66379 to `*mut T` `as_ref`) - rust-lang#74570 (Use forge links for prioritization procedure) - rust-lang#74589 (Update books) - rust-lang#74635 (Fix tooltip position if the documentation starts with a code block) Failed merges: r? @ghost
This commit refactors intra-doc link error reporting to deduplicate code
and decouple error construction from the type of error. This greatly
improves flexibility at each error construction site, while reducing the
complexity of the diagnostic creation.
This commit also rewords the diagnostics for clarity and style:
default, it's already clear that the link is ignored.