about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-07-01 20:19:21 +0530
committerGitHub <noreply@github.com>2022-07-01 20:19:21 +0530
commit6404620f18da68a07299d6fe02d886141b9d0347 (patch)
treeb2b619cbf281f8b3ef69958a213a9773382dc720 /compiler
parentc0cf363ca17070540fbbb6bd1b47f75861a0cdb0 (diff)
parentf791ac6a798a6b4c1b2b0c59e904e08340ff593e (diff)
downloadrust-6404620f18da68a07299d6fe02d886141b9d0347.tar.gz
rust-6404620f18da68a07299d6fe02d886141b9d0347.zip
Rollup merge of #98756 - TaKO8Ki:use-const-instead-of-function, r=Dylan-DPC
Use const instead of function and make it private
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_const_eval/src/const_eval/eval_queries.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
index 09a2977af04..0dac4f8978e 100644
--- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
+++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
@@ -19,11 +19,9 @@ use rustc_target::abi::{self, Abi};
 use std::borrow::Cow;
 use std::convert::TryInto;
 
-pub fn note_on_undefined_behavior_error() -> &'static str {
-    "The rules on what exactly is undefined behavior aren't clear, \
+const NOTE_ON_UNDEFINED_BEHAVIOR_ERROR: &str = "The rules on what exactly is undefined behavior aren't clear, \
      so this check might be overzealous. Please open an issue on the rustc \
-     repository if you believe it should not be considered undefined behavior."
-}
+     repository if you believe it should not be considered undefined behavior.";
 
 // Returns a pointer to where the result lives
 fn eval_body_using_ecx<'mir, 'tcx>(
@@ -375,7 +373,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
                     ecx.tcx,
                     "it is undefined behavior to use this value",
                     |diag| {
-                        diag.note(note_on_undefined_behavior_error());
+                        diag.note(NOTE_ON_UNDEFINED_BEHAVIOR_ERROR);
                         diag.note(&format!(
                             "the raw bytes of the constant ({}",
                             display_allocation(