mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-20 10:55:14 +00:00
Explain ParamEnv::reveal_all usage
This commit is contained in:
parent
6b651b1a88
commit
41d58185dd
@ -578,6 +578,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
ty::ConstKind::Param(_) => throw_inval!(TooGeneric),
|
||||
ty::ConstKind::Unevaluated(def_id, substs) => {
|
||||
let instance = self.resolve(def_id, substs)?;
|
||||
// For statics we pick `ParamEnv::reveal_all`, because statics don't have generics
|
||||
// and thus don't care about the parameter environment. While we could just use
|
||||
// `self.param_env`, that would mean we invoke the query to evaluate the static
|
||||
// with different parameter environments, thus causing the static to be evaluated
|
||||
// multiple times.
|
||||
let param_env = if self.tcx.is_static(def_id) {
|
||||
ty::ParamEnv::reveal_all()
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user