Skip to content

Comments

Implement RFC 3678: Final trait methods#151783

Merged
rust-bors[bot] merged 7 commits intorust-lang:mainfrom
mu001999-contrib:impl/final-method
Feb 17, 2026
Merged

Implement RFC 3678: Final trait methods#151783
rust-bors[bot] merged 7 commits intorust-lang:mainfrom
mu001999-contrib:impl/final-method

Conversation

@mu001999
Copy link
Contributor

@mu001999 mu001999 commented Jan 28, 2026

Tracking: #131179

This PR is based on #130802, with some minor changes and conflict resolution.

Futhermore, this PR excludes final methods from the vtable of a dyn Trait.

And some excerpt from the original PR description:

Implements the surface part of rust-lang/rfcs#3678.

I'm using the word "method" in the title, but in the diagnostics and the feature gate I used "associated function", since that's more accurate.

cc @joshtriplett

@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2026

Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs

cc @ZuseZ4

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels Jan 28, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2026

r? @fee1-dead

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

@fmease
Copy link
Member

fmease commented Jan 28, 2026

Could you mark errs as a coauthor in all 6 commits, I think that's only fair. Thanks! :)

Namely: Co-authored-by: Michael Goulet <[email protected]>

@mu001999
Copy link
Contributor Author

@fmease Done. Thanks for the reminder! :)

@joshtriplett
Copy link
Member

What it doesn't implement are any optimizations that can be done on final trait methods, such as excluding them from the vtable of a dyn Trait.

Does this implement the requirement that final methods don't prevent a trait from being dyn-compatible?

@mu001999

This comment was marked as outdated.

@mu001999 mu001999 marked this pull request as draft January 30, 2026 12:48
@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 Jan 30, 2026
@mu001999 mu001999 marked this pull request as ready for review January 30, 2026 14:31
@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 Jan 30, 2026
@mu001999
Copy link
Contributor Author

mu001999 commented Jan 30, 2026

Does this implement the requirement that final methods don't prevent a trait from being dyn-compatible?

Implemented now :). Also, updated the PR description.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@fee1-dead
Copy link
Member

LGTM, can iterate on it later
@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 17, 2026

📌 Commit 8c77b6c has been approved by fee1-dead

It is now in the queue for this repository.

@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 Feb 17, 2026
rust-bors bot pushed a commit that referenced this pull request Feb 17, 2026
Rollup of 11 pull requests

Successful merges:

 - #152700 (miri subtree update)
 - #152715 (`rust-analyzer` subtree update)
 - #151783 (Implement RFC 3678: Final trait methods)
 - #152512 (core: Implement feature `float_exact_integer_constants`)
 - #152661 (Avoid ICE in From/TryFrom diagnostic under -Znext-solver)
 - #152703 (Remove `rustc_query_system`)
 - #152206 (misc doc improvements)
 - #152664 (Fix mis-constructed `file_span` when generating scraped examples)
 - #152698 (Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`)
 - #152727 (`probe_op` silence ambiguity errors if tainted)
 - #152728 (Port #![default_lib_allocator] to the new attribute parser)
@rust-bors rust-bors bot merged commit 1367126 into rust-lang:main Feb 17, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 17, 2026
rust-timer added a commit that referenced this pull request Feb 17, 2026
Rollup merge of #151783 - mu001999-contrib:impl/final-method, r=fee1-dead

Implement RFC 3678: Final trait methods

Tracking: #131179

This PR is based on #130802, with some minor changes and conflict resolution.

Futhermore, this PR excludes final methods from the vtable of a dyn Trait.

And some excerpt from the original PR description:
> Implements the surface part of rust-lang/rfcs#3678.
>
> I'm using the word "method" in the title, but in the diagnostics and the feature gate I used "associated function", since that's more accurate.

cc @joshtriplett
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 18, 2026
… r=fmease

Update tracking issue number for final_associated_functions

From rust-lang#151783 (comment)
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 18, 2026
… r=fmease

Update tracking issue number for final_associated_functions

From rust-lang#151783 (comment)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 18, 2026
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#152700 (miri subtree update)
 - rust-lang/rust#152715 (`rust-analyzer` subtree update)
 - rust-lang/rust#151783 (Implement RFC 3678: Final trait methods)
 - rust-lang/rust#152512 (core: Implement feature `float_exact_integer_constants`)
 - rust-lang/rust#152661 (Avoid ICE in From/TryFrom diagnostic under -Znext-solver)
 - rust-lang/rust#152703 (Remove `rustc_query_system`)
 - rust-lang/rust#152206 (misc doc improvements)
 - rust-lang/rust#152664 (Fix mis-constructed `file_span` when generating scraped examples)
 - rust-lang/rust#152698 (Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`)
 - rust-lang/rust#152727 (`probe_op` silence ambiguity errors if tainted)
 - rust-lang/rust#152728 (Port #![default_lib_allocator] to the new attribute parser)
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 18, 2026
… r=fmease

Update tracking issue number for final_associated_functions

From rust-lang#151783 (comment)
rust-timer added a commit that referenced this pull request Feb 18, 2026
Rollup merge of #152778 - mu001999-contrib:fix/final-method, r=fmease

Update tracking issue number for final_associated_functions

From #151783 (comment)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 19, 2026
Update tracking issue number for final_associated_functions

From rust-lang/rust#151783 (comment)
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 19, 2026
…, r=fee1-dead

Implement RFC 3678: Final trait methods

Tracking: rust-lang#131179

This PR is based on rust-lang#130802, with some minor changes and conflict resolution.

Futhermore, this PR excludes final methods from the vtable of a dyn Trait.

And some excerpt from the original PR description:
> Implements the surface part of rust-lang/rfcs#3678.
>
> I'm using the word "method" in the title, but in the diagnostics and the feature gate I used "associated function", since that's more accurate.

cc @joshtriplett
@mu001999 mu001999 deleted the impl/final-method branch February 20, 2026 09:10
github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Feb 23, 2026
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#152700 (miri subtree update)
 - rust-lang/rust#152715 (`rust-analyzer` subtree update)
 - rust-lang/rust#151783 (Implement RFC 3678: Final trait methods)
 - rust-lang/rust#152512 (core: Implement feature `float_exact_integer_constants`)
 - rust-lang/rust#152661 (Avoid ICE in From/TryFrom diagnostic under -Znext-solver)
 - rust-lang/rust#152703 (Remove `rustc_query_system`)
 - rust-lang/rust#152206 (misc doc improvements)
 - rust-lang/rust#152664 (Fix mis-constructed `file_span` when generating scraped examples)
 - rust-lang/rust#152698 (Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`)
 - rust-lang/rust#152727 (`probe_op` silence ambiguity errors if tainted)
 - rust-lang/rust#152728 (Port #![default_lib_allocator] to the new attribute parser)
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Feb 23, 2026
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#152700 (miri subtree update)
 - rust-lang/rust#152715 (`rust-analyzer` subtree update)
 - rust-lang/rust#151783 (Implement RFC 3678: Final trait methods)
 - rust-lang/rust#152512 (core: Implement feature `float_exact_integer_constants`)
 - rust-lang/rust#152661 (Avoid ICE in From/TryFrom diagnostic under -Znext-solver)
 - rust-lang/rust#152703 (Remove `rustc_query_system`)
 - rust-lang/rust#152206 (misc doc improvements)
 - rust-lang/rust#152664 (Fix mis-constructed `file_span` when generating scraped examples)
 - rust-lang/rust#152698 (Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`)
 - rust-lang/rust#152727 (`probe_op` silence ambiguity errors if tainted)
 - rust-lang/rust#152728 (Port #![default_lib_allocator] to the new attribute parser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-json Area: Rustdoc JSON backend 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. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants