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

Expect an array when expected and acutal types are both arrays during cast #138962

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xizheyin
Copy link
Contributor

Closing #138836

@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Mar 26, 2025
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 write a description for why this code fixes the issue and especially why it's not going to affect existing code.

My first reaction to this code is definitely not the right way to fix a diagnostics issue, since it is code that is exercised even when there are no failures.

@compiler-errors
Copy link
Member

@rustbot author

@rustbot rustbot 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 Mar 26, 2025
@xizheyin
Copy link
Contributor Author

xizheyin commented Mar 26, 2025

This is the handling of special circumstances. But I missed one condition.

This function checks when cast &m_expr as *const m_cast.

If the type m_expr is [ty1; N] and the type m_cast is [ty2; M], where M!=N, and ty1 is not [ty2; M], we need to use [ty1; N] instead of ty1 as the expected type.

The example is shown in the corresponding issue and the ui test newly added.

In this case, the code before and after modification will definitely report an error, so it will not affect the original logic. @compiler-errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

4 participants