diff options
| author | QuietMisdreavus <grey@quietmisdreavus.net> | 2017-08-21 20:20:21 -0500 |
|---|---|---|
| committer | QuietMisdreavus <grey@quietmisdreavus.net> | 2017-09-05 13:51:08 -0500 |
| commit | bb6de3c9ce1681ff1246c21d2a2ec537f331e258 (patch) | |
| tree | 726810d296d159d07a8435f1bab991b8e000c6fe /src/doc | |
| parent | c491e195c467aa11e736457a6bc451e4fc214df6 (diff) | |
| download | rust-bb6de3c9ce1681ff1246c21d2a2ec537f331e258.tar.gz rust-bb6de3c9ce1681ff1246c21d2a2ec537f331e258.zip | |
add feature gate doc_masked and tests
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/doc-masked.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/doc-masked.md b/src/doc/unstable-book/src/language-features/doc-masked.md new file mode 100644 index 00000000000..0d0a46ce9ee --- /dev/null +++ b/src/doc/unstable-book/src/language-features/doc-masked.md @@ -0,0 +1,37 @@ +# `doc_masked` + +The tracking issue for this feature is: [TODO](TODO) + +----- + +The `doc_masked` feature allows a crate to exclude types from a given crate from appearing in lists +of trait implementations. The specifics of the feature are as follows: + +1. When rustdoc encounters an `extern crate` statement annotated with a `#[doc(masked)]` attribute, + it marks the crate as being masked. + +2. When listing traits a given type implements, rustdoc ensures that traits from masked crates are + not emitted into the documentation. + +3. When listing types that implement a given trait, rustdoc ensures that types from masked crates + are not emitted into the documentation. + +This feature was introduced in PR [TODO](TODO) to ensure that compiler-internal and +implementation-specific types and traits were not included in the standard library's documentation. +Such types would introduce broken links into the documentation. + +```rust +#![feature(doc_masked)] + +// Since std is automatically imported, we need to import it into a separate name to apply the +// attribute. This is used as a simple demonstration, but any extern crate statement will suffice. +#[doc(masked)] +extern crate std as realstd; + +/// A sample marker trait that exists on floating-point numbers, even though this page won't list +/// them! +pub trait MyMarker { } + +impl MyMarker for f32 { } +impl MyMarker for f64 { } +``` |
