Skip to content

Commit 93da9d7

Browse files
authored
Rollup merge of #69966 - JohnTitor:more-more-tests, r=Centril
Add more regression tests Closes #58490, closes #60390, closes #62504, closes #67739, closes #69092 r? @Centril
2 parents f2af2cf + 7c987eb commit 93da9d7

File tree

9 files changed

+128
-0
lines changed

9 files changed

+128
-0
lines changed

src/test/ui/asm/issue-69092.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// build-fail
2+
// ignore-emscripten no asm! support
3+
// Regression test for #69092
4+
5+
#![feature(asm)]
6+
7+
fn main() {
8+
unsafe { asm!(".ascii \"Xen\0\""); }
9+
//~^ ERROR: <inline asm>:1:9: error: expected string in '.ascii' directive
10+
}

src/test/ui/asm/issue-69092.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: <inline asm>:1:9: error: expected string in '.ascii' directive
2+
.ascii "Xen
3+
^
4+
5+
--> $DIR/issue-69092.rs:8:14
6+
|
7+
LL | unsafe { asm!(".ascii \"Xen\0\""); }
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
9+
10+
error: aborting due to previous error
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Regression test for #62504
2+
3+
#![feature(const_generics)]
4+
#![allow(incomplete_features)]
5+
6+
trait HasSize {
7+
const SIZE: usize;
8+
}
9+
10+
impl<const X: usize> HasSize for ArrayHolder<{ X }> {
11+
const SIZE: usize = X;
12+
}
13+
14+
struct ArrayHolder<const X: usize>([u32; X]);
15+
16+
impl<const X: usize> ArrayHolder<{ X }> {
17+
pub const fn new() -> Self {
18+
ArrayHolder([0; Self::SIZE])
19+
//~^ ERROR: array lengths can't depend on generic parameters
20+
}
21+
}
22+
23+
fn main() {
24+
let mut array = ArrayHolder::new();
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: array lengths can't depend on generic parameters
2+
--> $DIR/issue-62504.rs:18:25
3+
|
4+
LL | ArrayHolder([0; Self::SIZE])
5+
| ^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Regression test for #67739
2+
3+
#![allow(incomplete_features)]
4+
#![feature(const_generics)]
5+
6+
use std::mem;
7+
8+
pub trait Trait {
9+
type Associated: Sized;
10+
11+
fn associated_size(&self) -> usize {
12+
[0u8; mem::size_of::<Self::Associated>()];
13+
//~^ ERROR: array lengths can't depend on generic parameters
14+
0
15+
}
16+
}
17+
18+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: array lengths can't depend on generic parameters
2+
--> $DIR/issue-67739.rs:12:15
3+
|
4+
LL | [0u8; mem::size_of::<Self::Associated>()];
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+

src/test/ui/macros/issue-58490.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Regression test for #58490
2+
3+
macro_rules! a {
4+
( @1 $i:item ) => {
5+
a! { @2 $i }
6+
};
7+
( @2 $i:item ) => {
8+
$i
9+
};
10+
}
11+
mod b {
12+
a! {
13+
@1
14+
#[macro_export]
15+
macro_rules! b { () => () }
16+
}
17+
#[macro_export]
18+
macro_rules! b { () => () }
19+
//~^ ERROR: the name `b` is defined multiple times
20+
}
21+
mod c {
22+
#[allow(unused_imports)]
23+
use crate::b;
24+
}
25+
26+
fn main() {}

src/test/ui/macros/issue-58490.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0428]: the name `b` is defined multiple times
2+
--> $DIR/issue-58490.rs:18:5
3+
|
4+
LL | macro_rules! b { () => () }
5+
| -------------- previous definition of the macro `b` here
6+
...
7+
LL | macro_rules! b { () => () }
8+
| ^^^^^^^^^^^^^^ `b` redefined here
9+
|
10+
= note: `b` must be defined only once in the macro namespace of this module
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0428`.

src/test/ui/mir/issue-60390.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// check-pass
2+
// compile-flags: --emit=mir,link
3+
// Regression test for #60390, this ICE requires `--emit=mir` flag.
4+
5+
fn main() {
6+
enum Inner { Member(u32) };
7+
Inner::Member(0);
8+
}

0 commit comments

Comments
 (0)