From dfb66c3e2bc93a480d69e4e768c3366440b6ccc5 Mon Sep 17 00:00:00 2001 From: "Peter C. Norton" Date: Sat, 6 Aug 2016 19:23:40 -0400 Subject: [PATCH] Update E0010 to use the new format For https://github.com/rust-lang/rust/issues/35194 --- src/librustc_mir/transform/qualify_consts.rs | 6 ++++-- src/test/compile-fail/E0010.rs | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 1d00938fb25eb..5455ca62ea46e 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -686,8 +686,10 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { Rvalue::Box(_) => { self.add(Qualif::NOT_CONST); if self.mode != Mode::Fn { - span_err!(self.tcx.sess, self.span, E0010, - "allocations are not allowed in {}s", self.mode); + struct_span_err!(self.tcx.sess, self.span, E0010, + "allocations are not allowed in {}s", self.mode) + .span_label(self.span, &format!("allocation not allowed in {}s", self.mode)) + .emit(); } } diff --git a/src/test/compile-fail/E0010.rs b/src/test/compile-fail/E0010.rs index 9ae9e795466d2..8a666168c86fd 100644 --- a/src/test/compile-fail/E0010.rs +++ b/src/test/compile-fail/E0010.rs @@ -11,5 +11,6 @@ #![feature(box_syntax)] const CON : Box = box 0; //~ ERROR E0010 + //~| NOTE allocation not allowed in fn main() {}