Skip to main content

Module qualifs

Module qualifs 

Source
Expand description

Structural const qualification.

See the Qualif trait for more info.

Re-exportsΒ§

use rustc_attr_ir::lang_items::LangItem; πŸ”’
use rustc_errors::ErrorGuaranteed; πŸ”’
use rustc_infer::infer::TyCtxtInferExt; πŸ”’
use rustc_middle::mir; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::AdtDef; πŸ”’
use rustc_middle::ty::Ty; πŸ”’
use rustc_middle::ty::TypingMode; πŸ”’
use rustc_span::bug; πŸ”’
use rustc_trait_selection::traits::Obligation; πŸ”’
use rustc_trait_selection::traits::ObligationCause; πŸ”’
use rustc_trait_selection::traits::ObligationCtxt; πŸ”’
use tracing::instrument; πŸ”’
use tracing::instrument; πŸ”’
use super::ConstCx; πŸ”’
use rustc_middle::mir::*; πŸ”’

StructsΒ§

HasMutInterior
Constant containing interior mutability (UnsafeCell<T>). This must be ruled out to make sure that evaluating the constant at compile-time and at any point during the run-time would produce the same result. In particular, promotion of temporaries must not change program behavior; if the promoted could be written to, that would be a problem.
NeedsDrop
Constant containing an ADT that implements Drop. This must be ruled out because implicit promotion would remove side-effects that occur as part of dropping that value. N.B., the implicit promotion has to reject const Drop implementations because even if side-effects are ruled out through other means, the execution of the drop could diverge.
NeedsNonConstDrop
Constant containing an ADT that implements non-const Drop. This must be ruled out because we cannot run Drop during compile-time.

TraitsΒ§

Qualif
A β€œqualif”(-ication) is a way to look for something β€œbad” in the MIR that would disqualify some code for promotion or prevent it from evaluating at compile time.

FunctionsΒ§

in_any_value_of_ty
in_operand
Returns true if this Operand contains qualif Q.
in_place
Returns true if this Place contains qualif Q.
in_rvalue
Returns true if this Rvalue contains qualif Q.