Skip to content

doc reproducibility #156567

@Fabian-Gruenbichler

Description

@Fabian-Gruenbichler

Summary

Debian is starting to step up its reproducibility game. Unfortunately, at the moment rust-doc and cargo-doc are not 100% reproducible. I've minimized the invocations/behaviour for upstream main.

Command used

./x.py -j1 doc --stage 2 && ./x.py -j1 doc --stage 2 cargo
./x.py -j16 doc --stage 2 && ./x.py -j16 doc --stage 2 cargo

I haven't verified yet whether it's actually the difference in parallelism triggering it, or whether it just makes it more likely.

Expected behaviour

I expect the generated html files to be identical given the same input tree and toolchain (e.g., two back to back invocations, just clearing build artifacts).

Actual behaviour

They are (sometimes) not, sample diff:

diff -up ../{first,second}/doc/alloc/alloc/fn.alloc.html
--- ../first/doc/alloc/alloc/fn.alloc.html      2026-05-14 10:13:28.533447849 +0200
+++ ../second/doc/alloc/alloc/fn.alloc.html     2026-05-14 12:22:55.126794897 +0200
@@ -1,4 +1,4 @@
-<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Allocates memory with the global allocator."><title>alloc in alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-17e0aaed.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="alloc" data-themes="" data-resource-suffix="1.97.0" data-rustdoc-version="1.97.0-nightly (c8c4c83d5 2026-05-13)" data-channel="nightly" data-search-js="search-b5634cc7.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../static.files/storage-41dd4d93.js"></script><script defer src="sidebar-items1.97.0.js"></script><script defer src="../../static.files/main-aa4d37ac.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">alloc</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../alloc/index.html"><img class="rust-logo" src="../../static.files/rust-logo-9a9549ea.svg" alt="logo"></a><h2><a href="../../alloc/index.html">alloc</a><span class="version">1.97.0-nightly</span></h2></div><div class="version">(c8c4c83d5     2026-05-13)</div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">alloc</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#safety" title="Safety">Safety</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Function <span class="fn">alloc</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="../../src/alloc/alloc.rs.html#95-103">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe fn alloc(layout: <a class="struct" href="struct.Layout.html" title="struct alloc::alloc::Layout">Layout</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Allocates memory with the global allocator.</p>
+<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Allocates memory with the global allocator."><title>alloc in alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-17e0aaed.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="alloc" data-themes="" data-resource-suffix="1.97.0" data-rustdoc-version="1.97.0-nightly (c8c4c83d5 2026-05-13)" data-channel="nightly" data-search-js="search-b5634cc7.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../static.files/storage-41dd4d93.js"></script><script defer src="sidebar-items1.97.0.js"></script><script defer src="../../static.files/main-aa4d37ac.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">alloc</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../alloc/index.html"><img class="rust-logo" src="../../static.files/rust-logo-9a9549ea.svg" alt="logo"></a><h2><a href="../../alloc/index.html">alloc</a><span class="version">1.97.0-nightly</span></h2></div><div class="version">(c8c4c83d5     2026-05-13)</div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">alloc</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#safety" title="Safety">Safety</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Function <span class="fn">alloc</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="../../src/alloc/alloc.rs.html#95-103">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe fn alloc(layout: <a class="struct" href="struct.Layout.html" title="struct alloc::alloc::Layout">Layout</a>) -&gt; <a class="primitive" href="../../core/primitive.pointer.html">*mut </a><a class="primitive" href="../../core/primitive.u8.html">u8</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Allocates memory with the global allocator.</p>
 <p>This function forwards calls to the <a href="trait.GlobalAlloc.html#tymethod.alloc" title="method alloc::alloc::GlobalAlloc::alloc"><code>GlobalAlloc::alloc</code></a> method
 of the allocator registered with the <code>#[global_allocator]</code> attribute
 if there is one, or the <code>std</code> crate’s default.</p>

(The reference from alloc to core is to the internet in the first, and relative with a local path in the second output)

Bootstrap configuration (bootstrap.toml)

# See bootstrap.example.toml for documentation of available options
#                                                                                                                                                                                             profile = "dist"  # Includes one of the default files in src/bootstrap/defaults                                                                                                               change-id = 154587                                                                                                                                                                            llvm.download-ci-llvm = true

[build]
docs = true

Operating system

Debian Trixie (13.5)

HEAD

c8c4c83d57d3b4cf72a7306cd77bb8b5c0f03434 , but we've seen this behaviour in Debian builds for quite a while already, so it's not a recent regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-reproducibilityArea: Reproducible / deterministic buildsC-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions