about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/autoderef.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-23 20:43:38 +0000
committerbors <bors@rust-lang.org>2024-01-23 20:43:38 +0000
commit5d3d3479d774754856db2db3e439dfb88ef3c52f (patch)
treec1fb20b5e72855a5a638b349d6c69ba76ae1a0fd /compiler/rustc_hir_analysis/src/autoderef.rs
parentdfe53afaebd817f334d8ef9dc75a5cd2562cf6e6 (diff)
parent08bac31f8f95a9cf2bdcbecfb65ca8de5b644699 (diff)
downloadrust-5d3d3479d774754856db2db3e439dfb88ef3c52f.tar.gz
rust-5d3d3479d774754856db2db3e439dfb88ef3c52f.zip
Auto merge of #120281 - fmease:rollup-9nxail8, r=fmease
Rollup of 10 pull requests

Successful merges:

 - #119028 (Add more weirdness to weird-exprs.rs)
 - #119805 (Suggest array::from_fn for array initialization)
 - #120188 (compiler: update freebsd and netbsd base specs.)
 - #120215 (Update some deps with `bitflags` v1 dependencies)
 - #120244 (Use `Self` in `NonZero*` implementations.)
 - #120246 (Re-add estebank to review rotation)
 - #120252 (rename `RawTy` to `LoweredTy`)
 - #120255 (correct my mailmap entry)
 - #120270 (A bunch of random modifications)
 - #120280 (Move condition enabling the pass to `is_enabled`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_hir_analysis/src/autoderef.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/autoderef.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/autoderef.rs b/compiler/rustc_hir_analysis/src/autoderef.rs
index 556560945e9..5bc904e5930 100644
--- a/compiler/rustc_hir_analysis/src/autoderef.rs
+++ b/compiler/rustc_hir_analysis/src/autoderef.rs
@@ -12,7 +12,9 @@ use rustc_trait_selection::traits::StructurallyNormalizeExt;
 
 #[derive(Copy, Clone, Debug)]
 pub enum AutoderefKind {
+    /// A true pointer type, such as `&T` and `*mut T`.
     Builtin,
+    /// A type which must dispatch to a `Deref` implementation.
     Overloaded,
 }
 
@@ -83,6 +85,7 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
                 (AutoderefKind::Builtin, ty)
             }
         } else if let Some(ty) = self.overloaded_deref_ty(self.state.cur_ty) {
+            // The overloaded deref check already normalizes the pointee type.
             (AutoderefKind::Overloaded, ty)
         } else {
             return None;