Skip to content

Commit f4790ec

Browse files
committed
add cross crate test
1 parent 4b5cd04 commit f4790ec

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// edition:2018
2+
#![cfg_attr(full, feature(const_generics))]
3+
#![cfg_attr(full, allow(incomplete_features))]
4+
#![cfg_attr(min, feature(min_const_generics))]
5+
6+
pub trait Foo<const N: usize> {}
7+
struct Local;
8+
impl<const N: usize> Foo<N> for Local {}
9+
10+
pub fn out_foo<const N: usize>() -> impl Foo<N> { Local }
11+
pub fn in_foo<const N: usize>(_: impl Foo<N>) {}
12+
13+
pub async fn async_simple<const N: usize>(_: [u8; N]) {}
14+
pub async fn async_out_foo<const N: usize>() -> impl Foo<N> { Local }
15+
pub async fn async_in_foo<const N: usize>(_: impl Foo<N>) {}
16+
17+
pub trait Bar<const N: usize> {
18+
type Assoc: Foo<N>;
19+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// aux-build:crayte.rs
2+
// edition:2018
3+
// run-pass
4+
// revisions: full min
5+
6+
#![cfg_attr(full, feature(const_generics))]
7+
#![cfg_attr(full, allow(incomplete_features))]
8+
#![cfg_attr(min, feature(min_const_generics))]
9+
extern crate crayte;
10+
11+
use crayte::*;
12+
13+
async fn foo() {
14+
in_foo(out_foo::<3>());
15+
async_simple([0; 17]).await;
16+
async_in_foo(async_out_foo::<4>().await).await;
17+
}
18+
19+
struct Faz<const N: usize>;
20+
21+
impl<const N: usize> Foo<N> for Faz<N> {}
22+
impl<const N: usize> Bar<N> for Faz<N> {
23+
type Assoc = Faz<N>;
24+
}
25+
26+
fn main() {
27+
let _ = foo;
28+
}

0 commit comments

Comments
 (0)