Skip to content

Conversation

@Pasta-coder
Copy link
Contributor

Fixes #3526

This patch improves the diagnostic for E0044 (foreign items with generics).
Previously, the help message was missing, and the error location needed
verification.

Fixes Rust-GCC#3526

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_generic_params):
	Add rust_inform help message and ensure correct locus for E0044.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-3526.rs: New test.

Signed-off-by: Jayant Chauhan <0001jayant@gmail.com>
@Pasta-coder
Copy link
Contributor Author

while looking at the refactored code i came across that the primary reason the error was misleading was that the TypeCheck pass was explicitly reading the location of the ExternalFunctionItem (the fn keyword) instead of the GenericParam (the <T>).

the lexer issue still exists .

this doesn't not resolve issue #3526 .

{
rust_error_at (generic_param->get_locus (), ErrorCode::E0044,
"foreign items may not have const parameters");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you should be using a rich_location type error for something like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with column location

2 participants