1
Fork 0

Use resolutions(()).effective_visiblities to avoid cycle errors

This commit is contained in:
Michael Goulet 2024-01-04 01:48:39 +00:00
parent 6bc08a725f
commit 6a2bd5acd6
3 changed files with 110 additions and 1 deletions

View file

@ -132,7 +132,10 @@ pub fn report_object_safety_error<'tcx>(
};
let externally_visible = if !impls.is_empty()
&& let Some(def_id) = trait_def_id.as_local()
&& tcx.effective_visibilities(()).is_exported(def_id)
// We may be executing this during typeck, which would result in cycle
// if we used effective_visibilities query, which looks into opaque types
// (and therefore calls typeck).
&& tcx.resolutions(()).effective_visibilities.is_exported(def_id)
{
true
} else {