Skip to content

Commit bfa3d59

Browse files
move E0744 to new error code
1 parent 27b58ed commit bfa3d59

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/librustc_error_codes/error_codes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ E0740: include_str!("./error_codes/E0740.md"),
401401
E0741: include_str!("./error_codes/E0741.md"),
402402
E0742: include_str!("./error_codes/E0742.md"),
403403
E0743: include_str!("./error_codes/E0743.md"),
404+
E0744: include_str!("./error_codes/E0744.md"),
404405
;
405406
// E0006, // merged with E0005
406407
// E0008, // cannot bind by-move into a pattern guard
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Control-flow expressions are not allowed inside a const context.
2+
3+
At the moment, `if` and `match`, as well as the looping constructs `for`,
4+
`while`, and `loop`, are forbidden inside a `const`, `static`, or `const fn`.
5+
6+
```compile_fail,E0744
7+
const _: i32 = {
8+
let mut x = 0;
9+
loop {
10+
x += 1;
11+
if x == 4 {
12+
break;
13+
}
14+
}
15+
x
16+
};
17+
```

src/librustc_passes/check_const.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use rustc::ty::query::Providers;
1717
use syntax::ast::Mutability;
1818
use syntax::span_err;
1919
use syntax_pos::Span;
20+
use rustc_error_codes::*;
2021

2122
use std::fmt;
2223

0 commit comments

Comments
 (0)