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

Consider querying the underlying rust{,do}c version and make certain behaviors dependent on it #20

Open
4 tasks
fmease opened this issue Dec 2, 2024 · 6 comments
Labels
C-high Techincal complexity: High K-feature-request Kind: Feature request P-medium Priority: Medium S-actionable Status: Actionable

Comments

@fmease
Copy link
Owner

fmease commented Dec 2, 2024

Possibly controversial :P

We should gate this behind a flag like e.g., -k/--compat to avoid executing an extra rustc process when it's unneeded in most cases. Description for -k could be sth. akin to Enable compatibility layer for older rust{,do}c version (well, is "layer" really the correct choice of word for that?).

Use cases:

@fmease
Copy link
Owner Author

fmease commented Dec 2, 2024

For example, this would allow us to make the "context-sensitive" edition aliases S (latest stable edition) and E ("bleeding edge": latest edition, no matter if stable or unstable) work with older rustc/rustdoc versions, too. Potentially 'useful' when manually bisecting issues. Idk, if that's a sensible behavior tho.

@fmease
Copy link
Owner Author

fmease commented Dec 2, 2024

Another example would be -#/--internals which corresponds to -Zverbose-internals in recent rustc/rustdoc versions but used to correspond to -Zverbose. Again, this would be useful when bisecting.

@fmease
Copy link
Owner Author

fmease commented Dec 2, 2024

A big one: Compiletest directives. In older versions, we could switch to the pre-ui_test flavor (// XXX instead of //@ XXX). Tho that'd be annoying to add support for for potentially little gain.

@fmease fmease changed the title Consider querying the underlying rust{,do} version and make certain behaviors dependent on it Consider querying the underlying rust{,do}c version and make certain behaviors dependent on it Dec 2, 2024
@fmease
Copy link
Owner Author

fmease commented Dec 2, 2024

Another use case: Until very recently rustdoc didn't treat - as a STDIN marker. So for older rustc/rustdoc versions #17 (#8) will probably fail / not work properly. Querying the version might allow us to find a workaround for older rustdoc versions.

@fmease fmease added C-high Techincal complexity: High K-feature-request Kind: Feature request P-medium Priority: Medium S-actionable Status: Actionable labels Dec 4, 2024
@fmease
Copy link
Owner Author

fmease commented Dec 16, 2024

We could also consider adding a more aggressive version of that mechanism/mode enabled via -kk / --compat --compat which "blindly" replaces "verbatim" program arguments to achieve compatibility. "Verbatim" program arguments are ones passed after -- on the CL, via the env vars RUST{,DO}C_FLAGS or directives like //@ compile-flags.

This would allow us to also remap verbatim flags like -Zverbose-internals (→ -Zverbose) and -Zparse-crate-root-only (→ -Zparse-only) at the risk of butchering rust{,do}c invocation(s) and without guaranteeing that we properly detect "version-dependent" flags. I don't know how to phrase this better. Ah, maybe "we admit false positives and negatives". Basically, I don't necessarily want to guarantee that we support forms like -Z verbose-internals (two program arguments), "-Z verbose-internals" (one argument, space) and -Z=verbose-internals (equals (is that even accepted?)) (← admitting false negatives) or notice that in e.g. --crate-name -Zverbose-internals, rust{,do}c actually interprets -Zverbose-internals as the crate name because getopts is super naive, jeez (← admitting false positives).

@fmease
Copy link
Owner Author

fmease commented Jan 24, 2025

Tracking: Rename of directives normalize-std{out,err}-testnormalize-std{out,err}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-high Techincal complexity: High K-feature-request Kind: Feature request P-medium Priority: Medium S-actionable Status: Actionable
Projects
None yet
Development

No branches or pull requests

1 participant