Skip to content

Commit

Permalink
Auto merge of #13615 - GnomedDev:document-constevalctx-point, r=Alexe…
Browse files Browse the repository at this point in the history
…ndoo

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
  • Loading branch information
bors committed Nov 1, 2024
2 parents 8568ca8 + 012e306 commit c782988
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clippy_utils/src/consts.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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>,
Expand Down

0 comments on commit c782988

Please sign in to comment.