From bfa3d599ebf4be6348c2a4d6ffa8f32f61ab7c15 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 14 Nov 2019 00:26:16 +0100 Subject: move E0744 to new error code --- src/librustc_error_codes/error_codes/E0744.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/librustc_error_codes/error_codes/E0744.md (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0744.md b/src/librustc_error_codes/error_codes/E0744.md new file mode 100644 index 00000000000..254223f3565 --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0744.md @@ -0,0 +1,17 @@ +Control-flow expressions are not allowed inside a const context. + +At the moment, `if` and `match`, as well as the looping constructs `for`, +`while`, and `loop`, are forbidden inside a `const`, `static`, or `const fn`. + +```compile_fail,E0744 +const _: i32 = { + let mut x = 0; + loop { + x += 1; + if x == 4 { + break; + } + } + x +}; +``` -- cgit 1.4.1-3-g733a5