From dc5f6d2e48d21dccbe58d755dd73cf9c6fb886b5 Mon Sep 17 00:00:00 2001 From: "Brandon H. Gomes" Date: Wed, 4 Aug 2021 15:49:00 -0400 Subject: [PATCH] move full explanation to after erroneous example --- compiler/rustc_error_codes/src/error_codes/E0625.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_error_codes/src/error_codes/E0625.md b/compiler/rustc_error_codes/src/error_codes/E0625.md index 93e2928dd7a..7db857723cc 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0625.md +++ b/compiler/rustc_error_codes/src/error_codes/E0625.md @@ -1,5 +1,4 @@ -Static and const variables can refer to other const variables. But a const -variable cannot refer to a thread-local static variable. +A compile-time const variable is referring to a thread-local static variable. Erroneous code example: @@ -12,8 +11,10 @@ static X: usize = 12; const Y: usize = 2 * X; ``` -In this example, `Y` cannot refer to `X`. To fix this, the value can be -extracted as a const and then used: +Static and const variables can refer to other const variables but a const +variable cannot refer to a thread-local static variable. In this example, +`Y` cannot refer to `X`. To fix this, the value can be extracted as a const +and then used: ``` #![feature(thread_local)]