Skip to content

Commit e2c5247

Browse files
Add a known-bug test for #102498
1 parent edadc7c commit e2c5247

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// known-bug: #102498
2+
3+
#![feature(const_trait_impl, generic_const_exprs)]
4+
5+
pub trait Tr {
6+
fn a() -> usize;
7+
}
8+
9+
impl Tr for () {
10+
fn a() -> usize {
11+
1
12+
}
13+
}
14+
15+
const fn foo<T: ~const Tr>() -> [u8; T::a()] {
16+
[0; T::a()]
17+
}
18+
19+
fn main() {
20+
foo::<()>();
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/constifconst-call-in-const-position.rs:3:30
3+
|
4+
LL | #![feature(const_trait_impl, generic_const_exprs)]
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
error[E0080]: evaluation of `foo::<()>::{constant#0}` failed
11+
--> $DIR/constifconst-call-in-const-position.rs:15:38
12+
|
13+
LL | const fn foo<T: ~const Tr>() -> [u8; T::a()] {
14+
| ^^^^^^ calling non-const function `<() as Tr>::a`
15+
16+
error: aborting due to previous error; 1 warning emitted
17+
18+
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)