Skip to content

Use const instead of function and make it private #98756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions compiler/rustc_const_eval/src/const_eval/eval_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(
Expand Down Expand Up @@ -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(
Expand Down