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Β§
- HasMut
Interior - 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. - Needs
Drop - 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. - Needs
NonConst Drop - Constant containing an ADT that implements non-const
Drop. This must be ruled out because we cannot runDropduring 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
trueif thisOperandcontains qualifQ. - in_
place - Returns
trueif thisPlacecontains qualifQ. - in_
rvalue - Returns
trueif thisRvaluecontains qualifQ.