rustc_mir::shim misuses ParamEnv
s.
#70520
Labels
A-mir
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
(This example is about
CloneShim
, butDropGlue
has a similar issue)In this snippet,
param_env
is obtained fromtcx.param_env(def_id)
and used twice withself_ty
:is_copy_modulo_regions
self_ty
doesn't involve type parameters,param_env
doesn't matter, but if it does, they could be from anywhere (e.g. caller ofclone
, via MIR inliner), so theparam_env
being that ofClone::clone
itself is not useful at all (all it contains isSelf: Clone
)ParamEnv
, themir_shims
query would need to takeParamEnvAnd<InstanceDef>
instead of justInstanceDef
(but we might not need this)Copy
type, we should instead do whatDropShim
does and haveOption<Ty>
inCloneShim
, or split out of aCloneByCopyShim
ty::Const
) is converted tou64
only to be converted back toty::Const
, which is unnecessary and we could skip it entirelyrust/src/librustc_mir/shim.rs
Lines 330 to 343 in 7762131
The text was updated successfully, but these errors were encountered: