-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix intra-link resolution spans in block comments
This commit improves the calculation of code spans for intra-doc resolution failures. All sugared doc comments should now have the correct spans, including those where the comment is longer than the docs. It also fixes an issue where the spans were calculated incorrectly for certain unsugared doc comments. The diagnostic will now always use the span of the attributes, as originally intended. Fixes #55964.
- Loading branch information
Showing
7 changed files
with
238 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
intra-links-warning-crlf.rs eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// ignore-tidy-cr | ||
|
||
// compile-pass | ||
|
||
// This file checks the spans of intra-link warnings in a file with CRLF line endings. The | ||
// .gitattributes file in this directory should enforce it. | ||
|
||
/// [error] | ||
pub struct A; | ||
|
||
/// | ||
/// docs [error1] | ||
/// docs [error2] | ||
/// | ||
pub struct B; | ||
|
||
/** | ||
* This is a multi-line comment. | ||
* | ||
* It also has an [error]. | ||
*/ | ||
pub struct C; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
warning: `[error]` cannot be resolved, ignoring it... | ||
--> $DIR/intra-links-warning-crlf.rs:8:6 | ||
| | ||
LL | /// [error] | ||
| ^^^^^ cannot be resolved, ignoring | ||
| | ||
= note: #[warn(intra_doc_link_resolution_failure)] on by default | ||
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` | ||
|
||
warning: `[error1]` cannot be resolved, ignoring it... | ||
--> $DIR/intra-links-warning-crlf.rs:12:11 | ||
| | ||
LL | /// docs [error1] | ||
| ^^^^^^ cannot be resolved, ignoring | ||
| | ||
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` | ||
|
||
warning: `[error2]` cannot be resolved, ignoring it... | ||
--> $DIR/intra-links-warning-crlf.rs:14:11 | ||
| | ||
LL | /// docs [error2] | ||
| ^^^^^^ cannot be resolved, ignoring | ||
| | ||
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` | ||
|
||
warning: `[error]` cannot be resolved, ignoring it... | ||
--> $DIR/intra-links-warning-crlf.rs:21:20 | ||
| | ||
LL | * It also has an [error]. | ||
| ^^^^^ cannot be resolved, ignoring | ||
| | ||
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters