diff options
| author | bors <bors@rust-lang.org> | 2024-03-07 15:02:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-07 15:02:36 +0000 |
| commit | 1c580bcb703d2ba288c380d2e283451a34d4eb1c (patch) | |
| tree | 3a3b6d9775fdafc5548004739b923c2b66f205a9 /compiler/rustc_hir_analysis/src/coherence/builtin.rs | |
| parent | 52f8aec14c616387c5f793687f2d9026de6c78ca (diff) | |
| parent | ce9a6adba90a80b1642d55931006a52bde4e0c3f (diff) | |
| download | rust-1c580bcb703d2ba288c380d2e283451a34d4eb1c.tar.gz rust-1c580bcb703d2ba288c380d2e283451a34d4eb1c.zip | |
Auto merge of #122139 - GuillaumeGomez:rollup-37vtwsc, r=GuillaumeGomez
Rollup of 10 pull requests Successful merges: - #121863 (silence mismatched types errors for implied projections) - #122043 (Apply `EarlyBinder` only to `TraitRef` in `ImplTraitHeader`) - #122066 (Add proper cfgs for struct HirIdValidator used only with debug-assert) - #122104 (Rust is a proper name: rust → Rust) - #122110 (Make `x t miri` respect `MIRI_TEMP`) - #122114 (Make not finding core a fatal error) - #122115 (Cancel parsing ever made during recovery) - #122123 (Don't require specifying unrelated assoc types when trait alias is in `dyn` type) - #122126 (Fix `tidy --bless` on ̶X̶e̶n̶i̶x̶ Windows) - #122129 (Set `RustcDocs` to only run on host) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_hir_analysis/src/coherence/builtin.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/coherence/builtin.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index 6c3a9b747ef..8d8b13d6cb3 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -25,7 +25,7 @@ use rustc_trait_selection::traits::ObligationCtxt; use rustc_trait_selection::traits::{self, ObligationCause}; use std::collections::BTreeMap; -pub fn check_trait<'tcx>( +pub(super) fn check_trait<'tcx>( tcx: TyCtxt<'tcx>, trait_def_id: DefId, impl_def_id: LocalDefId, @@ -66,10 +66,9 @@ impl<'tcx> Checker<'tcx> { fn visit_implementation_of_drop(checker: &Checker<'_>) -> Result<(), ErrorGuaranteed> { let tcx = checker.tcx; - let header = checker.impl_header; let impl_did = checker.impl_def_id; // Destructors only work on local ADT types. - match header.trait_ref.self_ty().kind() { + match checker.impl_header.trait_ref.instantiate_identity().self_ty().kind() { ty::Adt(def, _) if def.did().is_local() => return Ok(()), ty::Error(_) => return Ok(()), _ => {} @@ -86,7 +85,7 @@ fn visit_implementation_of_copy(checker: &Checker<'_>) -> Result<(), ErrorGuaran let impl_did = checker.impl_def_id; debug!("visit_implementation_of_copy: impl_did={:?}", impl_did); - let self_type = impl_header.trait_ref.self_ty(); + let self_type = impl_header.trait_ref.instantiate_identity().self_ty(); debug!("visit_implementation_of_copy: self_type={:?} (bound)", self_type); let param_env = tcx.param_env(impl_did); @@ -120,7 +119,7 @@ fn visit_implementation_of_const_param_ty(checker: &Checker<'_>) -> Result<(), E let tcx = checker.tcx; let header = checker.impl_header; let impl_did = checker.impl_def_id; - let self_type = header.trait_ref.self_ty(); + let self_type = header.trait_ref.instantiate_identity().self_ty(); assert!(!self_type.has_escaping_bound_vars()); let param_env = tcx.param_env(impl_did); @@ -157,9 +156,8 @@ fn visit_implementation_of_coerce_unsized(checker: &Checker<'_>) -> Result<(), E fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<(), ErrorGuaranteed> { let tcx = checker.tcx; - let header = checker.impl_header; let impl_did = checker.impl_def_id; - let trait_ref = header.trait_ref; + let trait_ref = checker.impl_header.trait_ref.instantiate_identity(); debug!("visit_implementation_of_dispatch_from_dyn: impl_did={:?}", impl_did); let span = tcx.def_span(impl_did); |
