Skip to content

Commit 24bfcee

Browse files
committed
Auto merge of #82295 - jyn514:feature-gate, r=Manishearth
[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. Closes #82284. r? `@Manishearth`
2 parents 3e826bb + fdb32e9 commit 24bfcee

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
@@ -1203,7 +1203,10 @@ impl LinkCollector<'_, '_> {
12031203
// for discussion on the matter.
12041204
verify(kind, id)?;
12051205

1206+
// FIXME: it would be nice to check that the feature gate was enabled in the original crate, not just ignore it altogether.
1207+
// However I'm not sure how to check that across crates.
12061208
if prim == PrimitiveType::RawPointer
1209+
&& item.def_id.is_local()
12071210
&& !self.cx.tcx.features().intra_doc_pointers
12081211
{
12091212
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)