-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Rustdoc does not substitute const parameters #82852
Comments
I hope this is not a duplicate or an already known issue that is part of some bigger tracking issue or some agenda. I thoroughly searched beforehand but couldn't find anything related. |
This is a duplicate of #14072 I think. |
Hmm, maybe it is. Hard to tell as that old issue is really vague and updates to it are scattered. In my eyes, this simple case of const parameters (literals only) looks manageable to implement. Not so sure about the general case which requires const evaluation. @ jyn514, do you think writing the code for the substitution of const parameters is a matter of "copying"/mirroring the one for the substitution of type parameters (which in some parts has to exist as seen by |
You can evaluate constants with rust/src/librustdoc/clean/mod.rs Line 1957 in 27885a9
I'm not sure how this part of the code works, sorry. Happy to look into it if you get stuck though :) |
Thank you :) I appreciate that. I opened a Zulip stream to discuss the work on the implementation. |
This comment was marked as outdated.
This comment was marked as outdated.
I think the issue here is that |
@camelid Yes, I've made the same observation and noted down some more findings in the Zulip stream linked above (although some information there might be outdated by now). |
I ran
cargo doc
on this code (src/lib.rs
):I expected to see the definitions
type A1 = [i32; 3];
andpub struct B1(pub [i32; 3]);
in the generated documentation.Instead, I found
type A1 = [i32; N];
andpub struct B1(pub [i32; N]);
.That is, the definitions wrongly contain a stray identifier
N
that should have been substituted with the literal3
just like theT
was successfully substituted withi32
.Meta
rustc --version --verbose
:@rustbot modify labels: +T-rustdoc +A-const-generics +F-min_const_generics +C-bug
The text was updated successfully, but these errors were encountered: