Skip to content

Commit 5e4f400

Browse files
authored
Unrolled build for #150886
Rollup merge of #150886 - mgca-test, r=BoxyUwU Added mGCA related tests Add regression tests for subsequent mGCA tasks edit: resolve: #147415 `tests\ui\const-generics\mgca\size-of-generic-ptr-in-array-len.rs` resolve: #141014 `tests\ui\const-generics\mgca\assoc-const-projection-in-bound.rs` and crashes: 138226, 138226-2, 149809, 150960
2 parents 2b112ef + 6166b61 commit 5e4f400

File tree

7 files changed

+103
-0
lines changed

7 files changed

+103
-0
lines changed

tests/crashes/138226-2.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ known-bug: #138226
2+
//@ needs-rustc-debug-assertions
3+
#![feature(min_generic_const_args)]
4+
#![feature(inherent_associated_types)]
5+
struct Bar<const N: usize>;
6+
impl<const N: usize> Bar<N> {
7+
#[type_const]
8+
const LEN: usize = 4;
9+
10+
fn bar() {
11+
let _ = [0; Self::LEN];
12+
}
13+
}

tests/crashes/138226.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ known-bug: #138226
2+
//@ needs-rustc-debug-assertions
3+
#![feature(min_generic_const_args)]
4+
#![feature(inherent_associated_types)]
5+
struct Foo<A, B>(A, B);
6+
impl<A, B> Foo<A, B> {
7+
#[type_const]
8+
const LEN: usize = 4;
9+
10+
fn foo() {
11+
let _ = [5; Self::LEN];
12+
}
13+
}

tests/crashes/149809.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ known-bug: #149809
2+
#![feature(min_generic_const_args)]
3+
#![feature(inherent_associated_types)]
4+
struct Qux<'a> {
5+
x: &'a (),
6+
}
7+
impl<'a> Qux<'a> {
8+
#[type_const]
9+
const LEN: usize = 4;
10+
fn foo(_: [u8; Qux::LEN]) {}
11+
}
12+
13+
fn main() {}

tests/crashes/150960.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ known-bug: #150960
2+
#![feature(min_generic_const_args)]
3+
struct Baz;
4+
impl Baz {
5+
#[type_const]
6+
const LEN: usize = 4;
7+
8+
fn baz() {
9+
let _ = [0; const { Self::LEN }];
10+
}
11+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! regression test for <https://github.com/rust-lang/rust/issues/141014>
2+
//@ run-pass
3+
#![expect(incomplete_features)]
4+
#![feature(min_generic_const_args)]
5+
#![allow(dead_code)]
6+
7+
trait Abc {}
8+
9+
trait A {
10+
#[type_const]
11+
const VALUE: usize;
12+
}
13+
14+
impl<T: Abc> A for T {
15+
#[type_const]
16+
const VALUE: usize = 0;
17+
}
18+
19+
trait S<const K: usize> {}
20+
21+
trait Handler<T: Abc>
22+
where
23+
(): S<{ <T as A>::VALUE }>,
24+
{
25+
}
26+
27+
fn main() {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! regression test for <https://github.com/rust-lang/rust/issues/147415>
2+
#![expect(incomplete_features)]
3+
#![feature(min_generic_const_args)]
4+
5+
fn foo<T>() {
6+
[0; size_of::<*mut T>()];
7+
//~^ ERROR: tuple constructor with invalid base path
8+
[0; const { size_of::<*mut T>() }];
9+
//~^ ERROR: generic parameters may not be used in const operations
10+
}
11+
12+
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: tuple constructor with invalid base path
2+
--> $DIR/size-of-generic-ptr-in-array-len.rs:6:9
3+
|
4+
LL | [0; size_of::<*mut T>()];
5+
| ^^^^^^^^^^^^^^^^^^^
6+
7+
error: generic parameters may not be used in const operations
8+
--> $DIR/size-of-generic-ptr-in-array-len.rs:8:32
9+
|
10+
LL | [0; const { size_of::<*mut T>() }];
11+
| ^
12+
13+
error: aborting due to 2 previous errors
14+

0 commit comments

Comments
 (0)