Skip to content

Commit 61c1724

Browse files
committed
Update tests
1 parent d04b5dd commit 61c1724

5 files changed

+54
-10
lines changed

tests/crashes/128016.rs

-10
This file was deleted.

tests/ui/const-generics/early/trivial-const-arg-macro-nested.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ check-pass
22

3+
// This is a regression test for #128016.
4+
35
macro_rules! len_inner {
46
() => {
57
BAR
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ check-pass
2+
3+
// This is a regression test for #128016.
4+
5+
macro_rules! len {
6+
($x:ident) => {
7+
$x
8+
};
9+
}
10+
11+
fn bar<const N: usize>() {
12+
let val: [bool; len!(N)] = [true; N];
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This is a regression test for #128016.
2+
3+
macro_rules! len {
4+
() => {
5+
target
6+
//~^ ERROR cannot find value `target`
7+
};
8+
}
9+
10+
fn main() {
11+
let val: [str; len!()] = [];
12+
//~^ ERROR the size for values
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error[E0425]: cannot find value `target` in this scope
2+
--> $DIR/trivial-const-arg-macro-res-error.rs:5:9
3+
|
4+
LL | target
5+
| ^^^^^^ not found in this scope
6+
...
7+
LL | let val: [str; len!()] = [];
8+
| ------ in this macro invocation
9+
|
10+
= note: this error originates in the macro `len` (in Nightly builds, run with -Z macro-backtrace for more info)
11+
12+
error[E0277]: the size for values of type `str` cannot be known at compilation time
13+
--> $DIR/trivial-const-arg-macro-res-error.rs:11:14
14+
|
15+
LL | let val: [str; len!()] = [];
16+
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
17+
|
18+
= help: the trait `Sized` is not implemented for `str`
19+
= note: slice and array elements must have `Sized` type
20+
21+
error: aborting due to 2 previous errors
22+
23+
Some errors have detailed explanations: E0277, E0425.
24+
For more information about an error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)