diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-07-22 22:58:54 +0200 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-07-22 22:58:54 +0200 |
| commit | a95e6bb91673e250e35886ff09a2ba023e536ff6 (patch) | |
| tree | 47d43a7d8a4f80f24be1ea8575a683333730066f /src/test/ui/const-generics | |
| parent | 9e92106d457abd14f82adc29e7f2496861e07916 (diff) | |
| download | rust-a95e6bb91673e250e35886ff09a2ba023e536ff6.tar.gz rust-a95e6bb91673e250e35886ff09a2ba023e536ff6.zip | |
require type defaults to be after const generic parameters
as if this is currently possible. HA!
Diffstat (limited to 'src/test/ui/const-generics')
| -rw-r--r-- | src/test/ui/const-generics/defaults/wrong-order.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/const-generics/defaults/wrong-order.stderr | 19 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/defaults/wrong-order.rs b/src/test/ui/const-generics/defaults/wrong-order.rs new file mode 100644 index 00000000000..7f17c6358b7 --- /dev/null +++ b/src/test/ui/const-generics/defaults/wrong-order.rs @@ -0,0 +1,8 @@ +#![feature(const_generics)] //~ WARN the feature `const_generics` is incomplete + +struct A<T = u32, const N: usize> { + //~^ ERROR type parameters with a default must be trailing + arg: T, +} + +fn main() {} diff --git a/src/test/ui/const-generics/defaults/wrong-order.stderr b/src/test/ui/const-generics/defaults/wrong-order.stderr new file mode 100644 index 00000000000..7d7cd0fa36f --- /dev/null +++ b/src/test/ui/const-generics/defaults/wrong-order.stderr @@ -0,0 +1,19 @@ +error: type parameters with a default must be trailing + --> $DIR/wrong-order.rs:3:10 + | +LL | struct A<T = u32, const N: usize> { + | ^ + | + = note: using type defaults and const parameters in the same parameter listing is currently not possible + +warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/wrong-order.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information + +error: aborting due to previous error; 1 warning emitted + |
