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

Do not write user type annotation for const param value path #138284

Merged
merged 2 commits into from
Mar 12, 2025

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Mar 9, 2025

As I noted in the code comment, DefKind::ConstParam isn't actually generic over its own args, we just use the identity args from the body when lowering the value path so we have something to plug into the EarlyBinder we get back from type_of for the const param. So skip over it in write_user_type_annotation_from_args.

Somewhat unrelated, but I left an explanation for a somewhat mysterious quirk in the THIR lowering of user type annotations for patterns having to do with ctors and their type_of not actually being the type of the pattern node it's ascribing.

Fixes #138048

r? @BoxyUwU

@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 9, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2025

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

Some changes occurred in match checking

cc @Nadrieril

@BoxyUwU
Copy link
Member

BoxyUwU commented Mar 11, 2025

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 11, 2025

📌 Commit 8ab05ad has been approved by BoxyUwU

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 11, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 11, 2025
…otation, r=BoxyUwU

Do not write user type annotation for const param value path

As I noted in the code comment, `DefKind::ConstParam` isn't actually *generic* over its own args, we just use the identity args from the body when lowering the value path so we have something to plug into the `EarlyBinder` we get back from `type_of` for the const param. So skip over it in `write_user_type_annotation_from_args`.

Somewhat unrelated, but I left an explanation for a somewhat mysterious quirk in the THIR lowering of user type annotations for patterns having to do with ctors and their `type_of` not actually being the type of the pattern node it's ascribing.

Fixes rust-lang#138048

r? `@BoxyUwU`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2025
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#137715 (Allow int literals for pattern types with int base types)
 - rust-lang#138002 (Disable CFI for weakly linked syscalls)
 - rust-lang#138051 (Add support for downloading GCC from CI)
 - rust-lang#138231 (Prevent ICE in autodiff validation by emitting user-friendly errors)
 - rust-lang#138245 (stabilize `ci_rustc_if_unchanged_logic` test for local environments)
 - rust-lang#138256 (Do not feed anon const a type that references generics that it does not have)
 - rust-lang#138284 (Do not write user type annotation for const param value path)
 - rust-lang#138296 (Remove `AdtFlags::IS_ANONYMOUS` and `Copy`/`Clone` condition for anonymous ADT)
 - rust-lang#138352 (miri native_calls: ensure we actually expose *mutable* provenance to the memory FFI can access)
 - rust-lang#138354 (remove redundant `body`  arguments)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 16ff824 into rust-lang:master Mar 12, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 12, 2025
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Mar 14, 2025
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#137715 (Allow int literals for pattern types with int base types)
 - rust-lang#138002 (Disable CFI for weakly linked syscalls)
 - rust-lang#138051 (Add support for downloading GCC from CI)
 - rust-lang#138231 (Prevent ICE in autodiff validation by emitting user-friendly errors)
 - rust-lang#138245 (stabilize `ci_rustc_if_unchanged_logic` test for local environments)
 - rust-lang#138256 (Do not feed anon const a type that references generics that it does not have)
 - rust-lang#138284 (Do not write user type annotation for const param value path)
 - rust-lang#138296 (Remove `AdtFlags::IS_ANONYMOUS` and `Copy`/`Clone` condition for anonymous ADT)
 - rust-lang#138352 (miri native_calls: ensure we actually expose *mutable* provenance to the memory FFI can access)
 - rust-lang#138354 (remove redundant `body`  arguments)

r? `@ghost`
`@rustbot` modify labels: rollup
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.

ICE when using a constant as a pattern
4 participants