about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGnomedDev <david2005thomas@gmail.com>2024-10-27 21:20:47 +0000
committerGnomedDev <david2005thomas@gmail.com>2024-11-01 11:06:54 +0000
commit012e30622c45d2757fefda1225237c98f034abeb (patch)
tree6cf3ddfaa5eeee8dcedef2a34607953d887d2787
parent12ca3630fce5724bac5666a48af2018f30446a04 (diff)
downloadrust-012e30622c45d2757fefda1225237c98f034abeb.tar.gz
rust-012e30622c45d2757fefda1225237c98f034abeb.zip
Explain why clippy's HIR const eval exists
-rw-r--r--clippy_utils/src/consts.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/clippy_utils/src/consts.rs b/clippy_utils/src/consts.rs
index a1cfb7be647..0dbc7972fe9 100644
--- a/clippy_utils/src/consts.rs
+++ b/clippy_utils/src/consts.rs
@@ -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 @@ 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>,