Skip to content

Commit

Permalink
Add test for 113326
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Oct 16, 2023
1 parent 39acbed commit c0e5fbd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/ui/type-alias-impl-trait/issue-113326.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#![allow(incomplete_features)]
#![feature(const_trait_impl)]
#![feature(const_closures)]
#![feature(const_refs_to_cell)]
#![feature(type_alias_impl_trait)]

pub type Diff = impl ~const std::marker::Destruct + ~const Fn(usize) -> usize;
//~^ ERROR: ~const can only be applied to `#[const_trait]` traits

pub const fn lift(n: usize) -> Diff {
const move |m: usize| m + n
}

pub const fn reify(n: Diff) -> usize {
n(0)
}

pub const fn add(
n: Diff,
m: Diff,
) -> Diff {
const move |x: usize| m(n(x))
}

fn main() {}
8 changes: 8 additions & 0 deletions tests/ui/type-alias-impl-trait/issue-113326.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/issue-113326.rs:7:60
|
LL | pub type Diff = impl ~const std::marker::Destruct + ~const Fn(usize) -> usize;
| ^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

0 comments on commit c0e5fbd

Please sign in to comment.