Skip to content

Commit

Permalink
Make sure we check for external functions too
Browse files Browse the repository at this point in the history
  • Loading branch information
JustusAdam committed Sep 7, 2024
1 parent 01e95ed commit c9707f4
Showing 1 changed file with 21 additions and 32 deletions.
53 changes: 21 additions & 32 deletions crates/paralegal-flow/src/ann/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,26 +207,16 @@ impl<'tcx> MarkerCtx<'tcx> {
res: impl Into<MaybeMonomorphized<'tcx>>,
) -> impl Iterator<Item = Identifier> + '_ {
let res = res.into();
// TODO this check is wrong. This should either check whether this gets inlined or be removed altogether.
if res.def_id().is_local() {
let mut direct_markers = self
.combined_markers(res.def_id())
.map(|m| m.marker)
.peekable();
let non_direct = direct_markers
.peek()
.is_none()
.then(|| self.get_reachable_markers(res));

Either::Right(direct_markers.chain(non_direct.into_iter().flatten().copied()))
} else {
Either::Left(
self.all_function_markers(res)
.map(|m| m.0.marker)
.collect::<Vec<_>>(),
)
}
.into_iter()
let mut direct_markers = self
.combined_markers(res.def_id())
.map(|m| m.marker)
.peekable();
let non_direct = direct_markers
.peek()
.is_none()
.then(|| self.get_reachable_markers(res));

direct_markers.chain(non_direct.into_iter().flatten().copied())
}

/// If the transitive marker cache did not contain the answer, this is what
Expand Down Expand Up @@ -309,23 +299,22 @@ impl<'tcx> MarkerCtx<'tcx> {
);

if let Some(model) = self.has_stub(res.def_id()) {
let MaybeMonomorphized::Monomorphized(instance) = &mut res else {
if let MaybeMonomorphized::Monomorphized(instance) = &mut res {
if let Ok(new_instance) = model.resolve_alternate_instance(
self.tcx(),
*instance,
param_env,
terminator.source_info.span,
) {
v.extend(self.get_reachable_and_self_markers(new_instance));
}
} else {
self.span_err(
terminator.source_info.span,
"Could not apply stub to an partially resolved function",
);
return v.into_iter();
};
if let Ok(new_instance) = model.resolve_alternate_instance(
self.tcx(),
*instance,
param_env,
terminator.source_info.span,
) {
*instance = new_instance;
} else {
return v.into_iter();
}
return v.into_iter();
}

v.extend(self.get_reachable_and_self_markers(res));
Expand Down

0 comments on commit c9707f4

Please sign in to comment.