Skip to content
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

cross-compilation doctests warning should not be behind verbose flag #12118

Open
timfish opened this issue May 10, 2023 · 9 comments
Open

cross-compilation doctests warning should not be behind verbose flag #12118

timfish opened this issue May 10, 2023 · 9 comments
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug E-easy Experience: Easy P-low Priority: Low S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. Z-doctest-xcompile Nightly: doctest-xcompile

Comments

@timfish
Copy link

timfish commented May 10, 2023

Problem

I just spent a lot longer than I'm willing to admit trying to work out why my doctests were not running. After working out I'd done everything correctly I finally tried --verbose and found the warning about cross-compilation not being supported.

cargo test completes successfully and I've not even known that the doctests have been skipped for months! Why is this warning hidden behind the verbose flag?

Steps

Create a src file with failing doc tests:
lib.rs

/// ```
/// panic("something')
/// ```
pub fn my_function() { }

Ensure you're building for another target. For me, this was on an M1 mac with the following .cargo/config to make this a cross platform build:

[build]
target = "x86_64-apple-darwin"

Run cargo test --doc

Results in no output after the build output.

Version

cargo 1.69.0

@timfish timfish added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels May 10, 2023
@weihanglo
Copy link
Member

It was an intentional choice in #10132. Warning for every doctest target may be noisy. Could be improved by warning just once in normal mode if there is a cross-compile doctest, hinting people to use --verbose to see the full list of skipped doctest targets.

Relevant code is here:

CompileKind::Target(target) => {
if target.short_name() != compilation.host {
// Skip doctests, -Zdoctest-xcompile not enabled.
config.shell().verbose(|shell| {
shell.note(format!(
"skipping doctests for {} ({}), \
cross-compilation doctests are not yet supported\n\
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile \
for more information.",
unit.pkg,
unit.target.description_named()
))
})?;
continue;
}
}

@weihanglo weihanglo added A-diagnostics Area: Error and warning messages generated by Cargo itself. S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. Z-doctest-xcompile Nightly: doctest-xcompile and removed S-triage Status: This issue is waiting on initial triage. labels May 10, 2023
@weihanglo
Copy link
Member

Just a friendly reminder. It would be great for collaboration if people always strive to provide reproducible steps and version information for their issues. That may increase the chance for anyone wanting to fix gets started sooner.

@timfish
Copy link
Author

timfish commented May 10, 2023

provide reproducible steps and version information for their issues

Apologies. Just added these.

@weihanglo weihanglo added E-easy Experience: Easy P-low Priority: Low labels May 27, 2023
@weihanglo
Copy link
Member

Labeled as P-low Priority: Low as we are considering to stabilize -Zdoctest-xcompile, so this warning may be unnecessary. There is no ETA though.

@1garo
Copy link

1garo commented Jun 12, 2023

Would be okay if I work on this one? @weihanglo

@1garo
Copy link

1garo commented Jun 12, 2023

I'm just having trouble building, I been having the message below in some crates:

error[E0658]: use of unstable library feature 'once_cell'

Any ideia?

@Rustin170506
Copy link
Member

Try to use the latest stable version or nightly version rustc.

@1garo
Copy link

1garo commented Jun 12, 2023

Try to use the latest stable version or nightly version rustc.

Thanks! Now I'm having some problem with linking error: linking with cc failed: exit status: 1 when cargo build, but cargo check is fine!

$ rustput -V
rustc 1.72.0-nightly

Mac M1 ventura 13.2

image

@weihanglo
Copy link
Member

Labeled as P-low Priority: Low as we are considering to stabilize -Zdoctest-xcompile, so this warning may be unnecessary. There is no ETA though.

As it is labeled as P-low and S-needs-mentor, I'd suggest working on other issues if you're interested in contributing Cargo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug E-easy Experience: Easy P-low Priority: Low S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. Z-doctest-xcompile Nightly: doctest-xcompile
Projects
None yet
Development

No branches or pull requests

4 participants