Skip to content

Commit

Permalink
gccrs: [E0093] Declaration of unknown intrinsic function
Browse files Browse the repository at this point in the history
Refactored error message similiar to rustc.

gcc/rust/ChangeLog:

	* backend/rust-compile-intrinsic.cc (Intrinsics::compile):
	called error function.

gcc/testsuite/ChangeLog:

	* rust/compile/torture/intrinsics-3.rs: Updated comment to pass the test case.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
  • Loading branch information
MahadMuhammad authored and philberty committed Jul 13, 2023
1 parent b75357f commit e4df71c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gcc/rust/backend/rust-compile-intrinsic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ Intrinsics::compile (TyTy::FnType *fntype)
return it->second (ctx, fntype);

Location locus = ctx->get_mappings ()->lookup_location (fntype->get_ref ());
rust_error_at (locus, "unknown builtin intrinsic: %s",
rust_error_at (locus, ErrorCode ("E0093"),
"unrecognized intrinsic function: %<%s%>",
fntype->get_identifier ().c_str ());

return error_mark_node;
Expand Down
2 changes: 1 addition & 1 deletion gcc/testsuite/rust/compile/torture/intrinsics-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ extern "rust-intrinsic" {
}

fn main() {
unsafe { not_an_intrinsic() }; // { dg-error "unknown builtin intrinsic: not_an_intrinsic" }
unsafe { not_an_intrinsic() }; // { dg-error "unrecognized intrinsic function: .not_an_intrinsic." }
}

0 comments on commit e4df71c

Please sign in to comment.