]> git.lizzy.rs Git - rust.git/commitdiff
Add code to `invalid ABI` error
authorEsteban Küber <esteban@kuber.com.ar>
Sat, 9 Jun 2018 22:44:32 +0000 (15:44 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Tue, 19 Jun 2018 18:37:33 +0000 (11:37 -0700)
src/libsyntax/diagnostic_list.rs
src/libsyntax/parse/parser.rs
src/test/ui/codemap_tests/unicode.stderr

index ab8317bfa027ea5b9b22fd04300985c8b92c47a2..b6748c40fc432da02d88be23a869eb89f87f8c40 100644 (file)
@@ -397,4 +397,5 @@ fn main() {}
     E0630, // rustc_const_unstable attribute must be paired with stable/unstable attribute
     E0693, // incorrect `repr(align)` attribute format
     E0694, // an unknown tool name found in scoped attributes
+    E0697, // invalid ABI
 }
index 1735951da2f34638008e06bd45f482dc2c1ad6c0..f38f4cc713735fe07cf2e7dbf7d97c10b9fc8312 100644 (file)
@@ -6535,12 +6535,15 @@ fn parse_opt_abi(&mut self) -> PResult<'a, Option<Abi>> {
                     Some(abi) => Ok(Some(abi)),
                     None => {
                         let prev_span = self.prev_span;
-                        self.span_err(
+                        let mut err = struct_span_err!(
+                            self.sess.span_diagnostic,
                             prev_span,
-                            &format!("invalid ABI: expected one of [{}], \
-                                     found `{}`",
-                                    abi::all_names().join(", "),
-                                    s));
+                            E0697,
+                            "invalid ABI: found `{}`",
+                            s);
+                        err.span_label(prev_span, "invalid ABI");
+                        err.help(&format!("valid ABIs: {}", abi::all_names().join(", ")));
+                        err.emit();
                         Ok(None)
                     }
                 }
index b9b03c9b9ec6224219220fbbfeab29cab562bf68..d2e79a0b47d3f58b63ced97633cc3ec96398f3ec 100644 (file)
@@ -1,8 +1,11 @@
-error: invalid ABI: expected one of [cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted], found `路濫狼á́́`
+error[E0697]: invalid ABI: found `路濫狼á́́`
   --> $DIR/unicode.rs:11:8
    |
 LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI
-   |        ^^^^^^^^^
+   |        ^^^^^^^^^ invalid ABI
+   |
+   = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0697`.