Add code to invalid ABI error

This commit is contained in:
Esteban Küber 2018-06-09 15:44:32 -07:00
parent 6ec1b626ba
commit 09e42bcb10
3 changed files with 14 additions and 7 deletions

View file

@ -397,4 +397,5 @@ register_diagnostics! {
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
}

View file

@ -6535,12 +6535,15 @@ impl<'a> Parser<'a> {
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)
}
}

View 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`.