Skip to content

Conversation

MahadMuhammad
Copy link
Contributor

trait cycle detected - E0391

This errorcode & message emits when cycle
detected when computing the super predicates
of x which requires computing the super
predicates of y, which again requires
computing the super predicates of x,
completing the cycle.

Code Tested:

~/gccrs/gcc/testsuite/rust/compile/trait-cycle.rs:1:5: error: cycle detected when computing the super predicates of ‘FirstTrait[E0391]
    1 | pub trait FirstTrait: SecondTrait {}
      |     ^~~~~
~/gccrs/gcc/testsuite/rust/compile/trait-cycle.rs:3:5: error: cycle detected when computing the super predicates of ‘SecondTrait[E0391]
    3 | pub trait SecondTrait: FirstTrait {}
      |     ^~~~~


gcc/rust/ChangeLog:

* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Updated errorcode & more userfriendly message.

gcc/testsuite/ChangeLog:

* rust/compile/issue-1589.rs: Updated comment for dejagnu.
* rust/compile/trait-cycle.rs: New relevant test.

This errorcode & message emits when cycle
detected when computing the super predicates
of `x` which requires computing the super
predicates of `y`, which again requires
computing the super predicates of `x`,
completing the cycle.

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait):
	Updated errorcode & more userfriendly message.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-1589.rs: Updated comment for dejagnu.
	* rust/compile/trait-cycle.rs: New relevant test.

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

@philberty philberty added this pull request to the merge queue Aug 17, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Aug 17, 2023
@CohenArthur CohenArthur added this pull request to the merge queue Aug 17, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Aug 17, 2023
@CohenArthur CohenArthur added this pull request to the merge queue Aug 17, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Aug 17, 2023
@CohenArthur CohenArthur added this pull request to the merge queue Aug 18, 2023
Merged via the queue into Rust-GCC:master with commit 879a62f Aug 18, 2023
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.

3 participants