Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > e50df336eb49b92dbadf6dedc48b7934 > files > 11289

rust-doc-1.27.0-1.mga6.x86_64.rpm

<!DOCTYPE HTML>
<html lang="en" class="sidebar-visible no-js">
    <head>
        <!-- Book generated using mdBook -->
        <meta charset="UTF-8">
        <title>Unstable features - </title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="theme-color" content="#ffffff" />

        <base href="">

        <link rel="stylesheet" href="book.css">
        <link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
        <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500" rel="stylesheet" type="text/css">

        <link rel="shortcut icon" href="favicon.png">

        <!-- Font Awesome -->
        <link rel="stylesheet" href="_FontAwesome/css/font-awesome.css">

        <link rel="stylesheet" href="highlight.css">
        <link rel="stylesheet" href="tomorrow-night.css">
        <link rel="stylesheet" href="ayu-highlight.css">

        <!-- Custom theme stylesheets -->
        

        

    </head>
    <body class="light">
        <!-- Work around some values being stored in localStorage wrapped in quotes -->
        <script type="text/javascript">
            try {
                var theme = localStorage.getItem('mdbook-theme');
                var sidebar = localStorage.getItem('mdbook-sidebar');

                if (theme.startsWith('"') && theme.endsWith('"')) {
                    localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
                }

                if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
                    localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
                }
            } catch (e) { }
        </script>

        <!-- Set the theme before any content is loaded, prevents flash -->
        <script type="text/javascript">
            var theme;
            try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } 
            if (theme === null || theme === undefined) { theme = 'light'; }
            document.body.className = theme;
            document.querySelector('html').className = theme + ' js';
        </script>

        <!-- Hide / unhide sidebar before it is displayed -->
        <script type="text/javascript">
            var html = document.querySelector('html');
            var sidebar = 'hidden';
            if (document.body.clientWidth >= 1080) {
                try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
                sidebar = sidebar || 'visible';
            }
            html.classList.remove('sidebar-visible');
            html.classList.add("sidebar-" + sidebar);
        </script>

        <nav id="sidebar" class="sidebar" aria-label="Table of contents">
            <ol class="chapter"><li><a href="what-is-rustdoc.html"><strong aria-hidden="true">1.</strong> What is rustdoc?</a></li><li><a href="command-line-arguments.html"><strong aria-hidden="true">2.</strong> Command-line arguments</a></li><li><a href="the-doc-attribute.html"><strong aria-hidden="true">3.</strong> The #[doc] attribute</a></li><li><a href="documentation-tests.html"><strong aria-hidden="true">4.</strong> Documentation tests</a></li><li><a href="passes.html"><strong aria-hidden="true">5.</strong> Passes</a></li><li><a href="unstable-features.html" class="active"><strong aria-hidden="true">6.</strong> Unstable features</a></li></ol>
        </nav>

        <div id="page-wrapper" class="page-wrapper">

            <div class="page">
                
                <div id="menu-bar" class="menu-bar">
                    <div id="menu-bar-sticky-container">
                        <div class="left-buttons">
                            <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
                                <i class="fa fa-bars"></i>
                            </button>
                            <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
                                <i class="fa fa-paint-brush"></i>
                            </button>
                            <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
                                <li role="none"><button role="menuitem" class="theme" id="light">Light <span class="default">(default)</span></button></li>
                                <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
                                <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
                                <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
                                <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
                            </ul>
                            
                            <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
                                <i class="fa fa-search"></i>
                            </button>
                            
                        </div>

                        <h1 class="menu-title"></h1> 

                        <div class="right-buttons">
                            <a href="print.html" title="Print this book" aria-label="Print this book">
                                <i id="print-button" class="fa fa-print"></i>
                            </a>
                        </div>
                    </div>
                </div>

                
                <div id="search-wrapper" class="hidden">
                    <form id="searchbar-outer" class="searchbar-outer">
                        <input type="search" name="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
                    </form>
                    <div id="searchresults-outer" class="searchresults-outer hidden">
                        <div id="searchresults-header" class="searchresults-header"></div>
                        <ul id="searchresults">
                        </ul>
                    </div>
                </div>
                

                <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
                <script type="text/javascript">
                    document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
                    document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
                    Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
                        link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
                    });
                </script>

                <div id="content" class="content">
                    <main>
                        <a class="header" href="unstable-features.html#unstable-features" id="unstable-features"><h1>Unstable features</h1></a>
<p>Rustdoc is under active developement, and like the Rust compiler, some features are only available
on the nightly releases. Some of these are new and need some more testing before they're able to get
released to the world at large, and some of them are tied to features in the Rust compiler that are
themselves unstable. Several features here require a matching <code>#![feature(...)]</code> attribute to
enable, and thus are more fully documented in the <a href="../unstable-book/index.html">Unstable Book</a>. Those sections will link over
there as necessary.</p>
<a class="header" href="unstable-features.html#nightly-gated-functionality" id="nightly-gated-functionality"><h2>Nightly-gated functionality</h2></a>
<p>These features just require a nightly build to operate. Unlike the other features on this page,
these don't need to be &quot;turned on&quot; with a command-line flag or a <code>#![feature(...)]</code> attribute in
your crate. This can give them some subtle fallback modes when used on a stable release, so be
careful!</p>
<a class="header" href="unstable-features.html#error-numbers-for-compile-fail-doctests" id="error-numbers-for-compile-fail-doctests"><h3>Error numbers for <code>compile-fail</code> doctests</h3></a>
<p>As detailed in <a href="documentation-tests.html#attributes">the chapter on documentation tests</a>, you can add a
<code>compile_fail</code> attribute to a doctest to state that the test should fail to compile. However, on
nightly, you can optionally add an error number to state that a doctest should emit a specific error
number:</p>
<pre><code class="language-markdown">```compile_fail,E0044
extern { fn some_func&lt;T&gt;(x: T); }
```
</code></pre>
<p>This is used by the error index to ensure that the samples that correspond to a given error number
properly emit that error code. However, these error codes aren't guaranteed to be the only thing
that a piece of code emits from version to version, so this is unlikely to be stabilized in the
future.</p>
<p>Attempting to use these error numbers on stable will result in the code sample being interpreted as
plain text.</p>
<a class="header" href="unstable-features.html#linking-to-items-by-type" id="linking-to-items-by-type"><h3>Linking to items by type</h3></a>
<p>As designed in <a href="https://github.com/rust-lang/rfcs/pull/1946">RFC 1946</a>, Rustdoc can parse paths to items when you use them as links. To resolve
these type names, it uses the items currently in-scope, either by declaration or by <code>use</code> statement.
For modules, the &quot;active scope&quot; depends on whether the documentation is written outside the module
(as <code>///</code> comments on the <code>mod</code> statement) or inside the module (at <code>//!</code> comments inside the file
or block). For all other items, it uses the enclosing module's scope.</p>
<p>For example, in the following code:</p>
<pre><pre class="playpen"><code class="language-rust">
# #![allow(unused_variables)]
#fn main() {
/// Does the thing.
pub fn do_the_thing(_: SomeType) {
    println!(&quot;Let's do the thing!&quot;);
}

/// Token you use to [`do_the_thing`].
pub struct SomeType;
#}</code></pre></pre>
<p>The link to <code>[`do_the_thing`]</code> in <code>SomeType</code>'s docs will properly link to the page for <code>fn do_the_thing</code>. Note that here, rustdoc will insert the link target for you, but manually writing the
target out also works:</p>
<pre><pre class="playpen"><code class="language-rust">
# #![allow(unused_variables)]
#fn main() {
pub mod some_module {
    /// Token you use to do the thing.
    pub struct SomeStruct;
}

/// Does the thing. Requires one [`SomeStruct`] for the thing to work.
///
/// [`SomeStruct`]: some_module::SomeStruct
pub fn do_the_thing(_: some_module::SomeStruct) {
    println!(&quot;Let's do the thing!&quot;);
}
#}</code></pre></pre>
<p>For more details, check out <a href="https://github.com/rust-lang/rfcs/pull/1946">the RFC</a>, and see <a href="https://github.com/rust-lang/rust/issues/43466">the tracking issue</a> for more
information about what parts of the feature are available.</p>
<a class="header" href="unstable-features.html#extensions-to-the-doc-attribute" id="extensions-to-the-doc-attribute"><h2>Extensions to the <code>#[doc]</code> attribute</h2></a>
<p>These features operate by extending the <code>#[doc]</code> attribute, and thus can be caught by the compiler
and enabled with a <code>#![feature(...)]</code> attribute in your crate.</p>
<a class="header" href="unstable-features.html#documenting-platform-feature-specific-information" id="documenting-platform-feature-specific-information"><h3>Documenting platform-/feature-specific information</h3></a>
<p>Because of the way Rustdoc documents a crate, the documentation it creates is specific to the target
rustc compiles for. Anything that's specific to any other target is dropped via <code>#[cfg]</code> attribute
processing early in the compilation process. However, Rustdoc has a trick up its sleeve to handle
platform-specific code if it <em>does</em> receive it.</p>
<p>Because Rustdoc doesn't need to fully compile a crate to binary, it replaces function bodies with
<code>loop {}</code> to prevent having to process more than necessary. This means that any code within a
function that requires platform-specific pieces is ignored. Combined with a special attribute,
<code>#[doc(cfg(...))]</code>, you can tell Rustdoc exactly which platform something is supposed to run on,
ensuring that doctests are only run on the appropriate platforms.</p>
<p>The <code>#[doc(cfg(...))]</code> attribute has another effect: When Rustdoc renders documentation for that
item, it will be accompanied by a banner explaining that the item is only available on certain
platforms.</p>
<p>As mentioned earlier, getting the items to Rustdoc requires some extra preparation. The standard
library adds a <code>--cfg dox</code> flag to every Rustdoc command, but the same thing can be accomplished by
adding a feature to your Cargo.toml and adding <code>--feature dox</code> (or whatever you choose to name the
feature) to your <code>cargo doc</code> calls.</p>
<p>Either way, once you create an environment for the documentation, you can start to augment your
<code>#[cfg]</code> attributes to allow both the target platform <em>and</em> the documentation configuration to leave
the item in. For example, <code>#[cfg(any(windows, feature = &quot;dox&quot;))]</code> will preserve the item either on
Windows or during the documentation process. Then, adding a new attribute <code>#[doc(cfg(windows))]</code>
will tell Rustdoc that the item is supposed to be used on Windows. For example:</p>
<pre><pre class="playpen"><code class="language-rust">
# #![allow(unused_variables)]
#![feature(doc_cfg)]

#fn main() {
/// Token struct that can only be used on Windows.
#[cfg(any(windows, feature = &quot;dox&quot;))]
#[doc(cfg(windows))]
pub struct WindowsToken;

/// Token struct that can only be used on Unix.
#[cfg(any(unix, feature = &quot;dox&quot;))]
#[doc(cfg(unix))]
pub struct UnixToken;
#}</code></pre></pre>
<p>In this sample, the tokens will only appear on their respective platforms, but they will both appear
in documentation.</p>
<p><code>#[doc(cfg(...))]</code> was introduced to be used by the standard library and currently requires the
<code>#![feature(doc_cfg)]</code> feature gate. For more information, see <a href="../unstable-book/language-features/doc-cfg.html">its chapter in the Unstable
Book</a> and <a href="https://github.com/rust-lang/rust/issues/43781">its tracking issue</a>.</p>
<a class="header" href="unstable-features.html#adding-your-trait-to-the-important-traits-dialog" id="adding-your-trait-to-the-important-traits-dialog"><h3>Adding your trait to the &quot;Important Traits&quot; dialog</h3></a>
<p>Rustdoc keeps a list of a few traits that are believed to be &quot;fundamental&quot; to a given type when
implemented on it. These traits are intended to be the primary interface for their types, and are
often the only thing available to be documented on their types. For this reason, Rustdoc will track
when a given type implements one of these traits and call special attention to it when a function
returns one of these types. This is the &quot;Important Traits&quot; dialog, visible as a circle-i button next
to the function, which, when clicked, shows the dialog.</p>
<p>In the standard library, the traits that qualify for inclusion are <code>Iterator</code>, <code>io::Read</code>, and
<code>io::Write</code>. However, rather than being implemented as a hard-coded list, these traits have a
special marker attribute on them: <code>#[doc(spotlight)]</code>. This means that you could apply this
attribute to your own trait to include it in the &quot;Important Traits&quot; dialog in documentation.</p>
<p>The <code>#[doc(spotlight)]</code> attribute currently requires the <code>#![feature(doc_spotlight)]</code> feature gate.
For more information, see <a href="../unstable-book/language-features/doc-spotlight.html">its chapter in the Unstable Book</a> and <a href="https://github.com/rust-lang/rust/issues/45040">its tracking
issue</a>.</p>
<a class="header" href="unstable-features.html#exclude-certain-dependencies-from-documentation" id="exclude-certain-dependencies-from-documentation"><h3>Exclude certain dependencies from documentation</h3></a>
<p>The standard library uses several dependencies which, in turn, use several types and traits from the
standard library. In addition, there are several compiler-internal crates that are not considered to
be part of the official standard library, and thus would be a distraction to include in
documentation. It's not enough to exclude their crate documentation, since information about trait
implementations appears on the pages for both the type and the trait, which can be in different
crates!</p>
<p>To prevent internal types from being included in documentation, the standard library adds an
attribute to their <code>extern crate</code> declarations: <code>#[doc(masked)]</code>. This causes Rustdoc to &quot;mask out&quot;
types from these crates when building lists of trait implementations.</p>
<p>The <code>#[doc(masked)]</code> attribute is intended to be used internally, and requires the
<code>#![feature(doc_masked)]</code> feature gate.  For more information, see <a href="../unstable-book/language-features/doc-masked.html">its chapter in the Unstable
Book</a> and <a href="https://github.com/rust-lang/rust/issues/44027">its tracking issue</a>.</p>
<a class="header" href="unstable-features.html#include-external-files-as-api-documentation" id="include-external-files-as-api-documentation"><h3>Include external files as API documentation</h3></a>
<p>As designed in <a href="https://github.com/rust-lang/rfcs/pull/1990">RFC 1990</a>, Rustdoc can read an external file to use as a type's documentation. This
is useful if certain documentation is so long that it would break the flow of reading the source.
Instead of writing it all inline, writing <code>#[doc(include = &quot;sometype.md&quot;)]</code> (where <code>sometype.md</code> is
a file adjacent to the <code>lib.rs</code> for the crate) will ask Rustdoc to instead read that file and use it
as if it were written inline.</p>
<p><code>#[doc(include = &quot;...&quot;)]</code> currently requires the <code>#![feature(external_doc)]</code> feature gate. For more
information, see <a href="../unstable-book/language-features/external-doc.html">its chapter in the Unstable Book</a> and <a href="https://github.com/rust-lang/rust/issues/44732">its tracking
issue</a>.</p>
<a class="header" href="unstable-features.html#unstable-command-line-arguments" id="unstable-command-line-arguments"><h2>Unstable command-line arguments</h2></a>
<p>These features are enabled by passing a command-line flag to Rustdoc, but the flags in question are
themselves marked as unstable. To use any of these options, pass <code>-Z unstable-options</code> as well as
the flag in question to Rustdoc on the command-line. To do this from Cargo, you can either use the
<code>RUSTDOCFLAGS</code> environment variable or the <code>cargo rustdoc</code> command.</p>
<a class="header" href="unstable-features.html#a--markdown-before-content-include-rendered-markdown-before-the-content" id="a--markdown-before-content-include-rendered-markdown-before-the-content"><h3><code>--markdown-before-content</code>: include rendered Markdown before the content</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z unstable-options --markdown-before-content extra.md
$ rustdoc README.md -Z unstable-options --markdown-before-content extra.md
</code></pre>
<p>Just like <code>--html-before-content</code>, this allows you to insert extra content inside the <code>&lt;body&gt;</code> tag
but before the other content <code>rustdoc</code> would normally produce in the rendered documentation.
However, instead of directly inserting the file verbatim, <code>rustdoc</code> will pass the files through a
Markdown renderer before inserting the result into the file.</p>
<a class="header" href="unstable-features.html#a--markdown-after-content-include-rendered-markdown-after-the-content" id="a--markdown-after-content-include-rendered-markdown-after-the-content"><h3><code>--markdown-after-content</code>: include rendered Markdown after the content</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z unstable-options --markdown-after-content extra.md
$ rustdoc README.md -Z unstable-options --markdown-after-content extra.md
</code></pre>
<p>Just like <code>--html-after-content</code>, this allows you to insert extra content before the <code>&lt;/body&gt;</code> tag
but after the other content <code>rustdoc</code> would normally produce in the rendered documentation.
However, instead of directly inserting the file verbatim, <code>rustdoc</code> will pass the files through a
Markdown renderer before inserting the result into the file.</p>
<a class="header" href="unstable-features.html#a--playground-url-control-the-location-of-the-playground" id="a--playground-url-control-the-location-of-the-playground"><h3><code>--playground-url</code>: control the location of the playground</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z unstable-options --playground-url https://play.rust-lang.org/
</code></pre>
<p>When rendering a crate's docs, this flag gives the base URL of the Rust Playground, to use for
generating <code>Run</code> buttons. Unlike <code>--markdown-playground-url</code>, this argument works for standalone
Markdown files <em>and</em> Rust crates. This works the same way as adding <code>#![doc(html_playground_url = &quot;url&quot;)]</code> to your crate root, as mentioned in <a href="the-doc-attribute.html#html_playground_url">the chapter about the <code>#[doc]</code>
attribute</a>. Please be aware that the official Rust Playground at
https://play.rust-lang.org does not have every crate available, so if your examples require your
crate, make sure the playground you provide has your crate available.</p>
<p>If both <code>--playground-url</code> and <code>--markdown-playground-url</code> are present when rendering a standalone
Markdown file, the URL given to <code>--markdown-playground-url</code> will take precedence. If both
<code>--playground-url</code> and <code>#![doc(html_playground_url = &quot;url&quot;)]</code> are present when rendering crate docs,
the attribute will take precedence.</p>
<a class="header" href="unstable-features.html#a--crate-version-control-the-crate-version" id="a--crate-version-control-the-crate-version"><h3><code>--crate-version</code>: control the crate version</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z unstable-options --crate-version 1.3.37
</code></pre>
<p>When <code>rustdoc</code> receives this flag, it will print an extra &quot;Version (version)&quot; into the sidebar of
the crate root's docs. You can use this flag to differentiate between different versions of your
library's documentation.</p>
<a class="header" href="unstable-features.html#a--linker-control-the-linker-used-for-documentation-tests" id="a--linker-control-the-linker-used-for-documentation-tests"><h3><code>--linker</code>: control the linker used for documentation tests</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc --test src/lib.rs -Z unstable-options --linker foo
$ rustdoc --test README.md -Z unstable-options --linker foo
</code></pre>
<p>When <code>rustdoc</code> runs your documentation tests, it needs to compile and link the tests as executables
before running them. This flag can be used to change the linker used on these executables. It's
equivalent to passing <code>-C linker=foo</code> to <code>rustc</code>.</p>
<a class="header" href="unstable-features.html#a--sort-modules-by-appearance-control-how-items-on-module-pages-are-sorted" id="a--sort-modules-by-appearance-control-how-items-on-module-pages-are-sorted"><h3><code>--sort-modules-by-appearance</code>: control how items on module pages are sorted</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z unstable-options --sort-modules-by-appearance
</code></pre>
<p>Ordinarily, when <code>rustdoc</code> prints items in module pages, it will sort them alphabetically (taking
some consideration for their stability, and names that end in a number). Giving this flag to
<code>rustdoc</code> will disable this sorting and instead make it print the items in the order they appear in
the source.</p>
<a class="header" href="unstable-features.html#a--themes-provide-additional-themes" id="a--themes-provide-additional-themes"><h3><code>--themes</code>: provide additional themes</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z unstable-options --themes theme.css
</code></pre>
<p>Giving this flag to <code>rustdoc</code> will make it copy your theme into the generated crate docs and enable
it in the theme selector. Note that <code>rustdoc</code> will reject your theme file if it doesn't style
everything the &quot;light&quot; theme does. See <code>--theme-checker</code> below for details.</p>
<a class="header" href="unstable-features.html#a--theme-checker-verify-theme-css-for-validity" id="a--theme-checker-verify-theme-css-for-validity"><h3><code>--theme-checker</code>: verify theme CSS for validity</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc -Z unstable-options --theme-checker theme.css
</code></pre>
<p>Before including your theme in crate docs, <code>rustdoc</code> will compare all the CSS rules it contains
against the &quot;light&quot; theme included by default. Using this flag will allow you to see which rules are
missing if <code>rustdoc</code> rejects your theme.</p>
<a class="header" href="unstable-features.html#a--resource-suffix-modifying-the-name-of-cssjavascript-in-crate-docs" id="a--resource-suffix-modifying-the-name-of-cssjavascript-in-crate-docs"><h3><code>--resource-suffix</code>: modifying the name of CSS/JavaScript in crate docs</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z unstable-options --resource-suffix suf
</code></pre>
<p>When rendering docs, <code>rustdoc</code> creates several CSS and JavaScript files as part of the output. Since
all these files are linked from every page, changing where they are can be cumbersome if you need to
specially cache them. This flag will rename all these files in the output to include the suffix in
the filename. For example, <code>light.css</code> would become <code>light-suf.css</code> with the above command.</p>
<a class="header" href="unstable-features.html#a--display-warnings-display-warnings-when-documenting-or-running-documentation-tests" id="a--display-warnings-display-warnings-when-documenting-or-running-documentation-tests"><h3><code>--display-warnings</code>: display warnings when documenting or running documentation tests</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z unstable-options --display-warnings
$ rustdoc --test src/lib.rs -Z unstable-options --display-warnings
</code></pre>
<p>The intent behind this flag is to allow the user to see warnings that occur within their library or
their documentation tests, which are usually suppressed. However, <a href="https://github.com/rust-lang/rust/issues/41574">due to a
bug</a>, this flag doesn't 100% work as intended. See the linked issue for
details.</p>
<a class="header" href="unstable-features.html#a--edition-control-the-edition-of-docs-and-doctests" id="a--edition-control-the-edition-of-docs-and-doctests"><h3><code>--edition</code>: control the edition of docs and doctests</h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z unstable-options --edition 2018
$ rustdoc --test src/lib.rs -Z unstable-options --edition 2018
</code></pre>
<p>This flag allows rustdoc to treat your rust code as the given edition. It will compile doctests with
the given edition as well. As with <code>rustc</code>, the default edition that <code>rustdoc</code> will use is <code>2015</code>
(the first edition).</p>
<a class="header" href="unstable-features.html#a-z-force-unstable-if-unmarked" id="a-z-force-unstable-if-unmarked"><h3><code>-Z force-unstable-if-unmarked</code></h3></a>
<p>Using this flag looks like this:</p>
<pre><code class="language-bash">$ rustdoc src/lib.rs -Z force-unstable-if-unmarked
</code></pre>
<p>This is an internal flag intended for the standard library and compiler that applies an
<code>#[unstable]</code> attribute to any dependent crate that doesn't have another stability attribute. This
allows <code>rustdoc</code> to be able to generate documentation for the compiler crates and the standard
library, as an equivalent command-line argument is provided to <code>rustc</code> when building those crates.</p>
<a class="header" href="unstable-features.html#doc_alias-feature" id="doc_alias-feature"><h3><code>doc_alias</code> feature</h3></a>
<p>This feature allows you to add alias(es) to an item when using the <code>rustdoc</code> search through the
<code>doc(alias)</code> attribute. Example:</p>
<pre><pre class="playpen"><code class="language-rust no_run">
# #![allow(unused_variables)]
#![feature(doc_alias)]

#fn main() {
#[doc(alias = &quot;x&quot;)]
#[doc(alias = &quot;big&quot;)]
pub struct BigX;
#}</code></pre></pre>
<p>Then, when looking for it through the <code>rustdoc</code> search, if you enter &quot;x&quot; or
&quot;big&quot;, search will show the <code>BigX</code> struct first.</p>

                    </main>

                    <nav class="nav-wrapper" aria-label="Page navigation">
                        <!-- Mobile navigation buttons -->
                        
                            <a rel="prev" href="passes.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
                                <i class="fa fa-angle-left"></i>
                            </a>
                        

                        

                        <div style="clear: both"></div>
                    </nav>
                </div>
            </div>

            <nav class="nav-wide-wrapper" aria-label="Page navigation">
                
                    <a href="passes.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
                        <i class="fa fa-angle-left"></i>
                    </a>
                

                
            </nav>

        </div>

        

        

        

        

        
        <script src="searchindex.js" type="text/javascript" charset="utf-8"></script>
        
        
        <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="searcher.js" type="text/javascript" charset="utf-8"></script>
        

        <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="highlight.js" type="text/javascript" charset="utf-8"></script>
        <script src="book.js" type="text/javascript" charset="utf-8"></script>

        <!-- Custom JS scripts -->
        

    </body>
</html>