Stream: rustdoc

Topic: showing layout information #75988


view this post on Zulip Noah Lev (Mar 22 2021 at 02:07):

I just noticed #75988 earlier today. The feature suggested is something I've wanted before, so I started looking into it. The implementation is very easy; figuring out the design and placement on the type's page is the tricky part. I've got this so far:

image.png

However, I don't think we'd want to put layout information at the top of the page since it's auxiliary. I was thinking maybe we could put it at the bottom of the page, but I suspect not many people scroll past auto trait impls etc. But at least the info would be there.

What do you all think?

view this post on Zulip Joshua Nelson (Mar 22 2021 at 02:08):

I would put this with the "show declaration" maybe

view this post on Zulip Joshua Nelson (Mar 22 2021 at 02:08):

I don't think it needs to be shown by default

view this post on Zulip Noah Lev (Mar 22 2021 at 02:08):

Yeah, I was thinking about that too, but it's not part of the declaration.

view this post on Zulip Joshua Nelson (Mar 22 2021 at 02:08):

although that's going away soon I think https://github.com/rust-lang/rust/pull/83337

view this post on Zulip Noah Lev (Mar 22 2021 at 02:09):

And the declaration is an abstract form of the code: image.png

view this post on Zulip Noah Lev (Mar 22 2021 at 03:46):

Actually I just realized that a type's size is target-specific (e.g. if it contains usize or pointers). Not sure how we should handle that...

view this post on Zulip Joshua Nelson (Mar 22 2021 at 03:46):

documentation is already platform-specific, I don't know if we need to handle it specially

view this post on Zulip Joshua Nelson (Mar 22 2021 at 03:46):

this is why docs.rs builds for multiple targets

view this post on Zulip Noah Lev (Mar 22 2021 at 04:17):

Joshua Nelson said:

documentation is already platform-specific, I don't know if we need to handle it specially

I guess it seems like it might be misleading if the docs say a type is a certain size but it's not that size on your target.


Last updated: Oct 21 2021 at 22:01 UTC