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`
This commit is contained in:
commit
c430d6111a
@ -21,7 +21,6 @@
|
|||||||
use std::mem;
|
use std::mem;
|
||||||
use std::num::NonZeroUsize;
|
use std::num::NonZeroUsize;
|
||||||
use std::ops::{ControlFlow, Deref};
|
use std::ops::{ControlFlow, Deref};
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
/// An entity in the Rust type system, which can be one of
|
/// An entity in the Rust type system, which can be one of
|
||||||
/// several kinds (types, lifetimes, and consts).
|
/// several kinds (types, lifetimes, and consts).
|
||||||
@ -55,18 +54,6 @@ pub enum GenericArgKind<'tcx> {
|
|||||||
Const(ty::Const<'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> {
|
impl<'tcx> GenericArgKind<'tcx> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn pack(self) -> GenericArg<'tcx> {
|
fn pack(self) -> GenericArg<'tcx> {
|
||||||
|
Loading…
Reference in New Issue
Block a user