diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-20 17:59:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-20 17:59:55 +0200 |
| commit | c430d6111a9c607bc7371112135d3209a8ed2028 (patch) | |
| tree | ef2832a5a0475b7e7f9bb34152d76b09ddc38cd0 | |
| parent | 9f3929551724742c7637553e0fe7ccc0031615c9 (diff) | |
| parent | 6d4b7fe9ed055c086c7843c9ce07c1a5a19e245b (diff) | |
| download | rust-c430d6111a9c607bc7371112135d3209a8ed2028.tar.gz rust-c430d6111a9c607bc7371112135d3209a8ed2028.zip | |
Rollup merge of #110599 - WaffleLapkin:bonk_tygenericarg_transmutes, r=compiler-errors
Remove an unused `&[Ty]` <-> `&[GenericArg]` Missed this one in #110496, oops. r? `@compiler-errors`
| -rw-r--r-- | compiler/rustc_middle/src/ty/subst.rs | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/compiler/rustc_middle/src/ty/subst.rs b/compiler/rustc_middle/src/ty/subst.rs index 3e1b0706f66..73c9c86f76a 100644 --- a/compiler/rustc_middle/src/ty/subst.rs +++ b/compiler/rustc_middle/src/ty/subst.rs @@ -21,7 +21,6 @@ use std::marker::PhantomData; use std::mem; use std::num::NonZeroUsize; use std::ops::{ControlFlow, Deref}; -use std::slice; /// An entity in the Rust type system, which can be one of /// several kinds (types, lifetimes, and consts). @@ -55,18 +54,6 @@ pub enum GenericArgKind<'tcx> { Const(ty::Const<'tcx>), } -/// This function goes from `&'a [Ty<'tcx>]` to `&'a [GenericArg<'tcx>]` -/// -/// This is sound as, for types, `GenericArg` is just -/// `NonZeroUsize::new_unchecked(ty as *const _ as usize)` as -/// long as we use `0` for the `TYPE_TAG`. -pub fn ty_slice_as_generic_args<'a, 'tcx>(ts: &'a [Ty<'tcx>]) -> &'a [GenericArg<'tcx>] { - assert_eq!(TYPE_TAG, 0); - // SAFETY: the whole slice is valid and immutable. - // `Ty` and `GenericArg` is explained above. - unsafe { slice::from_raw_parts(ts.as_ptr().cast(), ts.len()) } -} - impl<'tcx> GenericArgKind<'tcx> { #[inline] fn pack(self) -> GenericArg<'tcx> { |
