From 10d6f2d7ea55ec1a8bafcac23e731ac69e470f5b Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 21 Oct 2020 23:01:50 +0100 Subject: [PATCH] Add regression test for #73298 --- src/test/ui/const-generics/issue-73298.rs | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/ui/const-generics/issue-73298.rs diff --git a/src/test/ui/const-generics/issue-73298.rs b/src/test/ui/const-generics/issue-73298.rs new file mode 100644 index 0000000000000..4ad4108c90581 --- /dev/null +++ b/src/test/ui/const-generics/issue-73298.rs @@ -0,0 +1,24 @@ +// build-pass +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] + +use std::convert::AsMut; +use std::default::Default; + +trait Foo: Sized { + type Baz: Default + AsMut<[u8]>; + fn bar() { + Self::Baz::default().as_mut(); + } +} + +impl Foo for () { + type Baz = [u8; 1 * 1]; +} + +fn main() { + <() as Foo>::bar(); +}