Rust

E0533 Expected Value, Found Variant Fix

A struct variant is not a value until its fields are supplied, and it is not a bare pattern until its fields are accounted for. Give the fields - values in an expression, bindings or underscores in a pattern - and E0533 goes away.

Written November 28, 2026 · Tested with Rust 1.99.1 · 12 min read

By the end of this guide
  • The rule underneath: a struct variant's fields are part of the value
  • The first failure: a struct variant named bare as a value
  • The second failure: the same bare name as a function argument
  • The third failure: a struct variant named bare in a pattern

Written November 28, 2026

Tested with Rust 1.99.1

What this guide is

Error E0533 is one code with two headers, and which header appears depends on where the variant name stands. In an expression - a value position - the header is "expected value, found struct variant": a struct variant such as Circle { radius: u32 } carries fields, so the bare name Shape::Circle is not a value; there is no circle until a radius is supplied. In a pattern, the header is "expected unit struct, unit variant or constant, found struct variant": a bare pattern names something that carries no data, and a struct variant does carry data, so the pattern has left the fields unaccounted for.

This guide reproduces the value-position error twice - in a let and as a function argument - and the pattern-position error once, all with the same small enum. It then gives the fix for each side: supply the fields to construct the value, and name the fields to match it. The last sections separate the cases that look similar but are different errors - a tuple variant named bare, which is a function value rather than an error at all, and a plain struct name used as a value, which is E0423.

The rule underneath: a struct variant's fields are part of the value

The Rust Reference's struct expressions chapter defines a struct expression as a path to a struct, enum variant, or union followed by the values for its fields: the path alone is only half of the expression. The same chapter draws the contrast that explains both headers. Unit structs and unit variants are instantiated with a plain path expression, because they have no fields to supply - the path is the whole value. Tuple structs and tuple variants are instantiated through a constructor in the value namespace, so their bare names are function values. A struct variant sits in neither group: it is built with braces and field values, so its bare name is neither a complete value nor a function - it is not a value at all, which is the note the value-position diagnostic prints under the caret.

Patterns mirror the same shapes. The Rust Reference's patterns chapter gives path patterns to constants, structs, and enum variants that have no fields, and struct patterns - braces with field names - to values with named fields. A bare Shape::Circle pattern therefore claims Circle has no fields. When the declaration says it has one, that claim is the pattern-position E0533.

The first failure: a struct variant named bare as a value

Rust
enum Shape {
    Circle { radius: u32 },
    Square,
}

fn main() {
    let shape = Shape::Circle;
    match shape {
        Shape::Circle { radius } => println!("circle radius {}", radius),
        Shape::Square => println!("square"),
    }
}
Terminal
$ rustc --edition 2021 p1_fail_value.rs -o p1_fail_value.bin
error[E0533]: expected value, found struct variant `Shape::Circle`
 --> p1_fail_value.rs:7:17
  |
7 |     let shape = Shape::Circle;
  |                 ^^^^^^^^^^^^^ not a value
  |
help: you might have meant to create a new value of the struct
  |
7 |     let shape = Shape::Circle { radius: /* value */ };
  |                               +++++++++++++++++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0533`.

The note under the caret is the whole diagnosis: not a value. The help is the fix in outline form - create a value of the struct, with a placeholder where the field value belongs. Nothing else in the program is wrong: the match below already uses the correct struct pattern for the same variant. Only the construction is missing its fields.

The second failure: the same bare name as a function argument

An argument is a value position too, so passing the bare name draws the same header:

Rust
enum Shape {
    Circle { radius: u32 },
    Square,
}

fn show(shape: Shape) {
    match shape {
        Shape::Circle { radius } => println!("circle radius {}", radius),
        Shape::Square => println!("square"),
    }
}

fn main() {
    show(Shape::Circle);
}
Terminal
$ rustc --edition 2021 p2_fail_arg.rs -o p2_fail_arg.bin
error[E0533]: expected value, found struct variant `Shape::Circle`
  --> p2_fail_arg.rs:14:10
   |
14 |     show(Shape::Circle);
   |          ^^^^^^^^^^^^^ not a value
   |
help: you might have meant to create a new value of the struct
   |
14 -     show(Shape::Circle);
14 +     show(Shape::Circle { radius: /* value */ };
   |

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0533`.

Same code, same header, same note. The suggested replacement line is printed exactly as the compiler emits it, without the call's closing parenthesis - read the suggestion for the struct literal it adds, Shape::Circle { radius: /* value */ }, and keep the rest of your own line intact when you apply it.

The third failure: a struct variant named bare in a pattern

Rust
enum Shape {
    Circle { radius: u32 },
    Square,
}

fn main() {
    let shape = Shape::Circle { radius: 5 };
    if let Shape::Circle = shape {
        println!("circle");
    }
    let other = Shape::Square;
    if let Shape::Square = other {
        println!("square");
    }
}
Terminal
$ rustc --edition 2021 p3_fail_pattern.rs -o p3_fail_pattern.bin
error[E0533]: expected unit struct, unit variant or constant, found struct variant `Shape::Circle`
 --> p3_fail_pattern.rs:8:12
  |
8 |     if let Shape::Circle = shape {
  |            ^^^^^^^^^^^^^ not a unit struct, unit variant or constant
  |
help: add the names to match a struct variant's fields
  |
8 |     if let Shape::Circle { radius: _ } = shape {
  |                          +++++++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0533`.

Here the value is constructed correctly - Shape::Circle { radius: 5 } - and the pattern is the problem. The header changes because the position changed: a pattern is expected to name a unit struct, a unit variant, or a constant, and Circle is none of those. The help points at the missing half of the pattern: add the field names. Note the second if let in the same program: Shape::Square is a unit variant, so its bare pattern is correct and draws no error.

The fix for values: supply the fields in braces

A struct variant value is a struct expression: the path plus every field's value in braces. A unit variant of the same enum needs nothing added - its bare path already is a value:

Rust
enum Shape {
    Circle { radius: u32 },
    Square,
}

fn main() {
    let shape = Shape::Circle { radius: 5 };
    match shape {
        Shape::Circle { radius } => println!("circle radius {}", radius),
        Shape::Square => println!("square"),
    }
    let unit = Shape::Square;
    match unit {
        Shape::Circle { radius } => println!("circle radius {}", radius),
        Shape::Square => println!("square"),
    }
}
Terminal
$ rustc --edition 2021 p4_fix_value.rs -o p4_fix_value.bin
$ ./p4_fix_value.bin
circle radius 5
square

The two constructions side by side are the rule: Circle takes { radius: 5 } because its declaration has a field; Square needs nothing added because its declaration has no fields. For a variant with several fields, supply each field by name, in any order.

The fix for patterns: name the fields in braces

A struct pattern names the variant's fields in braces. Bind a field to use its value, or write field: _ for a field the code does not need:

Rust
enum Shape {
    Circle { radius: u32 },
    Square,
}

fn main() {
    let shape = Shape::Circle { radius: 5 };
    if let Shape::Circle { radius } = shape {
        println!("circle radius {}", radius);
    }
    let other = Shape::Circle { radius: 9 };
    if let Shape::Circle { radius: _ } = other {
        println!("circle, field ignored");
    }
    let unit = Shape::Square;
    if let Shape::Square = unit {
        println!("square");
    }
}
Terminal
$ rustc --edition 2021 p5_fix_pattern.rs -o p5_fix_pattern.bin
$ ./p5_fix_pattern.bin
circle radius 5
circle, field ignored
square

The shorthand Shape::Circle { radius } binds the field to a variable of the same name, and the first line of output prints it. The radius: _ form is the one the compiler's help suggests: it matches any Circle value and discards the field. The unit variant's pattern stays bare, because the pattern form follows the declaration, not a habit.

Neighboring case: a bare tuple variant is a function value, not E0533

A tuple variant behaves differently from a struct variant in value position, because a tuple variant has a constructor. Its bare name is that constructor - a function value that builds the variant when called:

Rust
enum Shape {
    Circle(u32),
    Square,
}

fn main() {
    let make: fn(u32) -> Shape = Shape::Circle;
    let shape = make(7);
    match shape {
        Shape::Circle(radius) => println!("circle {}", radius),
        Shape::Square => println!("square"),
    }
    let other = Shape::Square;
    match other {
        Shape::Circle(radius) => println!("circle {}", radius),
        Shape::Square => println!("square"),
    }
}
Terminal
$ rustc --edition 2021 p6_tuple_fn_value.rs -o p6_tuple_fn_value.bin
$ ./p6_tuple_fn_value.bin
circle 7
square

The annotation is what makes the intent explicit: make has the function type fn(u32) -> Shape, and calling it with 7 produces the Circle(7) the output shows. So a bare tuple variant name is a value - just a function value, not a Shape. That difference is exactly what the next error reports.

Neighboring error: a tuple variant where a Shape is expected is E0308

Leave the function-type annotation off and ask for a Shape directly, and the constructor function no longer fits:

Rust
enum Shape {
    Circle(u32),
    Square,
}

fn main() {
    let shape: Shape = Shape::Circle;
    match shape {
        Shape::Circle(radius) => println!("circle {}", radius),
        Shape::Square => println!("square"),
    }
}
Terminal
$ rustc --edition 2021 p7_tuple_typed.rs -o p7_tuple_typed.bin
error[E0308]: mismatched types
 --> p7_tuple_typed.rs:7:24
  |
2 |     Circle(u32),
  |     ------ `Circle` defines an enum variant constructor here, which should be called
...
7 |     let shape: Shape = Shape::Circle;
  |                -----   ^^^^^^^^^^^^^ expected `Shape`, found enum constructor
  |                |
  |                expected due to this
  |
  = note:          expected enum `Shape`
          found enum constructor `fn(u32) -> Shape {Shape::Circle}`
help: use parentheses to construct this tuple variant
  |
7 |     let shape: Shape = Shape::Circle(/* u32 */);
  |                                     +++++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0308`.

Same bare name, same position as the first failure in this guide - but because Circle here is a tuple variant, the name resolves to a real value of the wrong type, and the report is a type mismatch, E0308, not E0533. The note spells out the found type: fn(u32) -> Shape. Read the header before choosing a repair: E0533 means the name is not a value at all; E0308 means it is a value - the constructor - being used where the constructed type was expected, and the help's parentheses are the call that was missing.

Neighboring error: a plain struct name as a value is E0423

A plain struct invites the same bare-name mistake outside enums entirely, and it is a third error code:

Rust
struct Point {
    x: i32,
    y: i32,
}

fn main() {
    let p = Point;
    println!("{} {}", p.x, p.y);
}
Terminal
$ rustc --edition 2021 p8_plain_struct.rs -o p8_plain_struct.bin
error[E0423]: cannot find value `Point` in this scope
 --> p8_plain_struct.rs:7:13
  |
1 | / struct Point {
2 | |     x: i32,
3 | |     y: i32,
4 | | }
  | |_- `Point` defined here
...
7 |       let p = Point;
  |               ^^^^^ help: use struct literal syntax instead: `Point { x: val, y: val }`
  |
  = note: a struct named `Point` exists in another namespace

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0423`.

The note gives the reason: the struct's name lives in the type namespace, and there is no value by that name in the value namespace to find. The repair is the same shape as the struct variant's fix - the struct literal, Point { x: val, y: val } with real values in place of the placeholders. The header differs because the name resolution failed earlier: E0423 reports a name that cannot be found as a value at all, while E0533 found the variant and reported that it is not a value.

Decision summary

  • The header says "expected value, found struct variant" (E0533): a struct variant was named bare in an expression - construct it with its fields, as in Shape::Circle { radius: 5 }.
  • The header says "expected unit struct, unit variant or constant, found struct variant" (E0533): a struct variant was named bare in a pattern - add the field names, as in Shape::Circle { radius } to bind or Shape::Circle { radius: _ } to ignore.
  • The name is a unit variant: leave it bare in both positions - Shape::Square is already a value and already a complete pattern.
  • The header instead says "mismatched types" with "found enum constructor" (E0308): the variant is a tuple variant and its bare name is the constructor function - call it, as in Shape::Circle(7), or bind it to a function-typed name on purpose.
  • The header instead says "cannot find value ... in this scope" with "exists in another namespace" (E0423): the name is a plain struct - write the struct literal with every field's value.

Checklist

  • Every struct variant construction supplies every field by name inside braces.
  • Every struct variant pattern names the fields in braces, each bound under a name the code uses or written as field: _ on purpose.
  • Unit variants are still written bare, as both values and patterns.
  • No tuple variant constructor stands where the enum type itself is expected - it is either called or held in a function-typed binding.
  • No plain struct name stands as a value - structs are built with the literal syntax.
  • The fixed programs compile, run, and their output shows the field values where the code prints them.
  • E0532 Expected Tuple Variant Fix - the pattern-side sibling: a tuple variant named bare in a pattern, fixed by adding the parentheses the declaration has.
  • E0423 Expected Value Fix - the wider E0423 family, where a name used as a value resolves to something that lives in another namespace.
  • E0063 Missing Fields in Struct Fix - the next error after the braces are added: the literal is present, but one of the variant's or struct's fields is missing from it.

Sources

  • Rust, Error codes index: E0533 - the definition of the error: an item which is not a unit struct, a variant, nor a constant has been used as a match pattern; its example uses a method path as a pattern and its stated fix is to bind the value first and compare against it. The index frames E0533 from the pattern side; the value-position header in this guide is the same code applied to a struct variant named where a value is required.
  • The Rust Reference, Struct expressions - what a struct expression is: a path to a struct, enum variant, or union followed by the values for its fields; unit structs and unit variants are instantiated with a path expression, while tuple structs and tuple variants are instantiated through a constructor in the value namespace - the contrast that separates the E0533, E0308, and bare-unit-variant cases.
  • The Rust Reference, Patterns - the pattern kinds and what each matches: path patterns refer to constants, structs, or enum variants that have no fields, while struct patterns match values with named fields using braces and field names - the rule the pattern-position header enforces.

Keep Exploring