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

Fix diag span errors for bad_placeholder #116511

Closed

Conversation

chenyukang
Copy link
Member

Fixes #116502

@rustbot
Copy link
Collaborator

rustbot commented Oct 7, 2023

r? @compiler-errors

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 7, 2023
@lqd
Copy link
Member

lqd commented Oct 7, 2023

This should also fix #116473, right?

@chenyukang
Copy link
Member Author

This should also fix #116473, right?

no, seems the root cause is not same.

@chenyukang chenyukang marked this pull request as draft October 7, 2023 09:26
@chenyukang chenyukang force-pushed the yukang-fix-116502-span-errors branch from 949ee62 to bb24706 Compare October 7, 2023 09:33
@chenyukang chenyukang marked this pull request as ready for review October 7, 2023 09:35
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

Please explain why this actually fixes the bug -- there's no information in this PR about the root cause or the fix.

|
help: try replacing `_` with the type in the corresponding trait method signature
|
LL | {type error}
Copy link
Member

Choose a reason for hiding this comment

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

We probably should fix this suggestion anyways

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems the help diag you pointed out is another issue.

The root cause in the issue is we inserted duplicated span into HirPlaceholderCollector here:

self.0.push(t.span);

in the scenario of code like:

    macro_rules! m {
        () => {
            _         // This is the duplicated span ...
        };
    }
    struct S<T = m!()>(m!(), T)
    where
        T: Trait<m!()>;

This PR is trying to remove the duplicated ones, since we're mapping spans with same type type_name.

Maybe we need to use Set instead of Vec in HirPlaceholderCollector? I'm not sure about it.

@compiler-errors compiler-errors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 12, 2023
@Dylan-DPC
Copy link
Member

@chenyukang what's the status of this pr? thanks

@Dylan-DPC
Copy link
Member

Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks

@Dylan-DPC Dylan-DPC closed this Apr 8, 2024
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion fail in debug mode
5 participants