diff options
| author | varkor <github@varkor.com> | 2019-02-20 11:01:39 +0000 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-03-05 22:20:01 +0000 |
| commit | 162405f2221439fc9410ecb60f3e5939c2f2fac8 (patch) | |
| tree | 44bba3b4c11ef860fd068dec9018cd93450037e7 | |
| parent | 3e3a4212e8bf8fb52088906a0cbf6a2699c7f035 (diff) | |
| download | rust-162405f2221439fc9410ecb60f3e5939c2f2fac8.tar.gz rust-162405f2221439fc9410ecb60f3e5939c2f2fac8.zip | |
Fix negative integer literal test
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
| -rw-r--r-- | src/test/ui/const-generics/const-expression-parameter.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/const-generics/const-expression-parameter.stderr | 15 |
2 files changed, 8 insertions, 19 deletions
diff --git a/src/test/ui/const-generics/const-expression-parameter.rs b/src/test/ui/const-generics/const-expression-parameter.rs index 0883caa5c70..662c7b767ba 100644 --- a/src/test/ui/const-generics/const-expression-parameter.rs +++ b/src/test/ui/const-generics/const-expression-parameter.rs @@ -1,24 +1,22 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -fn u32_identity<const X: u32>() -> u32 { +fn i32_identity<const X: i32>() -> i32 { 5 } fn foo_a() { - u32_identity::<-1>(); //~ ERROR expected identifier, found `<-` + i32_identity::<-1>(); //~ ERROR expected identifier, found `<-` } fn foo_b() { - u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` + i32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` } fn foo_c() { - u32_identity::< -1 >(); // ok - // FIXME(const_generics) - //~^^ ERROR cannot apply unary operator `-` to type `u32` [E0600] + i32_identity::< -1 >(); // ok } fn main() { - u32_identity::<5>(); // ok + i32_identity::<5>(); // ok } diff --git a/src/test/ui/const-generics/const-expression-parameter.stderr b/src/test/ui/const-generics/const-expression-parameter.stderr index 8871aa45788..2741d621256 100644 --- a/src/test/ui/const-generics/const-expression-parameter.stderr +++ b/src/test/ui/const-generics/const-expression-parameter.stderr @@ -1,13 +1,13 @@ error: expected identifier, found `<-` --> $DIR/const-expression-parameter.rs:9:19 | -LL | u32_identity::<-1>(); //~ ERROR expected identifier, found `<-` +LL | i32_identity::<-1>(); //~ ERROR expected identifier, found `<-` | ^^ expected identifier error: expected one of `,` or `>`, found `+` --> $DIR/const-expression-parameter.rs:13:22 | -LL | u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` +LL | i32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` | ^ expected one of `,` or `>` here warning: the feature `const_generics` is incomplete and may cause the compiler to crash @@ -16,14 +16,5 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ -error[E0600]: cannot apply unary operator `-` to type `u32` - --> $DIR/const-expression-parameter.rs:17:21 - | -LL | u32_identity::< -1 >(); // ok - | ^^ cannot apply unary operator `-` - | - = note: unsigned values cannot be negated - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0600`. |
