compiler/rustc_error_codes/src/error_codes/E0572.md MARKDOWN 25 lines View on github.com → Search inside
1A return statement was found outside of a function body.23Erroneous code example:45```compile_fail,E05726const FOO: u32 = return 0; // error: return statement outside of function body78fn main() {}9```1011To fix this issue, just remove the return keyword or move the expression into a12function. Example:1314```15const FOO: u32 = 0;1617fn some_fn() -> u32 {18    return FOO;19}2021fn main() {22    some_fn();23}24```

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.