Login
You're viewing the discuss.systems public feed.
  • Aug 28, 2026, 12:29 PM

    has someone written a “why is rustdoc so hairy” post, about how rustdoc needs to be so much more involved than an AST->HTML tree traversal? about why does it have so much gnarly internals.

    cc @jyn @imperio

    💬 2🔄 0⭐ 0

Replies

  • Aug 28, 2026, 12:40 PM

    @jyn @imperio

    of the top of my head:

    - cfg expansion ( cfg(doc)/doc(cfg) )
    - re-exports especially cross-crate
    - impedance mismatch with the trait solver (types vs items, proving bounds vs listing impls)
    - ambiguous namespaces for intra-doc-links
    - search index
    - crate name ambiguity (no global namespace)

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • 💬 2🔄 0⭐ 0
  • Aug 29, 2026, 3:58 PM

    @jyn @adotinthevoid Yes but it allows:

    pub struct Y;

    const X: usize = {
    impl Y {
    pub fn foo(&self) {}
    }
    0
    };

    fn main() {
    impl Y {
    fn new() -> Self { Y }
    }

    fn inner() -> Y {
    Y::new()
    }

    inner().foo();
    }

    So sounds definitely worth it, no? T_T

    💬 1🔄 0⭐ 0
  • Aug 29, 2026, 3:59 PM

    @jyn @adotinthevoid We can also mention reexports and its endless curse. Last iteration on this: when using --document-private-items, should crate-level use be displayed too, or only pub(crate) ones even though it's implied by default? :')

    💬 0🔄 0⭐ 0
  • ada :ferris:pmmeurcatpics@ieji.de
    Aug 29, 2026, 7:20 PM

    @jyn @adotinthevoid @imperio probably a naive question but: can't you librarify the nameres algorithm and share it across compilers? Or is it infeasible to separate it from the internal representation? (and if you're wondering: no, I haven't interacted with nameres in r-a yet..)

    💬 1🔄 0⭐ 0
  • Aug 30, 2026, 6:42 AM

    @pmmeurcatpics @adotinthevoid @imperio rustc_resolve and rustc_expand are very tightly tied to rustc's internal representation. they output HirIds into an arena, "freeze" them, and once those arenas are full you cannot ever modify them again. so for example things like "suggest extracting a function into a separate module and check that it name resolves after" are simply impossible, you have to completely rerun compilation with a new Session rather than calling back into the library.

    in general lots of rustc is like this ... it has so much global state.

    💬 0🔄 0⭐ 0