Skip to content

Conversation

camsteffen
Copy link
Contributor

@camsteffen camsteffen commented Jul 28, 2025

Changes impl_trait_header to panic on inherent impls intstead of returning None. A few downstream functions are split into option and non-option returning functions. This gets rid of a lot of unwraps where we know we have a trait impl, while there are still some cases where the Option is helpful.

Summary of changes to tcx methods:

  • impl_is_of_trait (new)
  • impl_trait_header -> impl_trait_header/impl_opt_trait_header
  • impl_trait_ref -> impl_trait_ref/impl_opt_trait_ref
  • trait_id_of_impl -> impl_trait_id/impl_opt_trait_id
@rustbot
Copy link
Collaborator

rustbot commented Jul 28, 2025

r? @jackh726

rustbot has assigned @jackh726.
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 A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 28, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in compiler/rustc_sanitizers

cc @rcvalle

HIR ty lowering was modified

cc @fmease

@rust-log-analyzer

This comment has been minimized.

@lqd
Copy link
Member

lqd commented Jul 28, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jul 28, 2025
Limit impl_trait_header query to only trait impls
@rust-bors
Copy link

rust-bors bot commented Jul 28, 2025

⌛ Trying commit c4b4025 with merge a9207a1

To cancel the try build, run the command @bors try cancel.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 28, 2025
@rust-bors
Copy link

rust-bors bot commented Jul 28, 2025

💔 Test failed (CI). Failed jobs:

@camsteffen camsteffen force-pushed the impl-trait-header-option branch from c4b4025 to 35dbd1a Compare July 28, 2025 22:35
@camsteffen
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-bors
Copy link

rust-bors bot commented Jul 28, 2025

@camsteffen: 🔑 Insufficient privileges: not in try users

@rust-timer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lqd
Copy link
Member

lqd commented Jul 29, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jul 29, 2025
Limit impl_trait_header query to only trait impls
@rust-bors
Copy link

rust-bors bot commented Jul 29, 2025

⌛ Trying commit 35dbd1a with merge 60b45cb

To cancel the try build, run the command @bors try cancel.

@rust-bors
Copy link

rust-bors bot commented Jul 29, 2025

☀️ Try build successful (CI)
Build commit: 60b45cb (60b45cbaa7a7f0ea8340063c9bbac4ed081c245a, parent: cdccba87bf9ad5d87c1417eeb8fa52a4b614bbf9)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (60b45cb): comparison URL.

Overall result: ❌✅ regressions and improvements - BENCHMARK(S) FAILED

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

❗ ❗ ❗ ❗ ❗
Warning ⚠️: The following benchmark(s) failed to build:

  • eza-0.21.2
  • externs
  • include-blob
  • clap_derive-4.5.32
  • serde-1.0.219
  • wg-grammar
  • syn-2.0.101
  • unify-linearly
  • ucd
  • serde_derive-1.0.219
  • cranelift-codegen-0.119.0
  • regression-31157
  • diesel-2.2.10
  • bitmaps-3.2.1
  • hyper-1.6.0
  • ripgrep-14.1.1
  • tuple-stress
  • match-stress
  • ctfe-stress-5
  • derive
  • deeply-nested-multi
  • helloworld
  • unicode-normalization-0.1.24
  • wf-projection-stress-65510
  • coercions
  • stm32f4-0.15.1
  • issue-58319
  • html5ever-0.31.0
  • projection-caching
  • token-stream-stress
  • tt-muncher
  • serde-1.0.219-threads4
  • large-workspace
  • nalgebra-0.33.0
  • many-assoc-items
  • issue-46449
  • image-0.25.6
  • cargo-0.87.1
  • typenum-1.18.0
  • unused-warnings
  • await-call-tree
  • regex-automata-0.4.8
  • issue-88862
  • deep-vector
  • libc-0.2.172

❗ ❗ ❗ ❗ ❗

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
2.4% [0.2%, 3.7%] 9
Regressions ❌
(secondary)
0.5% [0.4%, 0.5%] 3
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 1
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) 2.1% [-0.2%, 3.7%] 10

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (secondary -2.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-3.1%, -2.3%] 5
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 469.046s -> 466.887s (-0.46%)
Artifact size: 376.81 MiB -> 376.87 MiB (0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 29, 2025
@camsteffen
Copy link
Contributor Author

camsteffen commented Jul 29, 2025

Y'all think that's funny? 😤

Fixed the rustdoc issues from above.

@camsteffen
Copy link
Contributor Author

camsteffen commented Oct 14, 2025

Replied and added some fixup commits that can be squashed.

I do feel like it would have been nice to initially simply rename the query to opt_impl_trait_ref and change impl_trait_ref to simply call that query and unwrap so that this change can be separately reviewed and merged.

Yeah that's fair. I did kinda do that with separate commits except I lumped in some changes to not use opt along with the rename. It seemed silly to do a simple rename that would leave opt().unwrap() so I guess I fixed those with the rename and then decided I may as well throw in more changes.

@lcnr
Copy link
Contributor

lcnr commented Oct 15, 2025

r=me after reverting the one change

@bors delegate+

@bors
Copy link
Collaborator

bors commented Oct 15, 2025

✌️ @camsteffen, you can now approve this pull request!

If @lcnr told you to "r=me" after making some further change, please make that change, then do @bors r=@lcnr

@camsteffen camsteffen force-pushed the impl-trait-header-option branch from 84cdf85 to d111d39 Compare October 16, 2025 21:33
@rustbot

This comment has been minimized.

@camsteffen
Copy link
Contributor Author

@bors r=lcnr

@bors
Copy link
Collaborator

bors commented Oct 16, 2025

📌 Commit d111d39 has been approved by lcnr

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 Oct 16, 2025
@camsteffen
Copy link
Contributor Author

@bors r- this will need a rebase after the Clippy update

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 16, 2025
@bors
Copy link
Collaborator

bors commented Oct 17, 2025

☔ The latest upstream changes (presumably #147779) made this pull request unmergeable. Please resolve the merge conflicts.

@camsteffen camsteffen force-pushed the impl-trait-header-option branch from d111d39 to d9a5389 Compare October 17, 2025 13:37
@rustbot
Copy link
Collaborator

rustbot commented Oct 17, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@camsteffen
Copy link
Contributor Author

@bors r=lcnr

@bors
Copy link
Collaborator

bors commented Oct 17, 2025

📌 Commit d9a5389 has been approved by lcnr

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 17, 2025
bors added a commit that referenced this pull request Oct 18, 2025
Limit impl_trait_header query to only trait impls Changes `impl_trait_header` to panic on inherent impls intstead of returning None. A few downstream functions are split into option and non-option returning functions. This gets rid of a lot of unwraps where we know we have a trait impl, while there are still some cases where the Option is helpful. Summary of changes to tcx methods: * `impl_is_of_trait` (new) * `impl_trait_header` -> `impl_trait_header`/`impl_opt_trait_header` * `impl_trait_ref` -> `impl_trait_ref`/`impl_opt_trait_ref` * `trait_id_of_impl` -> `impl_trait_id`/`impl_opt_trait_id`
@bors
Copy link
Collaborator

bors commented Oct 18, 2025

⌛ Testing commit d9a5389 with merge 2170b4d...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. perf-regression Performance regression. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

10 participants