diff options
| author | bors <bors@rust-lang.org> | 2022-11-17 07:42:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-17 07:42:27 +0000 |
| commit | 7c75fe4c8547c276574cacb144919d67fd8ab302 (patch) | |
| tree | 402e39583de6ba02374087e2db67f01dc9e52d90 /compiler/rustc_trait_selection/src/traits | |
| parent | 9340e5c1b9dee53fd32a18f7bfb54faabfe00b7b (diff) | |
| parent | df5c11a069fbee34c3d2cae8b7b9c8e026b63d39 (diff) | |
| download | rust-7c75fe4c8547c276574cacb144919d67fd8ab302.tar.gz rust-7c75fe4c8547c276574cacb144919d67fd8ab302.zip | |
Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-dead
Record `LocalDefId` in HIR nodes instead of a side table This is part of an attempt to remove the `HirId -> LocalDefId` table from HIR. This attempt is a prerequisite to creation of `LocalDefId` after HIR lowering (https://github.com/rust-lang/rust/pull/96840), by controlling how `def_id` information is accessed. This first part adds the information to HIR nodes themselves instead of a table. The second part is https://github.com/rust-lang/rust/pull/103902 The third part will be to make `hir::Visitor::visit_fn` take a `LocalDefId` as last parameter. The fourth part will be to completely remove the side table.
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 41b252a8265..786cadaa6ce 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -2592,11 +2592,10 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let Some(param) = generics.params.iter().find(|param| param.span == span) else { return; }; - let param_def_id = self.tcx.hir().local_def_id(param.hir_id); // Check that none of the explicit trait bounds is `Sized`. Assume that an explicit // `Sized` bound is there intentionally and we don't need to suggest relaxing it. let explicitly_sized = generics - .bounds_for_param(param_def_id) + .bounds_for_param(param.def_id) .flat_map(|bp| bp.bounds) .any(|bound| bound.trait_ref().and_then(|tr| tr.trait_def_id()) == sized_trait); if explicitly_sized { @@ -2619,7 +2618,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { _ => {} }; // Didn't add an indirection suggestion, so add a general suggestion to relax `Sized`. - let (span, separator) = if let Some(s) = generics.bounds_span_for_suggestions(param_def_id) + let (span, separator) = if let Some(s) = generics.bounds_span_for_suggestions(param.def_id) { (s, " +") } else { |
