From ae9c09d3602fff3c98dbb4488147059f1024ff69 Mon Sep 17 00:00:00 2001 From: hank-der-hafenarbeiter Date: Tue, 9 Aug 2016 01:39:23 +0200 Subject: [PATCH 1/2] Updated error for E0045 (no bonus) --- src/librustc_typeck/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 65e00705121..37de3b1f609 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -181,8 +181,10 @@ fn require_c_abi_if_variadic(tcx: TyCtxt, abi: Abi, span: Span) { if decl.variadic && abi != Abi::C { - span_err!(tcx.sess, span, E0045, + let mut err = struct_span_err!(tcx.sess, span, E0045, "variadic function must have C calling convention"); + err.span_label(span, &("variadics require C calling conventions").to_string()) + .emit(); } } From 2adc07f462fbd9bc2dc4a3b756d1e580fa337558 Mon Sep 17 00:00:00 2001 From: hank-der-hafenarbeiter Date: Tue, 9 Aug 2016 14:40:07 +0200 Subject: [PATCH 2/2] added unit test --- src/test/compile-fail/E0045.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/compile-fail/E0045.rs b/src/test/compile-fail/E0045.rs index 2a731596b4b..a3fea8e0db2 100644 --- a/src/test/compile-fail/E0045.rs +++ b/src/test/compile-fail/E0045.rs @@ -8,7 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045 +extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045 + //~| NOTE variadics require C calling conventions fn main() { }