From f4790ec2b6392972f5ef65ad9afb70ea1937a692 Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Tue, 10 Nov 2020 10:55:34 +0100 Subject: [PATCH] add cross crate test --- .../ui/const-generics/auxiliary/crayte.rs | 19 +++++++++++++ .../ui/const-generics/cross_crate_complex.rs | 28 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/test/ui/const-generics/auxiliary/crayte.rs create mode 100644 src/test/ui/const-generics/cross_crate_complex.rs diff --git a/src/test/ui/const-generics/auxiliary/crayte.rs b/src/test/ui/const-generics/auxiliary/crayte.rs new file mode 100644 index 00000000000..725005971e1 --- /dev/null +++ b/src/test/ui/const-generics/auxiliary/crayte.rs @@ -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 {} +struct Local; +impl Foo for Local {} + +pub fn out_foo() -> impl Foo { Local } +pub fn in_foo(_: impl Foo) {} + +pub async fn async_simple(_: [u8; N]) {} +pub async fn async_out_foo() -> impl Foo { Local } +pub async fn async_in_foo(_: impl Foo) {} + +pub trait Bar { + type Assoc: Foo; +} diff --git a/src/test/ui/const-generics/cross_crate_complex.rs b/src/test/ui/const-generics/cross_crate_complex.rs new file mode 100644 index 00000000000..30749b8bc6d --- /dev/null +++ b/src/test/ui/const-generics/cross_crate_complex.rs @@ -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; + +impl Foo for Faz {} +impl Bar for Faz { + type Assoc = Faz; +} + +fn main() { + let _ = foo; +}