-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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: Get repr
information through AdtDef
for foreign items
#110983
Conversation
Doesn’t this still leave the attribute missing in the JSON output? |
Oh very good point! I'll do it for JSON as well and add a test. |
If I were you, I'd redesign it so that it injects the extra attribute when |
I thought about it and I'm a bit reluctant to this approach because we moved things out of memory to instead compute them on demand and storing this one here seemed going on the opposite way. Also, it would force to have a special representation here since attributes are the rustc ones, not rustdoc cleaned elements. Because of all this, I decided to not move it into a struct. Do you prefer to still move it into a type though? EDIT: I can create a |
@GuillaumeGomez That solution sounds fine. I just want to make sure computing attributes is done in a shared place used by both HTML and JSON. A method that concatenates stored attributes together with computed ones does that. |
7fa6383
to
b778688
Compare
Some changes occurred in src/librustdoc/clean/types.rs cc @camelid |
Great! I did exactly that. Only issue: I actually can't test it because foreign items can't be inlined in JSON apparently... But at least they're now calling the same method. |
@bors r+ rollup |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#110586 (Fix Unreadable non-UTF-8 output on localized MSVC) - rust-lang#110652 (Add test for warning-free builds of `core` under `no_global_oom_handling`) - rust-lang#110973 (improve error notes for packed struct reference diagnostic) - rust-lang#110981 (Move most rustdoc-ui tests into subdirectories) - rust-lang#110983 (rustdoc: Get `repr` information through `AdtDef` for foreign items) - rust-lang#110984 (Do not resolve anonymous lifetimes in consts to be static.) - rust-lang#110997 (Improve internal field comments on `slice::Iter(Mut)`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
As suggested by @notriddle, this approach works too. The only downside is that the display of the original attribute isn't kept, but I think it's an acceptable downside.
r? @notriddle