Skip to content

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Aug 19, 2025

This fixes the set of traits implemented for function items. Fn family traits are not implemented in some cases. This is roughly implemented in assemble_fn_pointer_candidates.

I did not include "has variadic", since that also requires unsafe and extern "C" and is thus covered by the other rules, AFAIK. Could also add that to CYA, though.

Fixes #1968

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Aug 19, 2025
This fixes the set of traits implemented for function items. `Fn` family
traits are not implemented in some cases. This is roughly implemented in
[`assemble_fn_pointer_candidates`](https://github.com/rust-lang/rust/blob/8c32e313cccf7df531e2d49ffb8227bb92304aee/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L553-L585).

I did not include "has variadic", since that also requires unsafe and
extern "C" and is thus covered by the other rules, AFAIK. Could also add
that to CYA, though.

Fixes rust-lang#1968
@traviscross traviscross enabled auto-merge August 19, 2025 21:38
@traviscross traviscross added this pull request to the merge queue Aug 19, 2025
Merged via the queue into rust-lang:master with commit 46e5bc8 Aug 19, 2025
5 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Aug 19, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 25, 2025
Update books

## rust-lang/nomicon

1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf
2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC

- Fix unknown field `author` error when building the book (rust-lang/nomicon#500)

## rust-lang/reference

11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769
2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC

- Update `instruction_set` to use the attribute template (rust-lang/reference#1912)
- Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922)
- Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923)
- Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941)
- Switch to using native mdbook fragment redirects (rust-lang/reference#1965)
- Fix traits implemented for function items (rust-lang/reference#1969)
- Clarify that safe extern items do not require unsafe (rust-lang/reference#1970)
- Update `type_length_limit` to use the attribute template (rust-lang/reference#1917)
- Add missing rule identifier for const outer generics (rust-lang/reference#1962)
- Fix indentation of static path restriction text (rust-lang/reference#1961)
- Add doc for `sse4a` and `tbm` (rust-lang/reference#1949)

## rust-lang/rust-by-example

2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f
2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC

- Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952)
- Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 26, 2025
Update books

## rust-lang/nomicon

1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf
2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC

- Fix unknown field `author` error when building the book (rust-lang/nomicon#500)

## rust-lang/reference

11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769
2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC

- Update `instruction_set` to use the attribute template (rust-lang/reference#1912)
- Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922)
- Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923)
- Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941)
- Switch to using native mdbook fragment redirects (rust-lang/reference#1965)
- Fix traits implemented for function items (rust-lang/reference#1969)
- Clarify that safe extern items do not require unsafe (rust-lang/reference#1970)
- Update `type_length_limit` to use the attribute template (rust-lang/reference#1917)
- Add missing rule identifier for const outer generics (rust-lang/reference#1962)
- Fix indentation of static path restriction text (rust-lang/reference#1961)
- Add doc for `sse4a` and `tbm` (rust-lang/reference#1949)

## rust-lang/rust-by-example

2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f
2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC

- Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952)
- Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 26, 2025
Update books

## rust-lang/nomicon

1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf
2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC

- Fix unknown field `author` error when building the book (rust-lang/nomicon#500)

## rust-lang/reference

11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769
2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC

- Update `instruction_set` to use the attribute template (rust-lang/reference#1912)
- Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922)
- Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923)
- Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941)
- Switch to using native mdbook fragment redirects (rust-lang/reference#1965)
- Fix traits implemented for function items (rust-lang/reference#1969)
- Clarify that safe extern items do not require unsafe (rust-lang/reference#1970)
- Update `type_length_limit` to use the attribute template (rust-lang/reference#1917)
- Add missing rule identifier for const outer generics (rust-lang/reference#1962)
- Fix indentation of static path restriction text (rust-lang/reference#1961)
- Add doc for `sse4a` and `tbm` (rust-lang/reference#1949)

## rust-lang/rust-by-example

2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f
2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC

- Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952)
- Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
rust-timer added a commit to rust-lang/rust that referenced this pull request Aug 26, 2025
Rollup merge of #145856 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/nomicon

1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf
2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC

- Fix unknown field `author` error when building the book (rust-lang/nomicon#500)

## rust-lang/reference

11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769
2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC

- Update `instruction_set` to use the attribute template (rust-lang/reference#1912)
- Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922)
- Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923)
- Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941)
- Switch to using native mdbook fragment redirects (rust-lang/reference#1965)
- Fix traits implemented for function items (rust-lang/reference#1969)
- Clarify that safe extern items do not require unsafe (rust-lang/reference#1970)
- Update `type_length_limit` to use the attribute template (rust-lang/reference#1917)
- Add missing rule identifier for const outer generics (rust-lang/reference#1962)
- Fix indentation of static path restriction text (rust-lang/reference#1961)
- Add doc for `sse4a` and `tbm` (rust-lang/reference#1949)

## rust-lang/rust-by-example

2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f
2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC

- Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952)
- Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
github-actions bot pushed a commit to rust-lang/compiler-builtins that referenced this pull request Aug 28, 2025
Update books

## rust-lang/nomicon

1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf
2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC

- Fix unknown field `author` error when building the book (rust-lang/nomicon#500)

## rust-lang/reference

11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769
2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC

- Update `instruction_set` to use the attribute template (rust-lang/reference#1912)
- Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922)
- Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923)
- Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941)
- Switch to using native mdbook fragment redirects (rust-lang/reference#1965)
- Fix traits implemented for function items (rust-lang/reference#1969)
- Clarify that safe extern items do not require unsafe (rust-lang/reference#1970)
- Update `type_length_limit` to use the attribute template (rust-lang/reference#1917)
- Add missing rule identifier for const outer generics (rust-lang/reference#1962)
- Fix indentation of static path restriction text (rust-lang/reference#1961)
- Add doc for `sse4a` and `tbm` (rust-lang/reference#1949)

## rust-lang/rust-by-example

2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f
2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC

- Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952)
- Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not all function items implement Fn* traits
3 participants