- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Restore colour to rustdoc #17226
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
Restore colour to rustdoc #17226
Conversation
        
          
                src/librustdoc/clean/inline.rs
              
                Outdated
          
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may end up causing confusion as it doesn't take into account did.krate, which can be nonzero in the case of inlining documentation from other crates. This could sporadically cause typedefs to become enums or vice versa perhaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you’re right: rustrt renders Option as a type instead of an enum (e.g., rustrt::args::clone).
| @P1start Can you host a rust documentation instance running this change? We've had some unfortunate layout regressions recently, and I'd like to avoid that. | 
| @P1start Awesome, thanks! Documentation looks exactly as broken as always 👍 One thing I noticed is that generics seem weird as uncoloured now. Would it be possible to colour them? | 
| I don’t think that colouring generics would be a good idea, as every other coloured thing is a link to another page. If anything, we should colour typedefs, primitives &c. something other than black to make them stand out more than things which aren’t documented (generics and private types). | 
| That's a fair point. Perhaps generics could simply be coloured grey to make them visually distinct from keywords and sigils, but otherwise "dead"? | 
d44ebff    to
    778a343      
    Compare
  
    | I’ve tried another path that seems to work much better. (The old one was still generating bad cross-crate links sometimes.) I added a  | 
| Adding to  | 
| @eddyb Sorry, I don’t know which functions you’re talking about. | 
778a343    to
    51293aa      
    Compare
  
    | @alexcrichton I had to update the last commit because Travis was showing some legitimate errors. | 
51293aa    to
    e02328d      
    Compare
  
    This is done by adding a new field to the `DefTy` variant of `middle::def::Def`, which also clarifies an error message in the process. Closes rust-lang#16712.
e02328d    to
    8b88811      
    Compare
  
    
This not only gives back the colour to structs, traits, and functions, but also restores the long-lost colour to enums. I’ve run
linkcheckerand there don’t seem to be any more invalid links than usual.I’m not entirely sure if the way I’ve implemented this is very idiomatic or reliable, but it seems to work.
Closes #17131.
Closes #16712.
Closes #16711.