about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2023-07-17 15:11:07 +0200
committerlcnr <rust@lcnr.de>2023-07-17 15:12:21 +0200
commit8a0802089cf057826e057476c2ad184091d88e22 (patch)
tree2298e04035974211cb7a000b918fa81b64aeffbc
parent55be59d2cefe33529a07b0e011384658c9240035 (diff)
downloadrust-8a0802089cf057826e057476c2ad184091d88e22.tar.gz
rust-8a0802089cf057826e057476c2ad184091d88e22.zip
exhaustive matches are good
-rw-r--r--compiler/rustc_ty_utils/src/needs_drop.rs26
1 files changed, 25 insertions, 1 deletions
diff --git a/compiler/rustc_ty_utils/src/needs_drop.rs b/compiler/rustc_ty_utils/src/needs_drop.rs
index 3e6dfc1304f..cc19b101fe3 100644
--- a/compiler/rustc_ty_utils/src/needs_drop.rs
+++ b/compiler/rustc_ty_utils/src/needs_drop.rs
@@ -172,7 +172,31 @@ where
                             queue_type(self, component);
                         }
                     }
-                    _ => return Some(Err(AlwaysRequiresDrop)),
+
+                    ty::Foreign(_) | ty::Dynamic(..) | ty::Placeholder(_) => {
+                        return Some(Err(AlwaysRequiresDrop));
+                    }
+
+                    ty::Bool
+                    | ty::Char
+                    | ty::Int(_)
+                    | ty::Uint(_)
+                    | ty::Float(_)
+                    | ty::Str
+                    | ty::Slice(_)
+                    | ty::Ref(..)
+                    | ty::RawPtr(..)
+                    | ty::FnDef(..)
+                    | ty::FnPtr(..)
+                    | ty::Tuple(_)
+                    | ty::Bound(..)
+                    | ty::GeneratorWitness(..)
+                    | ty::GeneratorWitnessMIR(..)
+                    | ty::Never
+                    | ty::Infer(_)
+                    | ty::Error(_) => {
+                        bug!("unexpected type returned by `needs_drop_components`: {component}")
+                    }
                 }
             }
         }