compiler/rustc_error_codes/src/error_codes/E0026.md MARKDOWN 35 lines View on github.com → Search inside
1A struct pattern attempted to extract a nonexistent field from a struct.23Erroneous code example:45```compile_fail,E00266struct Thing {7    x: u32,8    y: u32,9}1011let thing = Thing { x: 0, y: 0 };1213match thing {14    Thing { x, z } => {} // error: `Thing::z` field doesn't exist15}16```1718If you are using shorthand field patterns but want to refer to the struct field19by a different name, you should rename it explicitly. Struct fields are20identified by the name used before the colon `:` so struct patterns should21resemble the declaration of the struct type being matched.2223```24struct Thing {25    x: u32,26    y: u32,27}2829let thing = Thing { x: 0, y: 0 };3031match thing {32    Thing { x, y: z } => {} // we renamed `y` to `z`33}34```

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.