diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-05-08 14:11:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-08 14:11:52 +0200 |
| commit | 678954000a2ebd22e5e4a2541bbf893c32441a1c (patch) | |
| tree | da21217d9b268425e249c329ad841a5e8ac0b48f /src/test | |
| parent | c4c634034a9a04d64d89585c6053a7b339066e81 (diff) | |
| parent | 4fd70e4ed979df1f5b5dca58131a3552b12580cd (diff) | |
| download | rust-678954000a2ebd22e5e4a2541bbf893c32441a1c.tar.gz rust-678954000a2ebd22e5e4a2541bbf893c32441a1c.zip | |
Rollup merge of #72008 - lcnr:patch-3, r=varkor
Add const-generics test Taken from #71973 as this apparently already compiles. r? @varkor
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/const-generics/trait-const-args.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/trait-const-args.rs b/src/test/ui/const-generics/trait-const-args.rs new file mode 100644 index 00000000000..b60d7e89651 --- /dev/null +++ b/src/test/ui/const-generics/trait-const-args.rs @@ -0,0 +1,29 @@ +// check-pass +#![allow(incomplete_features)] +#![feature(const_generics)] + +struct Const<const N: usize>; +trait Foo<const N: usize> {} + +impl<const N: usize> Foo<N> for Const<N> {} + +fn foo_impl(_: impl Foo<3>) {} + +fn foo_explicit<T: Foo<3>>(_: T) {} + +fn foo_where<T>(_: T) +where + T: Foo<3>, +{ +} + +fn main() { + foo_impl(Const); + foo_impl(Const::<3>); + + foo_explicit(Const); + foo_explicit(Const::<3>); + + foo_where(Const); + foo_where(Const::<3>); +} |
