diff options
| author | kadmin <julianknodt@gmail.com> | 2021-03-20 22:34:58 +0000 |
|---|---|---|
| committer | kadmin <julianknodt@gmail.com> | 2021-03-23 17:16:20 +0000 |
| commit | 7116bb5c33c1b0d12a7dade3fa20c9b0e2e08218 (patch) | |
| tree | ce8200a765d85029008d9697312d4d08b7313bc5 /src/test | |
| parent | ea2af704669f630c4184bb2c0befeb6cb7d78d29 (diff) | |
| download | rust-7116bb5c33c1b0d12a7dade3fa20c9b0e2e08218.tar.gz rust-7116bb5c33c1b0d12a7dade3fa20c9b0e2e08218.zip | |
Update with comments
Diffstat (limited to 'src/test')
3 files changed, 33 insertions, 3 deletions
diff --git a/src/test/ui/const-generics/min_const_generics/const_default_first.rs b/src/test/ui/const-generics/min_const_generics/const_default_first.rs new file mode 100644 index 00000000000..ae82c85eb7e --- /dev/null +++ b/src/test/ui/const-generics/min_const_generics/const_default_first.rs @@ -0,0 +1,9 @@ +#![crate_type = "lib"] +#![feature(const_generics)] +#![feature(const_generics_defaults)] +#![allow(incomplete_features, dead_code)] + +struct Both<const N: usize=3, T> { +//~^ ERROR: generic parameters with a default must be + v: T +} diff --git a/src/test/ui/const-generics/min_const_generics/const_default_first.stderr b/src/test/ui/const-generics/min_const_generics/const_default_first.stderr new file mode 100644 index 00000000000..f7a2e484fc6 --- /dev/null +++ b/src/test/ui/const-generics/min_const_generics/const_default_first.stderr @@ -0,0 +1,8 @@ +error: generic parameters with a default must be trailing + --> $DIR/const_default_first.rs:6:19 + | +LL | struct Both<const N: usize=3, T> { + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/min_const_generics/type_and_const_defaults.rs b/src/test/ui/const-generics/min_const_generics/type_and_const_defaults.rs index 2ce874c8bf4..435a63a5283 100644 --- a/src/test/ui/const-generics/min_const_generics/type_and_const_defaults.rs +++ b/src/test/ui/const-generics/min_const_generics/type_and_const_defaults.rs @@ -1,7 +1,7 @@ -// check-pass -#![crate_type = "lib"] +// run-pass +#![feature(const_generics)] #![feature(const_generics_defaults)] -#![allow(incomplete_features)] +#![allow(incomplete_features, dead_code)] struct Both<T=u32, const N: usize=3> { arr: [T; N] @@ -12,3 +12,16 @@ trait BothTrait<T=u32, const N: usize=3> {} enum BothEnum<T=u32, const N: usize=3> { Dummy([T; N]) } + +struct OppOrder<const N: usize=3, T=u32> { + arr: [T; N] +} + +fn main() { + let _ = OppOrder::<3, u32> { + arr: [0,0,0], + }; + let _ = Both::<u8, 1> { + arr: [0], + }; +} |
