#E0013: 블록 머리의 구조체 리터럴
if, while, match, for의 머리에서는 {가 본문을 열기 때문에, 그 자리의 구조체 리터럴은 잘못 읽힙니다. 리터럴을 괄호로 감싸세요: if p == (Point { x: 0, y: 0 }) { .. }.
nabi
struct P { x: i32; }
match P { x: 2 } {
P { x } => println(f"{x}"),
}
error[E0013]: a struct literal can't start a block's head: its `{` would open the body --> main.nabi:3:7 | 3 | match P { x: 2 } { | ^^^^^^^^^^ | = help: wrap the struct literal in parentheses: `(P { x: 2 })`
리터럴을 괄호로 감싸세요.
nabi
struct P { x: i32; }
match (P { x: 2 }) {
P { x } => println(f"{x}"),
}
2
관련 코드: E0010 예상치 못한 토큰
잘못된 곳이 있나요? GitHub에서 이 페이지 고치기. 마지막 수정