Skip to content

Warn on broken intra-doc links added to cross-crate re-exports #77276

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

Merged
merged 7 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unneeded ImportItem on glob ones
  • Loading branch information
GuillaumeGomez committed Oct 9, 2020
commit e3b1be3b624d6b225901e617bfe28f55b4ebac6d
12 changes: 1 addition & 11 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2260,17 +2260,7 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
let inner = if self.glob {
if !denied {
let mut visited = FxHashSet::default();
if let Some(mut items) = inline::try_inline_glob(cx, path.res, &mut visited) {
items.push(Item {
name: None,
attrs: self.attrs.clean(cx),
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: None,
deprecation: None,
inner: ImportItem(Import::new_glob(resolve_use_source(cx, path), false)),
});
if let Some(items) = inline::try_inline_glob(cx, path.res, &mut visited) {
return items;
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/test/rustdoc-ui/pub-export-lint.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#![deny(broken_intra_doc_links)]

/// [somewhere]
//~^ ERROR unresolved link to `somewhere`
pub use std::str::*;
/// [aloha]
//~^ ERROR unresolved link to `aloha`
pub use std::task::RawWakerVTable;
12 changes: 2 additions & 10 deletions src/test/rustdoc-ui/pub-export-lint.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: unresolved link to `somewhere`
error: unresolved link to `aloha`
--> $DIR/pub-export-lint.rs:3:6
|
LL | /// [aloha]
Expand All @@ -11,13 +11,5 @@ LL | #![deny(broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

error: unresolved link to `aloha`
--> $DIR/pub-export-lint.rs:6:6
|
LL | /// [aloha]
| ^^^^^ the module `pub_export_lint` contains no item named `aloha`
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

error: aborting due to 2 previous errors
error: aborting due to previous error

2 changes: 0 additions & 2 deletions src/test/rustdoc/reexport-check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ pub use std::i32;
// @!has 'foo/index.html' '//code' 'pub use self::string::String;'
// @has 'foo/index.html' '//tr[@class="module-item"]' 'String'
pub use std::string::String;
// @!has 'foo/index.html' '//code' 'pub use self::string::*;'
pub use std::string::*;