-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|