From: Bastian Kauschke Date: Tue, 10 Nov 2020 09:55:34 +0000 (+0100) Subject: add cross crate test X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=f4790ec2b6392972f5ef65ad9afb70ea1937a692;p=rust.git add cross crate test --- 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; +}