Skip to content

Query system cycle errors should be extendable with notes #53453

Open
@tristanburgess

Description

@tristanburgess

Relevant PR: #53316
Relevant Issue: #52985

The query system automatically detects and emits a cycle error if a cycle occurs when dependency nodes are added to the query DAG. This error is extensible with a custom main message defined as below to help human readability,

impl<'tcx> QueryDescription<'tcx> for queries::normalize_ty_after_erasing_regions<'tcx> {

but is otherwise closed for modification outside of the query::plumbing module:
pub(super) fn report_cycle(self, CycleError { usage, cycle: stack }: CycleError<'gcx>)

It would be nice to have a mechanism in addition that allows custom notes and suggestions to be added to these errors to help illustrate why a cycle occurred, not just where. It may be possible to expose the DiagnosticBuilder or provide wrappers for methods like span_suggestion() and span_note()

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions