Skip to content

Commit 93586af

Browse files
jyn514cuviper
authored andcommitted
[intra-doc links] Don't check feature gates of items re-exported across crates
It should be never break another crate to re-export a public item. Note that this doesn't check the feature gate at *all* for other crates: - Feature-gates aren't currently serialized, so the only way to check the gate is with ad-hoc attribute checking. - Checking the feature gate twice (once when documenting the original crate and one when documenting the current crate) seems not great. This should still catch using the feature most of the time though, since people tend to document their own crates. (cherry picked from commit fdb32e9)
1 parent 03fe394 commit 93586af

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,10 @@ impl LinkCollector<'_, '_> {
12061206
// for discussion on the matter.
12071207
verify(kind, id)?;
12081208

1209+
// FIXME: it would be nice to check that the feature gate was enabled in the original crate, not just ignore it altogether.
1210+
// However I'm not sure how to check that across crates.
12091211
if prim == PrimitiveType::RawPointer
1212+
&& item.def_id.is_local()
12101213
&& !self.cx.tcx.features().intra_doc_pointers
12111214
{
12121215
let span = super::source_span_for_markdown_range(
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#![feature(intra_doc_pointers)]
2+
#![crate_name = "inner"]
3+
/// Link to [some pointer](*const::to_raw_parts)
4+
pub fn foo() {}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// aux-build:pointer-reexports-allowed.rs
2+
// check-pass
3+
extern crate inner;
4+
pub use inner::foo;

0 commit comments

Comments
 (0)