diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-09-30 09:58:01 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-09-30 11:29:25 -0700 |
| commit | 1301f43119f8ae564a01abd3fa306e87d635e862 (patch) | |
| tree | 1276bd77184c395208ad1aa166b1f75bf4905432 /compiler/rustc_error_codes/src | |
| parent | 0c26144b1ac75267c679bad6a4e2c4e7bc7957d3 (diff) | |
| download | rust-1301f43119f8ae564a01abd3fa306e87d635e862.tar.gz rust-1301f43119f8ae564a01abd3fa306e87d635e862.zip | |
Remove E0019, use E0015 for inline assembly in a const
Diffstat (limited to 'compiler/rustc_error_codes/src')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0019.md | 38 |
2 files changed, 1 insertions, 39 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs index a202736ea6c..6af265d5069 100644 --- a/compiler/rustc_error_codes/src/error_codes.rs +++ b/compiler/rustc_error_codes/src/error_codes.rs @@ -18,7 +18,6 @@ E0010: include_str!("./error_codes/E0010.md"), E0013: include_str!("./error_codes/E0013.md"), E0014: include_str!("./error_codes/E0014.md"), E0015: include_str!("./error_codes/E0015.md"), -E0019: include_str!("./error_codes/E0019.md"), E0023: include_str!("./error_codes/E0023.md"), E0025: include_str!("./error_codes/E0025.md"), E0026: include_str!("./error_codes/E0026.md"), @@ -461,6 +460,7 @@ E0774: include_str!("./error_codes/E0774.md"), ; // E0006, // merged with E0005 // E0008, // cannot bind by-move into a pattern guard +// E0019, merged into E0015 // E0035, merged into E0087/E0089 // E0036, merged into E0087/E0089 // E0068, diff --git a/compiler/rustc_error_codes/src/error_codes/E0019.md b/compiler/rustc_error_codes/src/error_codes/E0019.md deleted file mode 100644 index ef43a57a981..00000000000 --- a/compiler/rustc_error_codes/src/error_codes/E0019.md +++ /dev/null @@ -1,38 +0,0 @@ -A function call isn't allowed in the const's initialization expression -because the expression's value must be known at compile-time. - -Erroneous code example: - -```compile_fail,E0019 -#![feature(asm)] - -fn main() { - static STATIC11: i32 = { - let x: i32; - unsafe { asm!("mov rax, 2", out("rax") x) }; // error! - x - }; -} -``` - -Remember: you can't use a function call inside a const's initialization -expression! However, you can totally use it anywhere else: - -``` -enum Test { - V1 -} - -impl Test { - fn func(&self) -> i32 { - 12 - } -} - -fn main() { - const FOO: Test = Test::V1; - - FOO.func(); // here is good - let x = FOO.func(); // or even here! -} -``` |
