Skip to content

Commit fe5a925

Browse files
authored
Merge pull request #19984 from WaffleLapkin/unprefer_align
remove `pref_align_of` intrinsic handling, rename `{min_=>}align_of{,_val}`
2 parents a497f41 + cfc416a commit fe5a925

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

crates/hir-ty/src/consteval/tests/intrinsics.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,28 +112,28 @@ fn size_of_val() {
112112
}
113113

114114
#[test]
115-
fn min_align_of_val() {
115+
fn align_of_val() {
116116
check_number(
117117
r#"
118118
//- minicore: coerce_unsized
119119
#[rustc_intrinsic]
120-
pub fn min_align_of_val<T: ?Sized>(_: *const T) -> usize;
120+
pub fn align_of_val<T: ?Sized>(_: *const T) -> usize;
121121
122122
struct X(i32, u8);
123123
124-
const GOAL: usize = min_align_of_val(&X(1, 2));
124+
const GOAL: usize = align_of_val(&X(1, 2));
125125
"#,
126126
4,
127127
);
128128
check_number(
129129
r#"
130130
//- minicore: coerce_unsized
131131
#[rustc_intrinsic]
132-
pub fn min_align_of_val<T: ?Sized>(_: *const T) -> usize;
132+
pub fn align_of_val<T: ?Sized>(_: *const T) -> usize;
133133
134134
const GOAL: usize = {
135135
let x: &[i32] = &[1, 2, 3];
136-
min_align_of_val(x)
136+
align_of_val(x)
137137
};
138138
"#,
139139
4,

crates/hir-ty/src/mir/eval/shim.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,9 @@ impl Evaluator<'_> {
761761
let size = self.size_of_sized(ty, locals, "size_of arg")?;
762762
destination.write_from_bytes(self, &size.to_le_bytes()[0..destination.size])
763763
}
764-
"min_align_of" | "pref_align_of" => {
764+
// FIXME: `min_align_of` was renamed to `align_of` in Rust 1.89
765+
// (https://github.com/rust-lang/rust/pull/142410)
766+
"min_align_of" | "align_of" => {
765767
let Some(ty) =
766768
generic_args.as_slice(Interner).first().and_then(|it| it.ty(Interner))
767769
else {
@@ -793,17 +795,19 @@ impl Evaluator<'_> {
793795
destination.write_from_bytes(self, &size.to_le_bytes())
794796
}
795797
}
796-
"min_align_of_val" => {
798+
// FIXME: `min_align_of_val` was renamed to `align_of_val` in Rust 1.89
799+
// (https://github.com/rust-lang/rust/pull/142410)
800+
"min_align_of_val" | "align_of_val" => {
797801
let Some(ty) =
798802
generic_args.as_slice(Interner).first().and_then(|it| it.ty(Interner))
799803
else {
800804
return Err(MirEvalError::InternalError(
801-
"min_align_of_val generic arg is not provided".into(),
805+
"align_of_val generic arg is not provided".into(),
802806
));
803807
};
804808
let [arg] = args else {
805809
return Err(MirEvalError::InternalError(
806-
"min_align_of_val args are not provided".into(),
810+
"align_of_val args are not provided".into(),
807811
));
808812
};
809813
if let Some((_, align)) = self.size_align_of(ty, locals)? {

0 commit comments

Comments
 (0)