1
Fork 0

Don't call extern_crate when local crate name is the same as a dependency and we have a trait error

This commit is contained in:
Michael Goulet 2024-09-12 09:07:44 -04:00
parent 8d6b88b168
commit 9d5d03b7de
4 changed files with 40 additions and 0 deletions

View file

@ -1669,6 +1669,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let name = self.tcx.crate_name(trait_def_id.krate);
let spans: Vec<_> = [trait_def_id, found_type]
.into_iter()
.filter(|def_id| def_id.krate != LOCAL_CRATE)
.filter_map(|def_id| self.tcx.extern_crate(def_id.krate))
.map(|data| {
let dependency = if data.dependency_of == LOCAL_CRATE {