Skip to content

Commit 339c4ff

Browse files
committed
Explain why clippy's HIR const eval exists
1 parent 12ca363 commit 339c4ff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clippy_utils/src/consts.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! A simple const eval API, for use on arbitrary HIR expressions.
2+
//!
3+
//! This cannot use rustc's const eval, aka miri, as arbitrary HIR expressions cannot be lowered to
4+
//! executable MIR bodies, so we have to do this instead. If HIR expressions gain the ability to be
5+
//! lowered to executable MIR bodies, this should be removed.
16
#![allow(clippy::float_cmp)]
27

38
use crate::macros::HirNode;
@@ -379,6 +384,8 @@ impl Ord for FullInt {
379384
/// The context required to evaluate a constant expression.
380385
///
381386
/// This is currently limited to constant folding and reading the value of named constants.
387+
///
388+
/// See the module level documentation for some context.
382389
pub struct ConstEvalCtxt<'tcx> {
383390
tcx: TyCtxt<'tcx>,
384391
param_env: ParamEnv<'tcx>,

0 commit comments

Comments
 (0)