Skip to content

Commit c782988

Browse files
committed
Auto merge of rust-lang#13615 - GnomedDev:document-constevalctx-point, r=Alexendoo
Explain why clippy's HIR const eval exists When I initially found this, I was wondering why clippy wasn't just using miri, but after some discussion with some rustc folks let's document why. changelog: none
2 parents 8568ca8 + 012e306 commit c782988

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clippy_utils/src/consts.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
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.
15
#![allow(clippy::float_cmp)]
26

37
use crate::macros::HirNode;
@@ -379,6 +383,8 @@ impl Ord for FullInt {
379383
/// The context required to evaluate a constant expression.
380384
///
381385
/// This is currently limited to constant folding and reading the value of named constants.
386+
///
387+
/// See the module level documentation for some context.
382388
pub struct ConstEvalCtxt<'tcx> {
383389
tcx: TyCtxt<'tcx>,
384390
param_env: ParamEnv<'tcx>,

0 commit comments

Comments
 (0)