Skip to content

Cargo apparently does not forward opt level to doctest #12877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
IceTDrinker opened this issue Oct 25, 2023 · 2 comments
Closed

Cargo apparently does not forward opt level to doctest #12877

IceTDrinker opened this issue Oct 25, 2023 · 2 comments
Labels
A-doctests Area: rustdoc --test C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@IceTDrinker
Copy link

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]
@IceTDrinker IceTDrinker added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Oct 25, 2023
@epage epage added the A-doctests Area: rustdoc --test label Oct 25, 2023
@ehuss
Copy link
Contributor

ehuss commented Oct 25, 2023

This was originally intentional because rustdoc did not support codegen arguments. It has since partially gained that ability, but cargo was never updated to start passing them in. I'm going to close as a duplicate of #6570.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2023
@IceTDrinker
Copy link
Author

My bad, missed that issue, thanks for the answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: rustdoc --test C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
Development

No branches or pull requests

3 participants