]> git.lizzy.rs Git - rust.git/commitdiff
syntax: Fix span on illegal ABI errors
authorlucy <ne.tetewi@gmail.com>
Thu, 29 May 2014 12:40:41 +0000 (14:40 +0200)
committerlucy <ne.tetewi@gmail.com>
Thu, 29 May 2014 17:09:46 +0000 (19:09 +0200)
Fixes #8537
Fixes #14499

src/libsyntax/parse/parser.rs
src/test/compile-fail/issue-8537.rs [new file with mode: 0644]

index 65ad83d4b4fb15948635ab7cf55fc8adc6605bc1..2884bb68261d4e101afed73d88006938a61ec631 100644 (file)
@@ -4537,7 +4537,7 @@ fn parse_opt_abi(&mut self) -> Option<abi::Abi> {
                     Some(abi) => Some(abi),
                     None => {
                         self.span_err(
-                            self.span,
+                            self.last_span,
                             format!("illegal ABI: expected one of [{}], \
                                      found `{}`",
                                     abi::all_names().connect(", "),
diff --git a/src/test/compile-fail/issue-8537.rs b/src/test/compile-fail/issue-8537.rs
new file mode 100644 (file)
index 0000000..dba9e75
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2014 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.
+
+pub extern
+  "invalid-abi" //~ ERROR illegal ABI
+fn foo() {}
+
+fn main() {}