diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-17 17:28:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-17 17:28:33 +0200 |
| commit | 62f2ec9b59792126c813a46280228436a4f3aa35 (patch) | |
| tree | 362f31cb78e660486a2d8e1fbaa81764942fc249 /compiler/rustc_trait_selection/src | |
| parent | ddcb9c132a505c5c5ad9ec3d5eb488f739584774 (diff) | |
| parent | 9d5d03b7dec8a87c81528e9a1310313fa3f0111e (diff) | |
| download | rust-62f2ec9b59792126c813a46280228436a4f3aa35.tar.gz rust-62f2ec9b59792126c813a46280228436a4f3aa35.zip | |
Rollup merge of #130275 - compiler-errors:extern-crate, r=lcnr
Don't call `extern_crate` when local crate name is the same as a dependency and we have a trait error #124944 implemented logic to point out when a trait bound failure involves a *trait* and *type* who come from identically named but different crates. This logic calls the `extern_crate` query which is not valid on `LOCAL_CRATE` cnum, so let's filter that out eagerly. Fixes #130272 Fixes #129184
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 5918686213a..85a6ef5caab 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -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 { |
