Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain why clippy's HIR const eval exists #13615

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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