Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8a08020

Browse files
committed
exhaustive matches are good
1 parent 55be59d commit 8a08020

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

compiler/rustc_ty_utils/src/needs_drop.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,31 @@ where
172172
queue_type(self, component);
173173
}
174174
}
175-
_ => return Some(Err(AlwaysRequiresDrop)),
175+
176+
ty::Foreign(_) | ty::Dynamic(..) | ty::Placeholder(_) => {
177+
return Some(Err(AlwaysRequiresDrop));
178+
}
179+
180+
ty::Bool
181+
| ty::Char
182+
| ty::Int(_)
183+
| ty::Uint(_)
184+
| ty::Float(_)
185+
| ty::Str
186+
| ty::Slice(_)
187+
| ty::Ref(..)
188+
| ty::RawPtr(..)
189+
| ty::FnDef(..)
190+
| ty::FnPtr(..)
191+
| ty::Tuple(_)
192+
| ty::Bound(..)
193+
| ty::GeneratorWitness(..)
194+
| ty::GeneratorWitnessMIR(..)
195+
| ty::Never
196+
| ty::Infer(_)
197+
| ty::Error(_) => {
198+
bug!("unexpected type returned by `needs_drop_components`: {component}")
199+
}
176200
}
177201
}
178202
}

0 commit comments

Comments
 (0)