Skip to content

Commit d4c721f

Browse files
committed
remove pref_align_of intrinsic
1 parent 1b12d01 commit d4c721f

File tree

6 files changed

+5
-24
lines changed

6 files changed

+5
-24
lines changed

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
821821
dest.write_cvalue(fx, val);
822822
};
823823

824-
pref_align_of | needs_drop | type_id | type_name | variant_count, () {
824+
needs_drop | type_id | type_name | variant_count, () {
825825
let const_val =
826826
fx.tcx.const_eval_instance(ParamEnv::reveal_all(), instance, None).unwrap();
827827
let val = crate::constant::codegen_const_value(

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
103103
bx.const_usize(bx.layout_of(tp_ty).align.abi.bytes())
104104
}
105105
}
106-
sym::pref_align_of
107-
| sym::needs_drop
108-
| sym::type_id
109-
| sym::type_name
110-
| sym::variant_count => {
106+
sym::needs_drop | sym::type_id | sym::type_name | sym::variant_count => {
111107
let value = bx
112108
.tcx()
113109
.const_eval_instance(ty::ParamEnv::reveal_all(), instance, None)

compiler/rustc_const_eval/src/interpret/intrinsics.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ crate fn eval_nullary_intrinsic<'tcx>(
6262
ensure_monomorphic_enough(tcx, tp_ty)?;
6363
ConstValue::from_bool(tp_ty.needs_drop(tcx, param_env))
6464
}
65-
sym::pref_align_of => {
66-
// Correctly handles non-monomorphic calls, so there is no need for ensure_monomorphic_enough.
67-
let layout = tcx.layout_of(param_env.and(tp_ty)).map_err(|e| err_inval!(Layout(e)))?;
68-
ConstValue::from_machine_usize(layout.align.pref.bytes(), &tcx)
69-
}
7065
sym::type_id => {
7166
ensure_monomorphic_enough(tcx, tp_ty)?;
7267
ConstValue::from_u64(tcx.type_id_hash(tp_ty))
@@ -155,14 +150,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
155150
self.write_scalar(Scalar::from_machine_usize(result, self), dest)?;
156151
}
157152

158-
sym::pref_align_of
159-
| sym::needs_drop
160-
| sym::type_id
161-
| sym::type_name
162-
| sym::variant_count => {
153+
sym::needs_drop | sym::type_id | sym::type_name | sym::variant_count => {
163154
let gid = GlobalId { instance, promoted: None };
164155
let ty = match intrinsic_name {
165-
sym::pref_align_of | sym::variant_count => self.tcx.types.usize,
156+
sym::variant_count => self.tcx.types.usize,
166157
sym::needs_drop => self.tcx.types.bool,
167158
sym::type_id => self.tcx.types.u64,
168159
sym::type_name => self.tcx.mk_static_str(),

compiler/rustc_span/src/symbol.rs

-1
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,6 @@ symbols! {
981981
pre_dash_lto: "pre-lto",
982982
precise_pointer_size_matching,
983983
precision,
984-
pref_align_of,
985984
prefetch_read_data,
986985
prefetch_read_instruction,
987986
prefetch_write_data,

compiler/rustc_typeck/src/check/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
164164
sym::abort => (0, Vec::new(), tcx.types.never),
165165
sym::unreachable => (0, Vec::new(), tcx.types.never),
166166
sym::breakpoint => (0, Vec::new(), tcx.mk_unit()),
167-
sym::size_of | sym::pref_align_of | sym::min_align_of | sym::variant_count => {
167+
sym::size_of | sym::min_align_of | sym::variant_count => {
168168
(1, Vec::new(), tcx.types.usize)
169169
}
170170
sym::size_of_val | sym::min_align_of_val => {

library/core/src/intrinsics.rs

-5
Original file line numberDiff line numberDiff line change
@@ -808,11 +808,6 @@ extern "rust-intrinsic" {
808808
/// The stabilized version of this intrinsic is [`core::mem::align_of`].
809809
#[rustc_const_stable(feature = "const_min_align_of", since = "1.40.0")]
810810
pub fn min_align_of<T>() -> usize;
811-
/// The preferred alignment of a type.
812-
///
813-
/// This intrinsic does not have a stable counterpart.
814-
#[rustc_const_unstable(feature = "const_pref_align_of", issue = "none")]
815-
pub fn pref_align_of<T>() -> usize;
816811

817812
/// The size of the referenced value in bytes.
818813
///

0 commit comments

Comments
 (0)