E0573name-resolution

Expected type, found ...

Used a non-type identifier where a type was required.

Repro

fn make() -> u32::MAX { 0 }   // E0573: expected type, found const `u32::MAX`

Why

Type position only accepts types. u32::MAX is a const value, not a type. Other shapes that trigger the error: trait names used as types without dyn, modules, function names.

Fix

- Replace with the actual type: fn make() -> u32 { u32::MAX }. - For trait objects, write dyn Trait: fn handler() -> Box<dyn Handler>. - For type aliases, ensure the alias points at a type, not a value. - Match the kind to the position — values to value position, types to type position.

Patterns that solve this