Skip to content

Incorrect error message for badly constructed struct #25380

@JalonSolov

Description

@JalonSolov

Describe the bug

The problem in this code is a missing : after the mut keyword, but the error message doesn't give a hint as to the problem

Reproduction Steps

struct Foo {
}

struct Bar {
        mut foos []Foo
}

Expected Behavior

Error message of

"missing : after mut in struct"

would be good - something that would indicate the actual problem

Current Behavior

x.v:5:11: error: `[attr]` has been deprecated, use `@[attr]` instead
    3 | 
    4 | struct Bar {
    5 |     mut foos []Foo
      |              ^
    6 | }

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.12 5bc82ed

Environment details (OS name and version, etc.)

Not that it matters, but...

|V full version      |V 0.4.12 f581bb7.5bc82ed
|:-------------------|:-------------------
|OS                  |linux, "Manjaro Linux"
|Processor           |32 cpus, 64bit, little endian, AMD Ryzen 9 7950X 16-Core Processor
|Memory              |7.02GB/30.49GB
|                    |
|V executable        |/home/jalon/git/v/v
|V last modified time|2025-09-24 11:48:11
|                    |
|V home dir          |OK, value: /home/jalon/git/v
|VMODULES            |OK, value: /home/jalon/.vmodules
|VTMP                |OK, value: /tmp/v_1000
|Current working dir |OK, value: /home/jalon
|                    |
|Git version         |git version 2.51.0
|V git status        |weekly.2025.39-3-g5bc82ed3
|.git/config present |true
|                    |
|cc version          |cc (GCC) 15.2.1 20250813
|gcc version         |gcc (GCC) 15.2.1 20250813
|clang version       |clang version 20.1.8
|tcc version         |tcc version 0.9.28rc 2024-07-31 HEAD@1cee0908 (x86_64 Linux)
|tcc git status      |thirdparty-linux-amd64 0134e9b9
|emcc version        |N/A
|glibc version       |ldd (GNU libc) 2.42

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions