diff options
| author | Seo Sanghyeon <sanxiyn@gmail.com> | 2015-09-26 11:52:34 +0900 |
|---|---|---|
| committer | Seo Sanghyeon <sanxiyn@gmail.com> | 2015-10-03 00:36:20 +0900 |
| commit | 4fb789b86eb4d9f50c1ae6477126cd84025ff566 (patch) | |
| tree | 57b5b2fde0876125f55e7280621004b6edf1dc05 /src/test | |
| parent | f3211b1578dc61faee1f6a0cfb2e6fd65526ee11 (diff) | |
Provide the context for error in constant evaluation of enum discriminant
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/const-eval-span.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/compile-fail/const-eval-span.rs b/src/test/compile-fail/const-eval-span.rs new file mode 100644 index 00000000000..8e9209916f3 --- /dev/null +++ b/src/test/compile-fail/const-eval-span.rs @@ -0,0 +1,24 @@ +// Copyright 2015 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that error in constant evaluation of enum discriminant +// provides the context for what caused the evaluation. + +struct S(i32); + +const CONSTANT: S = S(0); +//~^ ERROR: constant evaluation error: unsupported constant expr + +enum E { + V = CONSTANT, + //~^ NOTE: for enum discriminant here +} + +fn main() {} |
