diff options
| author | Lukas Markeffsky <@> | 2024-02-11 23:26:06 +0100 |
|---|---|---|
| committer | Lukas Markeffsky <@> | 2024-02-12 14:37:35 +0100 |
| commit | 95c5b060004928984b6b76a9ef67a3ca7147568c (patch) | |
| tree | d95a0b55d3ed84033fdfa17c033563a0a53bcc9f /compiler/rustc_hir_analysis/src/autoderef.rs | |
| parent | b17491c8f6d555386104dfd82004c01bfef09c95 (diff) | |
| download | rust-95c5b060004928984b6b76a9ef67a3ca7147568c.tar.gz rust-95c5b060004928984b6b76a9ef67a3ca7147568c.zip | |
fix ICE for deref coercions with type errors
Diffstat (limited to 'compiler/rustc_hir_analysis/src/autoderef.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/autoderef.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_hir_analysis/src/autoderef.rs b/compiler/rustc_hir_analysis/src/autoderef.rs index 5bc904e5930..f2ceb470264 100644 --- a/compiler/rustc_hir_analysis/src/autoderef.rs +++ b/compiler/rustc_hir_analysis/src/autoderef.rs @@ -91,10 +91,6 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> { return None; }; - if new_ty.references_error() { - return None; - } - self.state.steps.push((self.state.cur_ty, kind)); debug!( "autoderef stage #{:?} is {:?} from {:?}", @@ -137,6 +133,10 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> { debug!("overloaded_deref_ty({:?})", ty); let tcx = self.infcx.tcx; + if ty.references_error() { + return None; + } + // <ty as Deref> let trait_ref = ty::TraitRef::new(tcx, tcx.lang_items().deref_trait()?, [ty]); let cause = traits::ObligationCause::misc(self.span, self.body_id); |
