add cross crate test

This commit is contained in:
Bastian Kauschke 2020-11-10 10:55:34 +01:00
parent 4b5cd04130
commit f4790ec2b6
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// edition:2018
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
pub trait Foo<const N: usize> {}
struct Local;
impl<const N: usize> Foo<N> for Local {}
pub fn out_foo<const N: usize>() -> impl Foo<N> { Local }
pub fn in_foo<const N: usize>(_: impl Foo<N>) {}
pub async fn async_simple<const N: usize>(_: [u8; N]) {}
pub async fn async_out_foo<const N: usize>() -> impl Foo<N> { Local }
pub async fn async_in_foo<const N: usize>(_: impl Foo<N>) {}
pub trait Bar<const N: usize> {
type Assoc: Foo<N>;
}

View File

@ -0,0 +1,28 @@
// aux-build:crayte.rs
// edition:2018
// run-pass
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
extern crate crayte;
use crayte::*;
async fn foo() {
in_foo(out_foo::<3>());
async_simple([0; 17]).await;
async_in_foo(async_out_foo::<4>().await).await;
}
struct Faz<const N: usize>;
impl<const N: usize> Foo<N> for Faz<N> {}
impl<const N: usize> Bar<N> for Faz<N> {
type Assoc = Faz<N>;
}
fn main() {
let _ = foo;
}