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

Pass struct field HirId when check_expr_struct_fields #138460

Merged
merged 1 commit into from
Mar 15, 2025

Conversation

xizheyin
Copy link
Contributor

Fixes #138319

r? compiler

cc @Mark-Simulacrum

@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 13, 2025
@petrochenkov
Copy link
Contributor

There's a number of other check_stability calls using imprecise node IDs.
For example, in check_struct_pat_fields and check_pat_tuple_struct.
Could you fixup them as well?
@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 13, 2025
@xizheyin
Copy link
Contributor Author

I modified it. I'd love to fix the other parts, should I open a separate issue for this? Because this PR is for fixing #138319.
@petrochenkov

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 14, 2025
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
@xizheyin
Copy link
Contributor Author

I have fixed the three check_stability. But I have no idea about testing check_pat_tuple_struct, because the code below is not allowed. @petrochenkov

struct _Point(#[deprecated = "reason"]i32, i32);


fn main() {

    let p = _Point(10, 20);
    let _Point(#[expect(deprecated)]_x, ..) = p;
}

It report error

error: expected pattern, found `#`
 --> src/lib.rs:7:16
  |
7 |     let _Point(#[expect(deprecated)]_x, ..) = p;
  |                ^ expected pattern

@petrochenkov
Copy link
Contributor

Thanks!
@bors r+

But I have no idea about testing check_pat_tuple_struct, because the code below is not allowed.

It's ok to leave this case without a test, if attributes are later supported in that position, they will have a correct node id.

@bors
Copy link
Contributor

bors commented Mar 14, 2025

📌 Commit aad1db7 has been approved by petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 14, 2025
fmease added a commit to fmease/rust that referenced this pull request Mar 14, 2025
Pass struct field HirId when check_expr_struct_fields

Fixes rust-lang#138319

r? compiler

cc `@Mark-Simulacrum`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 14, 2025
Rollup of 8 pull requests

Successful merges:

 - rust-lang#138056 (rustc_target: Add target features for LoongArch v1.1)
 - rust-lang#138349 (Emit function declarations for functions with `#[linkage="extern_weak"]`)
 - rust-lang#138451 (Build GCC on CI with GCC, not Clang)
 - rust-lang#138454 (Improve post-merge workflow)
 - rust-lang#138460 (Pass struct field HirId when check_expr_struct_fields)
 - rust-lang#138482 (Fix HIR printing of parameters)
 - rust-lang#138507 (Mirror NetBSD sources)
 - rust-lang#138511 (Make `Parser::parse_expr_cond` public)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 15, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#138056 (rustc_target: Add target features for LoongArch v1.1)
 - rust-lang#138451 (Build GCC on CI with GCC, not Clang)
 - rust-lang#138454 (Improve post-merge workflow)
 - rust-lang#138460 (Pass struct field HirId when check_expr_struct_fields)
 - rust-lang#138474 (Refactor is_snake_case.)
 - rust-lang#138482 (Fix HIR printing of parameters)
 - rust-lang#138507 (Mirror NetBSD sources)
 - rust-lang#138511 (Make `Parser::parse_expr_cond` public)
 - rust-lang#138518 (Fix typo in hir lowering lint diag)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 43c41a8 into rust-lang:master Mar 15, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 15, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 15, 2025
Rollup merge of rust-lang#138460 - xizheyin:issue-138319, r=petrochenkov

Pass struct field HirId when check_expr_struct_fields

Fixes rust-lang#138319

r? compiler

cc ``@Mark-Simulacrum``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

Expect doesn't work on struct field
4 participants