Rustdoc seems to list trait implementation fns in a strange order

An example is here:

It shows

fn get_free(&mut self) -> (HashSet<u64>, u64)
Get the set of free logical pages ( also verifies free chain is ok ).

first even though it is not first either where the trait is defined or in the implementation. I cannot figure out what order the functions are listed in at all, it seems to be random!

1 Like

That might be a coincidence, because over on CompactFile the ones with cfgs still appear random, and info has ended up at the bottom despite being the second function in the impl. CompactFile in rustdb::compact - Rust

They're definitely almost ordered though, which is weirder than being completely random. It's also stable between versions. Is it the same when you build it locally?

Ah I figured it out: it puts the items with doc comments first, then all the rest.

2 Likes

Hmm, somewhat sensible but I've long wished for some very clear indication as to whether the comment on an trait method was an implementation-specific comment or just pulled from the trait definition.

This is useful information.

This is not.

(There are better examples of useful information in a sea of "yes I know what the trait does generally", I just grabbed the first example I found.)

1 Like