From 6e5e35458c4c6d965eefa43ed03551a8c0f02e71 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Fri, 8 Jun 2018 01:10:18 +0200 Subject: [PATCH] Add a sanity test for nesting other items inside the existential type --- src/test/run-pass/impl-trait/nesting.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/run-pass/impl-trait/nesting.rs diff --git a/src/test/run-pass/impl-trait/nesting.rs b/src/test/run-pass/impl-trait/nesting.rs new file mode 100644 index 00000000000..73e6c1c0d1d --- /dev/null +++ b/src/test/run-pass/impl-trait/nesting.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo(t: T) -> impl Into<[T; { const FOO: usize = 1; FOO }]> { + [t] +} + +fn bar() -> impl Into<[u8; { const FOO: usize = 1; FOO }]> { + [99] +} + +fn main() { + println!("{:?}", foo(42).into()); + println!("{:?}", bar().into()); +}