Skip to content

Correctly using intra-rustdoc links in no_std crates is difficult #76252

Description

@dylni

AFAICT, if your crate has this line:

#![cfg_attr(not(feature = "std"), no_std)]

and you use a intra-rustdoc link for any std item, these lines must be added to build documentation with --no-default-features:

#[cfg(doc)]
extern crate std;

Then, to use items from the prelude in documentation, you'll also want:

#[cfg(doc)]
use std::prelude::v1::*

However, this defeats the purpose of the prelude being imported automatically. Would it be possible for rustdoc to add these lines even when building with #![no_std]?

This should also help solve #73423, because the std crate would always be in scope.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-discussionCategory: Discussion or questions that doesn't represent real issues.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions