Use List::empty() instead of mk_substs(&[]).

This commit is contained in:
Nicholas Nethercote 2023-02-20 14:52:23 +11:00
parent c09f5b6a6b
commit 08f28f9447
5 changed files with 8 additions and 8 deletions

View File

@ -383,7 +383,7 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
tcx, tcx,
ty::ParamEnv::reveal_all(), ty::ParamEnv::reveal_all(),
def_id, def_id,
tcx.mk_substs(&[]), ty::List::empty(),
) )
.unwrap().unwrap(), .unwrap().unwrap(),
), ),

View File

@ -520,7 +520,7 @@ impl<'ll, 'tcx> MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
let tcx = self.tcx; let tcx = self.tcx;
let llfn = match tcx.lang_items().eh_personality() { let llfn = match tcx.lang_items().eh_personality() {
Some(def_id) if !wants_msvc_seh(self.sess()) => self.get_fn_addr( Some(def_id) if !wants_msvc_seh(self.sess()) => self.get_fn_addr(
ty::Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, tcx.mk_substs(&[])) ty::Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, ty::List::empty())
.unwrap() .unwrap()
.unwrap(), .unwrap(),
), ),

View File

@ -677,21 +677,21 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
return; return;
} }
let def = cx.tcx.adt_def(item.owner_id); let def = cx.tcx.adt_def(item.owner_id);
(def, cx.tcx.mk_adt(def, cx.tcx.mk_substs(&[]))) (def, cx.tcx.mk_adt(def, ty::List::empty()))
} }
hir::ItemKind::Union(_, ref ast_generics) => { hir::ItemKind::Union(_, ref ast_generics) => {
if !ast_generics.params.is_empty() { if !ast_generics.params.is_empty() {
return; return;
} }
let def = cx.tcx.adt_def(item.owner_id); let def = cx.tcx.adt_def(item.owner_id);
(def, cx.tcx.mk_adt(def, cx.tcx.mk_substs(&[]))) (def, cx.tcx.mk_adt(def, ty::List::empty()))
} }
hir::ItemKind::Enum(_, ref ast_generics) => { hir::ItemKind::Enum(_, ref ast_generics) => {
if !ast_generics.params.is_empty() { if !ast_generics.params.is_empty() {
return; return;
} }
let def = cx.tcx.adt_def(item.owner_id); let def = cx.tcx.adt_def(item.owner_id);
(def, cx.tcx.mk_adt(def, cx.tcx.mk_substs(&[]))) (def, cx.tcx.mk_adt(def, ty::List::empty()))
} }
_ => return, _ => return,
}; };

View File

@ -2530,7 +2530,7 @@ impl<'tcx> ConstantKind<'tcx> {
{ {
InternalSubsts::identity_for_item(tcx, parent_did.to_def_id()) InternalSubsts::identity_for_item(tcx, parent_did.to_def_id())
} else { } else {
tcx.mk_substs(&[]) List::empty()
}; };
debug!(?parent_substs); debug!(?parent_substs);

View File

@ -237,7 +237,7 @@ pub fn constant<'tcx>(
typeck_results, typeck_results,
param_env: lcx.param_env, param_env: lcx.param_env,
needed_resolution: false, needed_resolution: false,
substs: lcx.tcx.mk_substs(&[]), substs: ty::List::empty(),
}; };
cx.expr(e).map(|cst| (cst, cx.needed_resolution)) cx.expr(e).map(|cst| (cst, cx.needed_resolution))
} }
@ -306,7 +306,7 @@ pub fn constant_context<'a, 'tcx>(
typeck_results, typeck_results,
param_env: lcx.param_env, param_env: lcx.param_env,
needed_resolution: false, needed_resolution: false,
substs: lcx.tcx.mk_substs(&[]), substs: ty::List::empty(),
} }
} }