add cross crate test
This commit is contained in:
parent
4b5cd04130
commit
f4790ec2b6
19
src/test/ui/const-generics/auxiliary/crayte.rs
Normal file
19
src/test/ui/const-generics/auxiliary/crayte.rs
Normal 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>;
|
||||
}
|
28
src/test/ui/const-generics/cross_crate_complex.rs
Normal file
28
src/test/ui/const-generics/cross_crate_complex.rs
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user