Skip to content

Improve Error Message about Self-Referential Types#727

Open
InsertCreativityHere wants to merge 2 commits intoicerpc:mainfrom
InsertCreativityHere:type-cycle-message-improvement
Open

Improve Error Message about Self-Referential Types#727
InsertCreativityHere wants to merge 2 commits intoicerpc:mainfrom
InsertCreativityHere:type-cycle-message-improvement

Conversation

@InsertCreativityHere
Copy link
Member

@InsertCreativityHere InsertCreativityHere commented Feb 12, 2026

We talked about this last week and agreed that "X has infinite size" is not a meaningfully helpful message.

"E047",
InfiniteSizeCycle,
format!("self-referential type {type_id} has infinite size: {cycle}"),
format!("disallowed type cycle; type {type_id} references itself: {cycle}"),
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer a clearer error message, for example:

type {type_id} cannot reference itself: {cycle}

Copy link
Member Author

Choose a reason for hiding this comment

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

What about: type {type_id} illegally references itself: {cycle}?

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.

2 participants