Skip to content

Commit fdb32e9

Browse files
committed
[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.
1 parent 8599bff commit fdb32e9

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,10 @@ impl LinkCollector<'_, '_> {
12071207
// for discussion on the matter.
12081208
verify(kind, id)?;
12091209

1210+
// FIXME: it would be nice to check that the feature gate was enabled in the original crate, not just ignore it altogether.
1211+
// However I'm not sure how to check that across crates.
12101212
if prim == PrimitiveType::RawPointer
1213+
&& item.def_id.is_local()
12111214
&& !self.cx.tcx.features().intra_doc_pointers
12121215
{
12131216
let span = super::source_span_for_markdown_range(
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() {}
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)