Explain why clippy's HIR const eval exists

This commit is contained in:
GnomedDev 2024-10-27 21:20:47 +00:00
parent 12ca3630fc
commit 012e30622c
No known key found for this signature in database

View File

@ -1,3 +1,7 @@
//! A simple const eval API, for use on arbitrary HIR expressions.
//!
//! This cannot use rustc's const eval, aka miri, as arbitrary HIR expressions cannot be lowered to
//! executable MIR bodies, so we have to do this instead.
#![allow(clippy::float_cmp)]
use crate::macros::HirNode;
@ -379,6 +383,8 @@ fn cmp_s_u(s: i128, u: u128) -> Ordering {
/// The context required to evaluate a constant expression.
///
/// This is currently limited to constant folding and reading the value of named constants.
///
/// See the module level documentation for some context.
pub struct ConstEvalCtxt<'tcx> {
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,