From 95870e25c631883a16da23b349738ebc0f3e2966 Mon Sep 17 00:00:00 2001 From: PankajChaudhary5 Date: Thu, 26 Mar 2020 11:32:56 +0530 Subject: [PATCH 1/5] Add long error explanation for E0703 --- src/librustc_error_codes/error_codes.rs | 2 +- src/librustc_error_codes/error_codes/E0703.md | 19 +++++++++++++++++++ src/test/ui/codemap_tests/unicode.stderr | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/librustc_error_codes/error_codes/E0703.md diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 59a030bc4c683..bd6f5270fc1ef 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -388,6 +388,7 @@ E0698: include_str!("./error_codes/E0698.md"), E0699: include_str!("./error_codes/E0699.md"), E0700: include_str!("./error_codes/E0700.md"), E0701: include_str!("./error_codes/E0701.md"), +E0703: include_str!("./error_codes/E0703.md"), E0704: include_str!("./error_codes/E0704.md"), E0705: include_str!("./error_codes/E0705.md"), E0706: include_str!("./error_codes/E0706.md"), @@ -599,7 +600,6 @@ E0748: include_str!("./error_codes/E0748.md"), // E0694, // an unknown tool name found in scoped attributes E0696, // `continue` pointing to a labeled block // E0702, // replaced with a generic attribute input check - E0703, // invalid ABI // E0707, // multiple elided lifetimes used in arguments of `async fn` E0708, // `async` non-`move` closures with parameters are not currently // supported diff --git a/src/librustc_error_codes/error_codes/E0703.md b/src/librustc_error_codes/error_codes/E0703.md new file mode 100644 index 0000000000000..14c3cb5c8eaaf --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0703.md @@ -0,0 +1,19 @@ +Invalid ABI(Application Binary Interface) used in the code. + +Erroneous code example: + +```compile_fail,E0703 +extern "invalid" fn foo() {} //~ ERROR + +fn main() { } + +``` +At present there the few predefined ABI's (like Rust, C, system, etc.) +which we can use in our Rust code. Please verify the ABI from the +given ABI. For example you can replace the given ABI from 'Rust'. + +``` +extern "Rust" fn foo() {} //~ OK! + +fn main() { } +``` diff --git a/src/test/ui/codemap_tests/unicode.stderr b/src/test/ui/codemap_tests/unicode.stderr index fc2a0b5950e7d..01d54ac8cc8a2 100644 --- a/src/test/ui/codemap_tests/unicode.stderr +++ b/src/test/ui/codemap_tests/unicode.stderr @@ -8,3 +8,4 @@ LL | extern "路濫狼á́́" fn foo() {} error: aborting due to previous error +For more information about this error, try `rustc --explain E0703`. From e5f4dad6c8f1e2cb28c007d20e024b3d34cd45d1 Mon Sep 17 00:00:00 2001 From: PankajChaudhary5 Date: Thu, 26 Mar 2020 13:17:41 +0530 Subject: [PATCH 2/5] Refactor code --- src/librustc_error_codes/error_codes/E0703.md | 1 - src/test/ui/parser/issue-8537.stderr | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_error_codes/error_codes/E0703.md b/src/librustc_error_codes/error_codes/E0703.md index 14c3cb5c8eaaf..2f9d745261c4f 100644 --- a/src/librustc_error_codes/error_codes/E0703.md +++ b/src/librustc_error_codes/error_codes/E0703.md @@ -6,7 +6,6 @@ Erroneous code example: extern "invalid" fn foo() {} //~ ERROR fn main() { } - ``` At present there the few predefined ABI's (like Rust, C, system, etc.) which we can use in our Rust code. Please verify the ABI from the diff --git a/src/test/ui/parser/issue-8537.stderr b/src/test/ui/parser/issue-8537.stderr index b20226f87e8f8..a0793d94653da 100644 --- a/src/test/ui/parser/issue-8537.stderr +++ b/src/test/ui/parser/issue-8537.stderr @@ -8,3 +8,4 @@ LL | "invalid-ab_isize" error: aborting due to previous error +For more information about this error, try `rustc --explain E0703`. From 28fe986ae328e7ac832ce6999869eea3ca417be0 Mon Sep 17 00:00:00 2001 From: PankajChaudhary5 Date: Fri, 27 Mar 2020 09:53:16 +0530 Subject: [PATCH 3/5] fix suggested changes --- src/librustc_error_codes/error_codes/E0703.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0703.md b/src/librustc_error_codes/error_codes/E0703.md index 2f9d745261c4f..b21416b364447 100644 --- a/src/librustc_error_codes/error_codes/E0703.md +++ b/src/librustc_error_codes/error_codes/E0703.md @@ -1,18 +1,19 @@ -Invalid ABI(Application Binary Interface) used in the code. +Invalid ABI (Application Binary Interface) used in the code. Erroneous code example: ```compile_fail,E0703 -extern "invalid" fn foo() {} //~ ERROR +extern "invalid" fn foo() {} // error! -fn main() { } +# fn main() {} ``` + At present there the few predefined ABI's (like Rust, C, system, etc.) which we can use in our Rust code. Please verify the ABI from the given ABI. For example you can replace the given ABI from 'Rust'. ``` -extern "Rust" fn foo() {} //~ OK! +extern "Rust" fn foo() {} // ok! -fn main() { } +# fn main() { } ``` From 0d90612952de6e5b81417ec75d52277d31d7b737 Mon Sep 17 00:00:00 2001 From: PankajChaudhary5 Date: Fri, 27 Mar 2020 19:16:32 +0530 Subject: [PATCH 4/5] Refactor changes --- src/librustc_error_codes/error_codes/E0703.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0703.md b/src/librustc_error_codes/error_codes/E0703.md index b21416b364447..a7e4d4b7e2f92 100644 --- a/src/librustc_error_codes/error_codes/E0703.md +++ b/src/librustc_error_codes/error_codes/E0703.md @@ -8,9 +8,9 @@ extern "invalid" fn foo() {} // error! # fn main() {} ``` -At present there the few predefined ABI's (like Rust, C, system, etc.) -which we can use in our Rust code. Please verify the ABI from the -given ABI. For example you can replace the given ABI from 'Rust'. +At present few predefined ABI's (like Rust, C, system, etc.) can be +used in Rust. Verify that the ABI is predefined. For example you can +replace the given ABI from 'Rust'. ``` extern "Rust" fn foo() {} // ok! From c09b5a3ed37a229408831f9b00f0d53ef6d8b938 Mon Sep 17 00:00:00 2001 From: PankajChaudhary5 Date: Fri, 27 Mar 2020 20:00:49 +0530 Subject: [PATCH 5/5] Refactor changes --- src/librustc_error_codes/error_codes/E0703.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0703.md b/src/librustc_error_codes/error_codes/E0703.md index a7e4d4b7e2f92..b42677d52cbb5 100644 --- a/src/librustc_error_codes/error_codes/E0703.md +++ b/src/librustc_error_codes/error_codes/E0703.md @@ -4,7 +4,6 @@ Erroneous code example: ```compile_fail,E0703 extern "invalid" fn foo() {} // error! - # fn main() {} ``` @@ -14,6 +13,5 @@ replace the given ABI from 'Rust'. ``` extern "Rust" fn foo() {} // ok! - # fn main() { } ```