Skip to content

Commit 116821e

Browse files
authored
Set environment variable DOCS_RS when building crates (#852)
1 parent 09b55bc commit 116821e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-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

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ <h1 id="crate-title">About Docs.rs</h1>
2828
{%- endif -%}
2929
</p>
3030

31+
<p>
32+
Docs.rs builds crates with environment variable <code>DOCS_RS</code> set to
33+
<code>1</code>, which enables the crate to detect docs.rs and build the
34+
crate differently for docs.
35+
</p>
36+
3137
<p>
3238
The source code of Docs.rs is available on
3339
<a href="{{ docsrs_repo }}">GitHub</a>. If

0 commit comments

Comments
 (0)