Skip to content

Commit 114545e

Browse files
committed
Set environment variable DOCS_RS when buliding crates
1 parent 09b55bc commit 114545e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/docbuilder/rustwide_builder.rs

+3
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ impl RustwideBuilder {
516516
.unwrap_or_default(),
517517
)
518518
.env("RUSTDOCFLAGS", rustdoc_flags.join(" "))
519+
// For docs.rs detection from build script:
520+
// https://github.com/rust-lang/docs.rs/issues/147
521+
.env("DOCS_RS", "1")
519522
.args(&cargo_args)
520523
.run()
521524
.is_ok()

tera-templates/core/about.html

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ <h1 id="crate-title">About Docs.rs</h1>
2626
<a href="{{ docsrs_repo }}/issues">issues page</a>
2727
and file a new issue if you don't see an existing request.
2828
{%- endif -%}
29+
30+
Docs.rs builds crates with environment variable `DOCS_RS` set to
31+
`1`, which enables the crate to detect docs.rs and build the
32+
crate differently for docs.
2933
</p>
3034

3135
<p>

0 commit comments

Comments
 (0)