diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-11-24 11:08:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-24 11:08:19 +0100 |
| commit | 5d1c99275d479df7e288bc2eb08826ea9ee10614 (patch) | |
| tree | 02ad8223a88dc0cab66cf27922932c0b43db504e /compiler/rustc_middle/src | |
| parent | 3c52c9b483f55596e6579a125b7087a5e7e506e1 (diff) | |
| parent | bd00de7123e73d745d643663d856e3dc618adf89 (diff) | |
Rollup merge of #133371 - RalfJung:is_trivially_const_drop, r=compiler-errors
remove is_trivially_const_drop I'm not sure this still brings any perf benefits, so let's benchmark this. r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/util.rs | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index 4cde2738319..55a7a837b6d 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -1672,45 +1672,6 @@ pub fn needs_drop_components_with_async<'tcx>( } } -pub fn is_trivially_const_drop(ty: Ty<'_>) -> bool { - match *ty.kind() { - ty::Bool - | ty::Char - | ty::Int(_) - | ty::Uint(_) - | ty::Float(_) - | ty::Infer(ty::IntVar(_)) - | ty::Infer(ty::FloatVar(_)) - | ty::Str - | ty::RawPtr(_, _) - | ty::Ref(..) - | ty::FnDef(..) - | ty::FnPtr(..) - | ty::Never - | ty::Foreign(_) => true, - - ty::Alias(..) - | ty::Dynamic(..) - | ty::Error(_) - | ty::Bound(..) - | ty::Param(_) - | ty::Placeholder(_) - | ty::Infer(_) => false, - - // Not trivial because they have components, and instead of looking inside, - // we'll just perform trait selection. - ty::Closure(..) - | ty::CoroutineClosure(..) - | ty::Coroutine(..) - | ty::CoroutineWitness(..) - | ty::Adt(..) => false, - - ty::Array(ty, _) | ty::Slice(ty) | ty::Pat(ty, _) => is_trivially_const_drop(ty), - - ty::Tuple(tys) => tys.iter().all(|ty| is_trivially_const_drop(ty)), - } -} - /// Does the equivalent of /// ```ignore (illustrative) /// let v = self.iter().map(|p| p.fold_with(folder)).collect::<SmallVec<[_; 8]>>(); |
