Skip to content

Commit 6977d52

Browse files
Rollup merge of #162786 - malezjaa:regression-test-159561, r=fee1-dead
regression test for GCE inherent projection ICE Closes #159561 The issue no longer reproduces
2 parents 4d63510 + 43ba58a commit 6977d52

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/159561>.
2+
3+
#![feature(generic_const_exprs)]
4+
5+
fn new<const N: usize>()
6+
where
7+
[(); N * 1]:,
8+
{
9+
}
10+
11+
fn test<const N: usize>()
12+
where
13+
[(); N - usize::MAX * 1]:,
14+
{
15+
new
16+
//~^ ERROR mismatched types
17+
}
18+
19+
fn main() {}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/wf-const-arg-inherent-projection-ice.rs:15:5
3+
|
4+
LL | / fn new<const N: usize>()
5+
LL | | where
6+
LL | | [(); N * 1]:,
7+
| |_________________- function `new` defined here
8+
...
9+
LL | new
10+
| ^^^ expected `()`, found fn item
11+
|
12+
= note: expected unit type `()`
13+
found fn item `fn() {new::<core::num::<impl usize>::MAX>}`
14+
help: try adding a return type
15+
|
16+
LL | fn test<const N: usize>() -> fn()
17+
| +++++++
18+
help: use parentheses to call this function
19+
|
20+
LL | new()
21+
| ++
22+
23+
error: aborting due to 1 previous error
24+
25+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)