refactor(rustc_middle): Substs -> GenericArg
This commit is contained in:
parent
df5c2cf9bc
commit
e55583c4b8
466 changed files with 4574 additions and 4604 deletions
|
@ -45,7 +45,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
|
|||
"Unexpected DefKind: {:?}",
|
||||
ecx.tcx.def_kind(cid.instance.def_id())
|
||||
);
|
||||
let layout = ecx.layout_of(body.bound_return_ty().subst(tcx, cid.instance.substs))?;
|
||||
let layout = ecx.layout_of(body.bound_return_ty().instantiate(tcx, cid.instance.args))?;
|
||||
assert!(layout.is_sized());
|
||||
let ret = ecx.allocate(layout, MemoryKind::Stack)?;
|
||||
|
||||
|
@ -245,10 +245,10 @@ pub fn eval_to_const_value_raw_provider<'tcx>(
|
|||
// Catch such calls and evaluate them instead of trying to load a constant's MIR.
|
||||
if let ty::InstanceDef::Intrinsic(def_id) = key.value.instance.def {
|
||||
let ty = key.value.instance.ty(tcx, key.param_env);
|
||||
let ty::FnDef(_, substs) = ty.kind() else {
|
||||
let ty::FnDef(_, args) = ty.kind() else {
|
||||
bug!("intrinsic with type {:?}", ty);
|
||||
};
|
||||
return eval_nullary_intrinsic(tcx, key.param_env, def_id, substs).map_err(|error| {
|
||||
return eval_nullary_intrinsic(tcx, key.param_env, def_id, args).map_err(|error| {
|
||||
let span = tcx.def_span(def_id);
|
||||
|
||||
super::report(
|
||||
|
@ -328,10 +328,10 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
|
|||
("static", String::new())
|
||||
} else {
|
||||
// If the current item has generics, we'd like to enrich the message with the
|
||||
// instance and its substs: to show the actual compile-time values, in addition to
|
||||
// instance and its args: to show the actual compile-time values, in addition to
|
||||
// the expression, leading to the const eval error.
|
||||
let instance = &key.value.instance;
|
||||
if !instance.substs.is_empty() {
|
||||
if !instance.args.is_empty() {
|
||||
let instance = with_no_trimmed_paths!(instance.to_string());
|
||||
("const_with_path", instance)
|
||||
} else {
|
||||
|
|
|
@ -230,7 +230,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
|
|||
*self.tcx,
|
||||
ty::ParamEnv::reveal_all(),
|
||||
const_def_id,
|
||||
instance.substs,
|
||||
instance.args,
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
|
|
@ -105,7 +105,7 @@ pub(crate) fn try_destructure_mir_constant_for_diagnostics<'tcx>(
|
|||
let down = ecx.operand_downcast(&op, variant).ok()?;
|
||||
(def.variants()[variant].fields.len(), Some(variant), down)
|
||||
}
|
||||
ty::Tuple(substs) => (substs.len(), None, op),
|
||||
ty::Tuple(args) => (args.len(), None, op),
|
||||
_ => bug!("cannot destructure mir constant {:?}", val),
|
||||
};
|
||||
|
||||
|
|
|
@ -416,9 +416,9 @@ fn valtree_into_mplace<'tcx>(
|
|||
debug!(?unsized_inner_ty);
|
||||
|
||||
let inner_ty = match ty.kind() {
|
||||
ty::Adt(def, substs) => {
|
||||
ty::Adt(def, args) => {
|
||||
let i = FieldIdx::from_usize(i);
|
||||
def.variant(FIRST_VARIANT).fields[i].ty(tcx, substs)
|
||||
def.variant(FIRST_VARIANT).fields[i].ty(tcx, args)
|
||||
}
|
||||
ty::Tuple(inner_tys) => inner_tys[i],
|
||||
_ => bug!("unexpected unsized type {:?}", ty),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue