Skip to content

Conversation

@aerooneqq
Copy link
Contributor

@aerooneqq aerooneqq commented Dec 10, 2025

This PR adds support for inheriting attributes of the original function of the delegation and is a part of #118212, for now we inherit only #[must_use] attribute, but we can add other attributes to inherit. The list of processed attributes can be found here.

r? @petrochenkov

@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 Dec 10, 2025
@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

I don't quite like using HIR printing for testing the presence of attributes in HIR.
The printed output is produced automatically, not double checked by a human like //~ ERROR annotations, and lives far from the line that we want to check.

For other checks we have attributes like #[rustc_effective_visibility] (which prints effective visibility of the node it's applied to as an error) and similar.
Maybe we already have a similar #[rustc_*] attribute for printing HIR attributes?
If we don't, then it would be good to add it and use it for other HIR attribute checks too.

@petrochenkov petrochenkov 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 Dec 10, 2025
@aerooneqq aerooneqq force-pushed the inherit-attributes-in-delegation branch from 7d609d8 to c5c8bbd Compare December 11, 2025 13:17
@rustbot
Copy link
Collaborator

rustbot commented Dec 11, 2025

This PR was rebased onto a different main 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.

@aerooneqq
Copy link
Contributor Author

@rustbot ready

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

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Dec 12, 2025
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 12, 2025
@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 12, 2025
@rust-bors
Copy link

rust-bors bot commented Dec 12, 2025

☀️ Try build successful (CI)
Build commit: fda4cae (fda4cae02edbdfe083ce93cc7a50359cca323b44, parent: 2a3a62d26e9e5badb806ac6a43bb307ff472b514)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (fda4cae): comparison URL.

Overall result: no relevant changes - no action needed

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.

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

Instruction count

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

Max RSS (memory usage)

Results (primary -2.5%)

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)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.5% [-2.5%, -2.5%] 1

Cycles

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

Binary size

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

Bootstrap: 472.42s -> 475.83s (0.72%)
Artifact size: 389.33 MiB -> 389.32 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 12, 2025
@petrochenkov
Copy link
Contributor

r=me after squashing commits.

@petrochenkov petrochenkov added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 12, 2025
@aerooneqq aerooneqq force-pushed the inherit-attributes-in-delegation branch from f2d7361 to cff3732 Compare December 12, 2025 17:28
@aerooneqq
Copy link
Contributor Author

@rustbot ready

@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 Dec 12, 2025
@aerooneqq aerooneqq force-pushed the inherit-attributes-in-delegation branch from cff3732 to 0a3fd24 Compare December 12, 2025 17:35
@petrochenkov
Copy link
Contributor

@bors r+ rollup=maybe

@bors
Copy link
Collaborator

bors commented Dec 12, 2025

📌 Commit 0a3fd24 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 Dec 12, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Dec 13, 2025
…legation, r=petrochenkov

Inherit attributes in delegation

This PR adds support for inheriting attributes of the original function of the delegation and is a part of rust-lang#118212, for now we inherit only #[must_use] attribute, but we can add other attributes to inherit. The list of processed attributes can be found [here](https://github.com/aerooneqq/public-docs/blob/master/rust/delegation/processed_attributes.md).

r? `@petrochenkov`
bors added a commit that referenced this pull request Dec 13, 2025
Rollup of 11 pull requests

Successful merges:

 - #145278 (Update `rustc_codegen_gcc` rotate operation document)
 - #148825 (Add SystemTime::{MIN, MAX})
 - #148837 (Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`)
 - #149177 (Add proper suggestion for associated function with unknown field)
 - #149843 (Inherit attributes in delegation)
 - #149860 (Fix: Prevent macro-expanded extern crates from shadowing extern arguments)
 - #149874 (Weak for Arc pointer is marked as DynSend/DynSync)
 - #149903 (Remove unused code in `cfg_old`)
 - #149911 (bootstrap: Don't pass an unused `--color` to compiletest)
 - #149916 (Add a sanity check in case of any duplicate nodes)
 - #149924 (`declare_lint_pass` for `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Dec 13, 2025
Rollup of 10 pull requests

Successful merges:

 - #145278 (Update `rustc_codegen_gcc` rotate operation document)
 - #148837 (Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`)
 - #149177 (Add proper suggestion for associated function with unknown field)
 - #149843 (Inherit attributes in delegation)
 - #149860 (Fix: Prevent macro-expanded extern crates from shadowing extern arguments)
 - #149874 (Weak for Arc pointer is marked as DynSend/DynSync)
 - #149903 (Remove unused code in `cfg_old`)
 - #149911 (bootstrap: Don't pass an unused `--color` to compiletest)
 - #149916 (Add a sanity check in case of any duplicate nodes)
 - #149924 (`declare_lint_pass` for `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e7ba4a5 into rust-lang:main Dec 13, 2025
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 13, 2025
rust-timer added a commit that referenced this pull request Dec 13, 2025
Rollup merge of #149843 - aerooneqq:inherit-attributes-in-delegation, r=petrochenkov

Inherit attributes in delegation

This PR adds support for inheriting attributes of the original function of the delegation and is a part of #118212, for now we inherit only #[must_use] attribute, but we can add other attributes to inherit. The list of processed attributes can be found [here](https://github.com/aerooneqq/public-docs/blob/master/rust/delegation/processed_attributes.md).

r? ``@petrochenkov``
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.

6 participants