Skip to content

Cargo apparently does not forward opt level to doctest #12877

@IceTDrinker

Description

@IceTDrinker

Problem

When running cargo doctest with a release profile with lto = "fat" I encountered the following miscompile rust-lang/rust#116941

as advised here rust-lang/rust#116941 (comment)

I am opening this issue to ask whether the potential lack of forwarding of opt levels (as identified in the comment) is a conscious decision ?

As a user of doctests I would expect the cargo profile to apply to the doctests being compiled and at the moment it seems some parts of it are not forwarded to doctests.

Steps

From my understanding from the linked issue above any doctest does not get the proper opt levels from cargo at the moment

Possible Solution(s)

I'm guessing that if the opt levels (and other flags) are not forwarded to the doctests that they perhaps ought to be to match a simple binary compilation that one would trigger via cargo build?

Notes

No response

Version

cargo 1.75.0-nightly (6fa6fdc76 2023-10-10)
release: 1.75.0-nightly
commit-hash: 6fa6fdc7606cfa664f9bee2fb33ee2ed904f4e88
commit-date: 2023-10-10
host: x86_64-unknown-linux-gnu
libgit2: 1.7.1 (sys:0.18.1 vendored)
libcurl: 8.3.0-DEV (sys:0.4.66+curl-8.3.0 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Ubuntu 22.04 (jammy) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-doctestsArea: rustdoc --testC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions