Skip to content

Commit

Permalink
Explain why clippy's HIR const eval exists
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Oct 28, 2024
1 parent 12ca363 commit 339c4ff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions clippy_utils/src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//! 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. If HIR expressions gain the ability to be
//! lowered to executable MIR bodies, this should be removed.
#![allow(clippy::float_cmp)]

use crate::macros::HirNode;
Expand Down Expand Up @@ -379,6 +384,8 @@ impl Ord for FullInt {
/// 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>,
Expand Down

0 comments on commit 339c4ff

Please sign in to comment.