Fix spans

This commit is contained in:
Michael Goulet 2024-07-01 16:32:32 -04:00
parent 0f7f3f4045
commit 3273ccea4b
11 changed files with 36 additions and 36 deletions

View file

@ -853,13 +853,7 @@ fn visit_fn_use<'tcx>(
) {
if let ty::FnDef(def_id, args) = *ty.kind() {
let instance = if is_direct_call {
ty::Instance::expect_resolve(
tcx,
ty::ParamEnv::reveal_all(),
def_id,
args,
Some(source),
)
ty::Instance::expect_resolve(tcx, ty::ParamEnv::reveal_all(), def_id, args, source)
} else {
match ty::Instance::resolve_for_fn_ptr(tcx, ty::ParamEnv::reveal_all(), def_id, args) {
Some(instance) => instance,
@ -1261,13 +1255,8 @@ fn visit_mentioned_item<'tcx>(
match *item {
MentionedItem::Fn(ty) => {
if let ty::FnDef(def_id, args) = *ty.kind() {
let instance = Instance::expect_resolve(
tcx,
ty::ParamEnv::reveal_all(),
def_id,
args,
Some(span),
);
let instance =
Instance::expect_resolve(tcx, ty::ParamEnv::reveal_all(), def_id, args, span);
// `visit_instance_use` was written for "used" item collection but works just as well
// for "mentioned" item collection.
// We can set `is_direct_call`; that just means we'll skip a bunch of shims that anyway
@ -1492,7 +1481,7 @@ impl<'v> RootCollector<'_, 'v> {
ty::ParamEnv::reveal_all(),
start_def_id,
self.tcx.mk_args(&[main_ret_ty.into()]),
None,
DUMMY_SP,
);
self.output.push(create_fn_mono_item(self.tcx, start_instance, DUMMY_SP));
@ -1561,9 +1550,10 @@ fn create_mono_items_for_default_impls<'tcx>(
}
// As mentioned above, the method is legal to eagerly instantiate if it
// only has lifetime generic parameters. This is validated by
// only has lifetime generic parameters. This is validated by calling
// `own_requires_monomorphization` on both the impl and method.
let args = trait_ref.args.extend_to(tcx, method.def_id, only_region_params);
let instance = ty::Instance::expect_resolve(tcx, param_env, method.def_id, args, None);
let instance = ty::Instance::expect_resolve(tcx, param_env, method.def_id, args, DUMMY_SP);
let mono_item = create_fn_mono_item(tcx, instance, DUMMY_SP);
if mono_item.node.is_instantiable(tcx) && should_codegen_locally(tcx, instance) {