Skip to content

hir_ty_lowering: avoid self type lookup for inherent aliases - #158637

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Dnreikronos:hir_ty_lowering/skip_inherent_projection_self_ty
Jul 5, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Dnreikronos:hir_ty_lowering/skip_inherent_projection_self_ty

Conversation

@Dnreikronos

@Dnreikronos Dnreikronos commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

fixes #158512

the crash happens while building the unsatisfied-bounds diagnostic for an inherent associated alias. that path was calling self_ty() directly, so an empty args list could panic under the global next solver.

imo the guard belongs in the diagnostic code. it keeps the existing span label when the inherent alias still has a self arg, and only skips that label when the args are already malformed.

@rustbot

rustbot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

HIR ty lowering was modified

cc @fmease

@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 Jul 1, 2026
@rustbot

rustbot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

r? @davidtwco

rustbot has assigned @davidtwco.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, types
  • compiler, types expanded to 73 candidates
  • Random selection from 16 candidates

@Dnreikronos
Dnreikronos marked this pull request as draft July 1, 2026 01:32
@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 Jul 1, 2026
@Dnreikronos
Dnreikronos marked this pull request as ready for review July 1, 2026 01:39
@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 Jul 1, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Dnreikronos
Dnreikronos marked this pull request as draft July 1, 2026 16:09
@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 Jul 1, 2026
@Dnreikronos
Dnreikronos force-pushed the hir_ty_lowering/skip_inherent_projection_self_ty branch from a451636 to f1d0307 Compare July 1, 2026 18:21
@Dnreikronos
Dnreikronos marked this pull request as ready for review July 1, 2026 20:30
@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 Jul 1, 2026
@davidtwco

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit f1d0307 has been approved by davidtwco

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@rust-bors rust-bors Bot 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 Jul 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 2, 2026
…nherent_projection_self_ty, r=davidtwco

hir_ty_lowering: avoid self type lookup for inherent aliases

fixes rust-lang#158512

the crash happens while building the unsatisfied-bounds diagnostic for an inherent associated alias. that path was calling `self_ty()` directly, so an empty args list could panic under the global next solver.

imo the guard belongs in the diagnostic code. it keeps the existing span label when the inherent alias still has a self arg, and only skips that label when the args are already malformed.
rust-bors Bot pushed a commit that referenced this pull request Jul 3, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #155429 (Support `u128`/`i128` c-variadic arguments)
 - #158100 (Emit retags in codegen to support BorrowSanitizer (part 4))
 - #158494 (Improve E0277 diagnostics for conditionally implemented traits)
 - #158606 (use ProjectionPredicate instead of AliasRelate)
 - #158627 (Simplify option-iterator flattening in the compiler)
 - #158658 (Update LLVM submodule)
 - #158665 (Revert "Remove redundant dyn-compatibility check.")
 - #158021 (Remove old MinGW workaround)
 - #158473 (Add `riscv32imfc-unknown-none-elf` bare-metal target)
 - #158549 (process::exec: using appropriate exit code on vxworks.)
 - #158585 (Improve diagnostic for too many super keywords)
 - #158637 (hir_ty_lowering: avoid self type lookup for inherent aliases)
 - #158651 (ptr doc: reduce use of unsafe block to where needed)
 - #158669 (Remove `src/tools/test-float-parse/Cargo.lock`)
 - #158674 (library: Polish transmute's `split_at_stdlib` example)
 - #158677 (Add extra splat tests)
 - #158680 (Avoid ICE for `NonZero<char>` in improper_ctypes)
 - #158681 (Remove unnecessary `Hash` derives from MIR types)
 - #158682 (Avoid delayed bug for disabled on_type_error arguments)
 - #158684 (Add missing generic test coverage for ```#[splat]```)
 - #158687 (Streamline `MacEager`)
 - #158688 (Cleanup attribute docs and add links to other mentioned attributes)
rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #155429 (Support `u128`/`i128` c-variadic arguments)
 - #158100 (Emit retags in codegen to support BorrowSanitizer (part 4))
 - #158494 (Improve E0277 diagnostics for conditionally implemented traits)
 - #158606 (use ProjectionPredicate instead of AliasRelate)
 - #158627 (Simplify option-iterator flattening in the compiler)
 - #158658 (Update LLVM submodule)
 - #158665 (Revert "Remove redundant dyn-compatibility check.")
 - #158021 (Remove old MinGW workaround)
 - #158473 (Add `riscv32imfc-unknown-none-elf` bare-metal target)
 - #158549 (process::exec: using appropriate exit code on vxworks.)
 - #158585 (Improve diagnostic for too many super keywords)
 - #158637 (hir_ty_lowering: avoid self type lookup for inherent aliases)
 - #158651 (ptr doc: reduce use of unsafe block to where needed)
 - #158669 (Remove `src/tools/test-float-parse/Cargo.lock`)
 - #158674 (library: Polish transmute's `split_at_stdlib` example)
 - #158677 (Add extra splat tests)
 - #158680 (Avoid ICE for `NonZero<char>` in improper_ctypes)
 - #158681 (Remove unnecessary `Hash` derives from MIR types)
 - #158682 (Avoid delayed bug for disabled on_type_error arguments)
 - #158684 (Add missing generic test coverage for ```#[splat]```)
 - #158687 (Streamline `MacEager`)
 - #158688 (Cleanup attribute docs and add links to other mentioned attributes)
rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #158100 (Emit retags in codegen to support BorrowSanitizer (part 4))
 - #158494 (Improve E0277 diagnostics for conditionally implemented traits)
 - #158606 (use ProjectionPredicate instead of AliasRelate)
 - #158627 (Simplify option-iterator flattening in the compiler)
 - #158658 (Update LLVM submodule)
 - #158665 (Revert "Remove redundant dyn-compatibility check.")
 - #158021 (Remove old MinGW workaround)
 - #158473 (Add `riscv32imfc-unknown-none-elf` bare-metal target)
 - #158549 (process::exec: using appropriate exit code on vxworks.)
 - #158585 (Improve diagnostic for too many super keywords)
 - #158637 (hir_ty_lowering: avoid self type lookup for inherent aliases)
 - #158651 (ptr doc: reduce use of unsafe block to where needed)
 - #158669 (Remove `src/tools/test-float-parse/Cargo.lock`)
 - #158674 (library: Polish transmute's `split_at_stdlib` example)
 - #158677 (Add extra splat tests)
 - #158680 (Avoid ICE for `NonZero<char>` in improper_ctypes)
 - #158681 (Remove unnecessary `Hash` derives from MIR types)
 - #158682 (Avoid delayed bug for disabled on_type_error arguments)
 - #158684 (Add missing generic test coverage for ```#[splat]```)
 - #158687 (Streamline `MacEager`)
 - #158688 (Cleanup attribute docs and add links to other mentioned attributes)
@rust-bors
rust-bors Bot merged commit d03da06 into rust-lang:main Jul 5, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jul 5, 2026
rust-timer added a commit that referenced this pull request Jul 5, 2026
Rollup merge of #158637 - Dnreikronos:hir_ty_lowering/skip_inherent_projection_self_ty, r=davidtwco

hir_ty_lowering: avoid self type lookup for inherent aliases

fixes #158512

the crash happens while building the unsatisfied-bounds diagnostic for an inherent associated alias. that path was calling `self_ty()` directly, so an empty args list could panic under the global next solver.

imo the guard belongs in the diagnostic code. it keeps the existing span label when the inherent alias still has a self arg, and only skips that label when the args are already malformed.
makai410 pushed a commit to makai410/rust that referenced this pull request Oct 1, 2026
…nathanBrouwer

Rollup of 21 pull requests

Successful merges:

 - rust-lang#158100 (Emit retags in codegen to support BorrowSanitizer (part 4))
 - rust-lang#158494 (Improve E0277 diagnostics for conditionally implemented traits)
 - rust-lang#158606 (use ProjectionPredicate instead of AliasRelate)
 - rust-lang#158627 (Simplify option-iterator flattening in the compiler)
 - rust-lang#158658 (Update LLVM submodule)
 - rust-lang#158665 (Revert "Remove redundant dyn-compatibility check.")
 - rust-lang#158021 (Remove old MinGW workaround)
 - rust-lang#158473 (Add `riscv32imfc-unknown-none-elf` bare-metal target)
 - rust-lang#158549 (process::exec: using appropriate exit code on vxworks.)
 - rust-lang#158585 (Improve diagnostic for too many super keywords)
 - rust-lang#158637 (hir_ty_lowering: avoid self type lookup for inherent aliases)
 - rust-lang#158651 (ptr doc: reduce use of unsafe block to where needed)
 - rust-lang#158669 (Remove `src/tools/test-float-parse/Cargo.lock`)
 - rust-lang#158674 (library: Polish transmute's `split_at_stdlib` example)
 - rust-lang#158677 (Add extra splat tests)
 - rust-lang#158680 (Avoid ICE for `NonZero<char>` in improper_ctypes)
 - rust-lang#158681 (Remove unnecessary `Hash` derives from MIR types)
 - rust-lang#158682 (Avoid delayed bug for disabled on_type_error arguments)
 - rust-lang#158684 (Add missing generic test coverage for ```#[splat]```)
 - rust-lang#158687 (Streamline `MacEager`)
 - rust-lang#158688 (Cleanup attribute docs and add links to other mentioned attributes)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Oct 1, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - rust-lang/rust#158100 (Emit retags in codegen to support BorrowSanitizer (part 4))
 - rust-lang/rust#158494 (Improve E0277 diagnostics for conditionally implemented traits)
 - rust-lang/rust#158606 (use ProjectionPredicate instead of AliasRelate)
 - rust-lang/rust#158627 (Simplify option-iterator flattening in the compiler)
 - rust-lang/rust#158658 (Update LLVM submodule)
 - rust-lang/rust#158665 (Revert "Remove redundant dyn-compatibility check.")
 - rust-lang/rust#158021 (Remove old MinGW workaround)
 - rust-lang/rust#158473 (Add `riscv32imfc-unknown-none-elf` bare-metal target)
 - rust-lang/rust#158549 (process::exec: using appropriate exit code on vxworks.)
 - rust-lang/rust#158585 (Improve diagnostic for too many super keywords)
 - rust-lang/rust#158637 (hir_ty_lowering: avoid self type lookup for inherent aliases)
 - rust-lang/rust#158651 (ptr doc: reduce use of unsafe block to where needed)
 - rust-lang/rust#158669 (Remove `src/tools/test-float-parse/Cargo.lock`)
 - rust-lang/rust#158674 (library: Polish transmute's `split_at_stdlib` example)
 - rust-lang/rust#158677 (Add extra splat tests)
 - rust-lang/rust#158680 (Avoid ICE for `NonZero<char>` in improper_ctypes)
 - rust-lang/rust#158681 (Remove unnecessary `Hash` derives from MIR types)
 - rust-lang/rust#158682 (Avoid delayed bug for disabled on_type_error arguments)
 - rust-lang/rust#158684 (Add missing generic test coverage for ```#[splat]```)
 - rust-lang/rust#158687 (Streamline `MacEager`)
 - rust-lang/rust#158688 (Cleanup attribute docs and add links to other mentioned attributes)
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]: index out of bounds: the len is 0 but the index is 0 (type_at(0))

4 participants