# Documented \`const\` fields of a \`mutable struct\` does not show up in documentation

**URL:** <https://discourse.julialang.org/t/documented-const-fields-of-a-mutable-struct-does-not-show-up-in-documentation/135723>\
**Category:** General Usage\
**Tags:** question, documentation\
**Created:** [February 18, 2026, 1:46pm UTC](https://discourse.julialang.org/t/documented-const-fields-of-a-mutable-struct-does-not-show-up-in-documentation/135723 "2026-02-18T13:46:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmc4](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pmc4/32/211593_2.png) [@pmc4](https://discourse.julialang.org/u/pmc4)\
**Post date:** [February 18, 2026, 1:46pm UTC](https://discourse.julialang.org/t/documented-const-fields-of-a-mutable-struct-does-not-show-up-in-documentation/135723/1 "2026-02-18T13:46:09Z")

</div>

Hello, everyone. While I was adding some docstrings to a mutable struct, I’ve realized that when the field is set as constant, the documentation doesn’t work. Take, for example, the following `mutable struct`:

```julia-auto
"Some random docs I write here."
mutable struct Foo{T<:AbstractFloat}
    "Mass"
    const m::T
    "Time"
    t::T
end

```

If I enter into help mode and type `Foo`, I get the corresponding docstring:

```julia-auto
help?> Foo
search: Foo Bool

  Some random docs I write here.

```

The same happens with the field `t`:

```julia-auto
help?> Foo.t
  Time

```

However, when I search for the constant field, nothing shows up. As if that field didn’t have docstrings:

```julia-auto
Foo.m
  Foo has fields m, and t.

```

Is this a bug? I’ve read the [corresponding section at the docs](https://docs.julialang.org/en/v1/manual/documentation/#Syntax-Guide) but nothing is mentioned. Writing `@doc` in front of the string does not work either.

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [February 19, 2026, 5:20am UTC](https://discourse.julialang.org/t/documented-const-fields-of-a-mutable-struct-does-not-show-up-in-documentation/135723/2 "2026-02-19T05:20:22Z")

</div>

Known issue:

> <https://github.com/JuliaLang/julia/issues/58820>
>
> \`const\` fields of mutable structs cannot be annotated with docstrings in the sam…e way as mutable fields, e.g.
> 
> \`\`\`julia
> "a struct docstring"
> mutable struct SomeStruct
> "a field docstring"
> mutablefield
> "another field docstring"
> const constfield
> end
> \`\`\`
> 
> results in the following behaviour (tested on v1.11.5 and 1.12.0-beta4)
> 
> \`\`\`
> help?\> SomeStruct.mutablefield
> a field docstring
> 
> help?\> SomeStruct.constfield
> SomeStruct has fields mutablefield, and constfield.
> \`\`\`
> 
> This issue has already been filed with DocStringExtensions (https://github.com/JuliaDocs/DocStringExtensions.jl/issues/155) back in September '24, but it's definitely a Julia problem and I can't find any previous issues here.

Some other known issues with field doc strings:

> <https://github.com/JuliaLang/julia/issues/27656>
>
> Consider (on 0.7 and 0.6)
> \`\`\`
> julia\> "Doc" struct A{T}
> "field"
> … a
> end
> A
> 
> help?\> A
> search: A Any ANY any all abs ARGS ans axes atan asin asec any! all! acsc acot acos abs2 Array atanh atand atan2 asinh asind asech asecd ascii angle acsch acscd acoth
> 
> Doc
> 
> help?\> A.a
> ERROR: MethodError: no method matching Base.Docs.Binding(::Type{A}, ::Symbol)
> Closest candidates are:
> Base.Docs.Binding(::Module, ::Symbol) at docs/bindings.jl:12
> Stacktrace:
> \[1\] top-level scope at /home/mauro/julia/julia-master/usr/share/julia/stdlib/v0.7/REPL/src/docview.jl:306
> 
> help?\> A{Int}.a
> ERROR: MethodError: no method matching Base.Docs.Binding(::Type{A{Int64}}, ::Symbol)
> Closest candidates are:
> Base.Docs.Binding(::Module, ::Symbol) at docs/bindings.jl:12
> 
> julia\> const AA = A{Int} # work-around                                                                                                                                              
> A{Int64}                                                                                                                                                                 
> 
> help?\> AA.a                                                                                                                                                              
> field                                                                                                                                                                  
> \`\`\`

> <https://github.com/JuliaLang/julia/issues/51180>
>
> I don't really see a pattern of when the REPL provides useful hints on this sort… of field access and when it throws what appears to be an internal error:
> \`\`\`julia
> julia\> module M
> struct T 
> "a field with a docstring"
> my\_field
> end
> const C = T
> f() = T
> end
> WARNING: replacing module M.
> Main.M
> 
> help?\> M.T.field
> Main.M.T has fields my\_field.
> 
> help?\> M.C.field
> Main.M.T has fields my\_field.
> 
> help?\> M.f().field
> ERROR: MethodError: no method matching Base.Docs.Binding(::Type{Main.M.T}, ::Symbol)
> 
> Closest candidates are:
> Base.Docs.Binding(::Module, ::Symbol)
> @ Base docs/bindings.jl:9
> 
> Stacktrace:
> \[1\] top-level scope
> @ none:1
> 
> help?\> M.T(1).field
> ERROR: MethodError: no method matching Base.Docs.Binding(::Main.M.T, ::Symbol)
> 
> Closest candidates are:
> Base.Docs.Binding(::Module, ::Symbol)
> @ Base docs/bindings.jl:9
> 
> Stacktrace:
> \[1\] top-level scope
> @ none:1
> 
> help?\> M.T(1).my\_field
> ERROR: MethodError: no method matching Base.Docs.Binding(::Main.M.T, ::Symbol)
> 
> Closest candidates are:
> Base.Docs.Binding(::Module, ::Symbol)
> @ Base docs/bindings.jl:9
> 
> Stacktrace:
> \[1\] top-level scope
> @ none:1
> 
> julia\> x = M.T(1)
> Main.M.T(1)
> 
> help?\> x.field
> ERROR: MethodError: no method matching Base.Docs.Binding(::Main.M.T, ::Symbol)
> 
> Closest candidates are:
> Base.Docs.Binding(::Module, ::Symbol)
> @ Base docs/bindings.jl:9
> 
> Stacktrace:
> \[1\] top-level scope
> @ ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/docview.jl:558
> \`\`\`

---

<div class="post-metadata">

**Author:** ![pmc4](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pmc4/32/211593_2.png) [@pmc4](https://discourse.julialang.org/u/pmc4)\
**Post date:** [February 19, 2026, 12:19pm UTC](https://discourse.julialang.org/t/documented-const-fields-of-a-mutable-struct-does-not-show-up-in-documentation/135723/3 "2026-02-19T12:19:38Z")

</div>

> [@nsajko](#):
>
> Known issue:

Thanks! Good to know, I was getting confused trying to understand what I was doing wrong.
