Skip to content

Commit c0e5fbd

Browse files
committed
Add test for 113326
1 parent 39acbed commit c0e5fbd

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![allow(incomplete_features)]
2+
#![feature(const_trait_impl)]
3+
#![feature(const_closures)]
4+
#![feature(const_refs_to_cell)]
5+
#![feature(type_alias_impl_trait)]
6+
7+
pub type Diff = impl ~const std::marker::Destruct + ~const Fn(usize) -> usize;
8+
//~^ ERROR: ~const can only be applied to `#[const_trait]` traits
9+
10+
pub const fn lift(n: usize) -> Diff {
11+
const move |m: usize| m + n
12+
}
13+
14+
pub const fn reify(n: Diff) -> usize {
15+
n(0)
16+
}
17+
18+
pub const fn add(
19+
n: Diff,
20+
m: Diff,
21+
) -> Diff {
22+
const move |x: usize| m(n(x))
23+
}
24+
25+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: ~const can only be applied to `#[const_trait]` traits
2+
--> $DIR/issue-113326.rs:7:60
3+
|
4+
LL | pub type Diff = impl ~const std::marker::Destruct + ~const Fn(usize) -> usize;
5+
| ^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)