diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2017-08-10 01:43:06 +0300 |
|---|---|---|
| committer | Kornel <kornel@geekhood.net> | 2017-08-10 00:52:50 +0100 |
| commit | a965beef8f362e1db47eadd0ff701ec57cc23cfe (patch) | |
| tree | 481d407c46062f2932fef8e9e748dbac556572cc /src/test | |
| parent | ff0513c6973523b65f59b8b508ca85dc2944c988 (diff) | |
| download | rust-a965beef8f362e1db47eadd0ff701ec57cc23cfe.tar.gz rust-a965beef8f362e1db47eadd0ff701ec57cc23cfe.zip | |
Better diagnostics and recovery for `const` in extern blocks
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/extern-const.rs | 19 | ||||
| -rw-r--r-- | src/test/ui/extern-const.stderr | 8 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/extern-const.rs b/src/test/ui/extern-const.rs new file mode 100644 index 00000000000..a77d7b11895 --- /dev/null +++ b/src/test/ui/extern-const.rs @@ -0,0 +1,19 @@ +// Copyright 2017 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. + +// compile-flags: -Z continue-parse-after-error + +extern "C" { + const C: u8; //~ ERROR extern items cannot be `const` +} + +fn main() { + let x = C; +} diff --git a/src/test/ui/extern-const.stderr b/src/test/ui/extern-const.stderr new file mode 100644 index 00000000000..e6c41a05594 --- /dev/null +++ b/src/test/ui/extern-const.stderr @@ -0,0 +1,8 @@ +error: extern items cannot be `const` + --> $DIR/extern-const.rs:14:5 + | +14 | const C: u8; //~ ERROR extern items cannot be `const` + | ^^^^^ use `static` instead + +error: aborting due to previous error + |
