You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a library is built with LTO enabled, doctests fail with linker errors, "file format not recognized".
This worked with Rust/Cargo 1.45.2, but fails with 1.46 through nightly. This might be a rustdoc issue instead, but I'm starting here because of the Cargo 1.46 changes in #8349.
In the example below, I turned on LTO in profile.dev, which I know is unusual. In practice, we saw this in a Fedora crate build that had LTO in profile.release. We always build --release for the distro, and then we test --release too so we don't build everything twice.
Steps
Cargo.toml:
[package]
name = "foo"version = "0.1.0"authors = ["Josh Stone <cuviper@gmail.com>"]
edition = "2018"
[profile.dev]
lto = true
Thanks for the detailed report! This is a duplicate of #8654, and has been fixed via #8657, which should land in nightly sometime next week. I have also proposed backporting to beta in #8658.
Problem
When a library is built with LTO enabled, doctests fail with linker errors, "file format not recognized".
This worked with Rust/Cargo 1.45.2, but fails with 1.46 through nightly. This might be a rustdoc issue instead, but I'm starting here because of the Cargo 1.46 changes in #8349.
In the example below, I turned on LTO in
profile.dev
, which I know is unusual. In practice, we saw this in a Fedora crate build that had LTO inprofile.release
. We alwaysbuild --release
for the distro, and then wetest --release
too so we don't build everything twice.Steps
Cargo.toml
:src/lib.rs
:Possible Solution(s)
Notes
Output of
cargo version
:The text was updated successfully, but these errors were encountered: