about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-13 22:33:10 -0700
committerbors <bors@rust-lang.org>2016-04-13 22:33:10 -0700
commit0cb2ee2ef6398296fbfd70ac5d71d9961955dc48 (patch)
tree6e7895e839800518e04baeaf567df6dd48c6d69c /src/test
parentadb0923492d737a4b3243db05f042e22a672b2d8 (diff)
parentd38a58d46d69bcd0b8839665fd1de9c34c09cfee (diff)
downloadrust-0cb2ee2ef6398296fbfd70ac5d71d9961955dc48.tar.gz
rust-0cb2ee2ef6398296fbfd70ac5d71d9961955dc48.zip
Auto merge of #32877 - oli-obk:const_err_multi, r=arielb1
don't report errors in constants at every use site

partially fixes #32842

r? @arielb1
cc @retep998

I chose this way of implementing it, because the alternative (checking if the error span is inside the constant's expressions's span) would get confusing when combined with expression generating macros.

A next step would be to re-enable the re-reporting of errors if the original erroneous constant is in another crate.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/const-err-multi.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/compile-fail/const-err-multi.rs b/src/test/compile-fail/const-err-multi.rs
new file mode 100644
index 00000000000..7de93a213b0
--- /dev/null
+++ b/src/test/compile-fail/const-err-multi.rs
@@ -0,0 +1,19 @@
+// Copyright 2016 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.
+
+#![deny(const_err)]
+
+pub const A: i8 = -std::i8::MIN; //~ ERROR attempted to negate with overflow
+pub const B: i8 = A;
+pub const C: u8 = A as u8;
+pub const D: i8 = 50 - A;
+
+fn main() {
+}