Skip to content

Commit 679c2b7

Browse files
Rollup merge of rust-lang#154671 - jakubadamw:issue-127423, r=Kivooeo
Add a test for a past ICE when calling a const fn of an unresolved type with the wrong number of args The ICE is fixed, but there needs to be a regression test for it. Closes rust-lang#127423.
2 parents daf307f + d1f11b2 commit 679c2b7

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! Regression test for https://github.com/rust-lang/rust/issues/127423
2+
3+
#![allow(dead_code)]
4+
5+
const fn add(a: &'self isize) -> usize {
6+
//~^ ERROR use of undeclared lifetime name `'self`
7+
//~| ERROR lifetimes cannot use keyword names
8+
Qux + y
9+
//~^ ERROR cannot find value `Qux` in this scope
10+
//~| ERROR cannot find value `y` in this scope
11+
}
12+
13+
const ARR: [i32; add(1, 2)] = [5, 6, 7];
14+
15+
pub fn main() {}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
error: lifetimes cannot use keyword names
2+
--> $DIR/ice-extra-args-fn-abi-issue-127423.rs:5:18
3+
|
4+
LL | const fn add(a: &'self isize) -> usize {
5+
| ^^^^^
6+
7+
error[E0261]: use of undeclared lifetime name `'self`
8+
--> $DIR/ice-extra-args-fn-abi-issue-127423.rs:5:18
9+
|
10+
LL | const fn add(a: &'self isize) -> usize {
11+
| ^^^^^ undeclared lifetime
12+
|
13+
help: consider introducing lifetime `'self` here
14+
|
15+
LL | const fn add<'self>(a: &'self isize) -> usize {
16+
| +++++++
17+
18+
error[E0425]: cannot find value `Qux` in this scope
19+
--> $DIR/ice-extra-args-fn-abi-issue-127423.rs:8:5
20+
|
21+
LL | Qux + y
22+
| ^^^ not found in this scope
23+
24+
error[E0425]: cannot find value `y` in this scope
25+
--> $DIR/ice-extra-args-fn-abi-issue-127423.rs:8:11
26+
|
27+
LL | Qux + y
28+
| ^
29+
|
30+
help: a local variable with a similar name exists
31+
|
32+
LL - Qux + y
33+
LL + Qux + a
34+
|
35+
36+
error: aborting due to 4 previous errors
37+
38+
Some errors have detailed explanations: E0261, E0425.
39+
For more information about an error, try `rustc --explain E0261`.

0 commit comments

Comments
 (0)