Skip to content

Commit 3645249

Browse files
committed
Auto merge of #153952 - JonathanBrouwer:rollup-WGd5m6M, r=JonathanBrouwer
Rollup of 2 pull requests Successful merges: - #153359 (Gate `ConstParamTy_` trait behind `const_param_ty_trait` feature) - #153505 (tests: accept new GEP source element type)
2 parents ec15ca9 + 902473b commit 3645249

30 files changed

Lines changed: 81 additions & 34 deletions

library/core/src/marker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use crate::pin::UnsafePinned;
5454
/// ```
5555
#[unstable(feature = "internal_impls_macro", issue = "none")]
5656
// Allow implementations of `UnsizedConstParamTy` even though std cannot use that feature.
57-
#[allow_internal_unstable(unsized_const_params)]
57+
#[allow_internal_unstable(const_param_ty_trait)]
5858
macro marker_impls {
5959
( $(#[$($meta:tt)*])* $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => {
6060
$(#[$($meta)*])* impl< $($($bounds)*)? > $Trait for $T {}
@@ -1080,7 +1080,7 @@ pub trait Tuple {}
10801080
/// that all fields are also `ConstParamTy`, which implies that recursively, all fields
10811081
/// are `StructuralPartialEq`.
10821082
#[lang = "const_param_ty"]
1083-
#[unstable(feature = "unsized_const_params", issue = "95174")]
1083+
#[unstable(feature = "const_param_ty_trait", issue = "95174", implied_by = "unsized_const_params")]
10841084
#[diagnostic::on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
10851085
#[allow(multiple_supertrait_upcastable)]
10861086
// We name this differently than the derive macro so that the `adt_const_params` can
@@ -1090,7 +1090,7 @@ pub trait ConstParamTy_: StructuralPartialEq + Eq {}
10901090

10911091
/// Derive macro generating an impl of the trait `ConstParamTy`.
10921092
#[rustc_builtin_macro]
1093-
#[allow_internal_unstable(unsized_const_params)]
1093+
#[allow_internal_unstable(const_param_ty_trait)]
10941094
#[unstable(feature = "adt_const_params", issue = "95174")]
10951095
pub macro ConstParamTy($item:item) {
10961096
/* compiler built-in */

tests/codegen-llvm/gep-index.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ struct Foo(i32, i32);
1111
// CHECK-LABEL: @index_on_struct(
1212
#[no_mangle]
1313
fn index_on_struct(a: &[Foo], index: usize) -> &Foo {
14-
// CHECK: getelementptr inbounds{{( nuw)?}} %Foo, ptr %a.0, {{i64|i32}} %index
14+
// CHECK: getelementptr inbounds{{( nuw)?}} {{%Foo|\[8 x i8\]}}, ptr %a.0, {{i64|i32}} %index
1515
&a[index]
1616
}
1717

1818
// CHECK-LABEL: @offset_on_struct(
1919
#[no_mangle]
2020
fn offset_on_struct(a: *const Foo, index: usize) -> *const Foo {
21-
// CHECK: getelementptr inbounds{{( nuw)?}} %Foo, ptr %a, {{i64|i32}} %index
21+
// CHECK: getelementptr inbounds{{( nuw)?}} {{%Foo|\[8 x i8\]}}, ptr %a, {{i64|i32}} %index
2222
unsafe { a.add(index) }
2323
}
2424

2525
// CHECK-LABEL: @index_on_i32(
2626
#[no_mangle]
2727
fn index_on_i32(a: &[i32], index: usize) -> &i32 {
28-
// CHECK: getelementptr inbounds{{( nuw)?}} i32, ptr %a.0, {{i64|i32}} %index
28+
// CHECK: getelementptr inbounds{{( nuw)?}} {{i32|\[4 x i8\]}}, ptr %a.0, {{i64|i32}} %index
2929
&a[index]
3030
}
3131

3232
// CHECK-LABEL: @offset_on_i32(
3333
#[no_mangle]
3434
fn offset_on_i32(a: *const i32, index: usize) -> *const i32 {
35-
// CHECK: getelementptr inbounds{{( nuw)?}} i32, ptr %a, {{i64|i32}} %index
35+
// CHECK: getelementptr inbounds{{( nuw)?}} {{i32|\[4 x i8\]}}, ptr %a, {{i64|i32}} %index
3636
unsafe { a.add(index) }
3737
}

tests/codegen-llvm/issues/issue-118306.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn branchy(input: u64) -> u64 {
1111
// CHECK-LABEL: @branchy(
1212
// CHECK-NEXT: start:
1313
// CHECK-NEXT: [[_2:%.*]] = and i64 [[INPUT:%.*]], 3
14-
// CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds{{( nuw)?}} {{\[4 x i64\]|i64}}, ptr @switch.table.branchy{{(, i64 0)?}}, i64 [[_2]]
14+
// CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds{{( nuw)?}} {{\[4 x i64\]|i64|\[8 x i8\]}}, ptr @switch.table.branchy{{(, i64 0)?}}, i64 [[_2]]
1515
// CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i64, ptr [[SWITCH_GEP]]
1616
// CHECK-NEXT: ret i64 [[SWITCH_LOAD]]
1717
match input % 4 {

tests/codegen-llvm/ptr-arithmetic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// CHECK-SAME: [[WORD:i[0-9]+]] noundef %n)
77
#[no_mangle]
88
pub unsafe fn i32_add(p: *const i32, n: usize) -> *const i32 {
9-
// CHECK: %[[TEMP:.+]] = getelementptr inbounds{{( nuw)?}} i32, ptr %p, [[WORD]] %n
9+
// CHECK: %[[TEMP:.+]] = getelementptr inbounds{{( nuw)?}} {{i32|\[4 x i8\]}}, ptr %p, [[WORD]] %n
1010
// CHECK: ret ptr %[[TEMP]]
1111
p.add(n)
1212
}
@@ -18,7 +18,7 @@ pub unsafe fn i32_add(p: *const i32, n: usize) -> *const i32 {
1818
#[no_mangle]
1919
pub unsafe fn i32_sub(p: *const i32, n: usize) -> *const i32 {
2020
// CHECK: %[[DELTA:.+]] = sub nsw [[WORD]] 0, %n
21-
// CHECK: %[[TEMP:.+]] = getelementptr inbounds i32, ptr %p, [[WORD]] %[[DELTA]]
21+
// CHECK: %[[TEMP:.+]] = getelementptr inbounds {{i32|\[4 x i8\]}}, ptr %p, [[WORD]] %[[DELTA]]
2222
// CHECK: ret ptr %[[TEMP]]
2323
p.sub(n)
2424
}
@@ -27,7 +27,7 @@ pub unsafe fn i32_sub(p: *const i32, n: usize) -> *const i32 {
2727
// CHECK-SAME: [[WORD:i[0-9]+]] noundef %d)
2828
#[no_mangle]
2929
pub unsafe fn i32_offset(p: *const i32, d: isize) -> *const i32 {
30-
// CHECK: %[[TEMP:.+]] = getelementptr inbounds i32, ptr %p, [[WORD]] %d
30+
// CHECK: %[[TEMP:.+]] = getelementptr inbounds {{i32|\[4 x i8\]}}, ptr %p, [[WORD]] %d
3131
// CHECK: ret ptr %[[TEMP]]
3232
p.offset(d)
3333
}

tests/codegen-llvm/slice-iter-nonnull.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn slice_iter_next_back<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'
5555
#[no_mangle]
5656
pub fn slice_iter_new(slice: &[u32]) -> std::slice::Iter<'_, u32> {
5757
// CHECK-NOT: slice
58-
// CHECK: %[[END:.+]] = getelementptr inbounds{{( nuw)?}} i32{{.+}} %slice.0{{.+}} %slice.1
58+
// CHECK: %[[END:.+]] = getelementptr inbounds{{( nuw)?}} {{i32|\[4 x i8\]}}{{.+}} %slice.0{{.+}} %slice.1
5959
// CHECK-NOT: slice
6060
// CHECK: insertvalue {{.+}} ptr %slice.0, 0
6161
// CHECK-NOT: slice
@@ -70,7 +70,7 @@ pub fn slice_iter_new(slice: &[u32]) -> std::slice::Iter<'_, u32> {
7070
#[no_mangle]
7171
pub fn slice_iter_mut_new(slice: &mut [u32]) -> std::slice::IterMut<'_, u32> {
7272
// CHECK-NOT: slice
73-
// CHECK: %[[END:.+]] = getelementptr inbounds{{( nuw)?}} i32{{.+}} %slice.0{{.+}} %slice.1
73+
// CHECK: %[[END:.+]] = getelementptr inbounds{{( nuw)?}} {{i32|\[4 x i8\]}}{{.+}} %slice.0{{.+}} %slice.1
7474
// CHECK-NOT: slice
7575
// CHECK: insertvalue {{.+}} ptr %slice.0, 0
7676
// CHECK-NOT: slice

tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(incomplete_features)]
2-
#![feature(adt_const_params, unsized_const_params)]
2+
#![feature(adt_const_params, const_param_ty_trait)]
33

44
#[derive(PartialEq, Eq)]
55
struct NotParam;

tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(adt_const_params, unsized_const_params)]
1+
#![feature(adt_const_params, const_param_ty_trait)]
22
#![allow(incomplete_features)]
33

44
use std::marker::ConstParamTy_;

tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(incomplete_features)]
2-
#![feature(adt_const_params, unsized_const_params)]
2+
#![feature(adt_const_params, const_param_ty_trait)]
33

44
#[derive(PartialEq, Eq)]
55
struct NotParam;

tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(incomplete_features)]
2-
#![feature(adt_const_params, unsized_const_params)]
2+
#![feature(adt_const_params, const_param_ty_trait)]
33

44
#[derive(PartialEq, Eq)]
55
struct NotParam;

tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(incomplete_features)]
2-
#![feature(adt_const_params, unsized_const_params)]
2+
#![feature(adt_const_params, const_param_ty_trait)]
33

44
#[derive(PartialEq, Eq)]
55
struct ImplementsConstParamTy;

0 commit comments

Comments
 (0)