Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E0271] Type mismatch between associated type trait. #2562

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

MahadMuhammad
Copy link
Contributor

Mismatch types between associated traits - E0271

Added rich location and error code.

Running testcases:

~/gccrs/gcc/testsuite/rust/compile/issue-1725-2.rs:28:9: error: type mismatch, expected ‘i32’ but got ‘f32’ [E0271]
   16 |     type Output = f32;
      |     ~~~~ 
......
   23 | pub fn foo<T: core::ops::Add<Output = i32>>(a: T) -> i32 {
      |               ~~~~
......
   28 |     foo(123f32);
      |         ^~~~~~
      |         expected i32, found f32
~/gccrs/gcc/testsuite/rust/compile/issue-1725-2.rs:28:9: error: bounds not satisfied for f32Add’ is not satisfied [E0277]
   23 | pub fn foo<T: core::ops::Add<Output = i32>>(a: T) -> i32 {
      |               ~~~~
......
   28 |     foo(123f32);
      |         ^~~~~~

gcc/rust/ChangeLog:

* typecheck/rust-tyty.cc (BaseType::satisfies_bound): Added errorcode and user-friendly error message.

gcc/testsuite/ChangeLog:

* rust/compile/issue-1725-2.rs: Updated dejagnu message.

Added rich location and error code.

gcc/rust/ChangeLog:

	* typecheck/rust-tyty.cc (BaseType::satisfies_bound):
	Added errorcode and user-friendly error message.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-1725-2.rs:
	Updated dejagnu message.

Signed-off-by: Muhammad Mahad <[email protected]>
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

These fixit messages are really amazing. That's really good work @MahadMuhammad, thank you so much

@CohenArthur CohenArthur added this pull request to the merge queue Aug 22, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Aug 22, 2023
@CohenArthur CohenArthur added this pull request to the merge queue Aug 23, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Aug 23, 2023
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

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

LGTM

@philberty philberty added the diagnostic diagnostic static analysis label Aug 28, 2023
@philberty philberty added this to the GCC 14 Stage 3 milestone Aug 28, 2023
@philberty philberty added this pull request to the merge queue Aug 28, 2023
Merged via the queue into Rust-GCC:master with commit e493d7e Aug 28, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic diagnostic static analysis
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants