Make const BorrowMut require const Borrow and make const Fn require const FnMut#147939
Merged
bors merged 3 commits intorust-lang:mainfrom Dec 17, 2025
Merged
Make const BorrowMut require const Borrow and make const Fn require const FnMut#147939bors merged 3 commits intorust-lang:mainfrom
const BorrowMut require const Borrow and make const Fn require const FnMut#147939bors merged 3 commits intorust-lang:mainfrom
Conversation
This file previously contained an error annotation with incorrect syntax. Remove this annotation, as per the dev guide, since this is marked as known-bug. https://rustc-dev-guide.rust-lang.org/tests/ui.html#known-bugs
Collaborator
oli-obk
reviewed
Oct 21, 2025
|
|
||
| fn main() { | ||
| (const || (()).foo())(); | ||
| // ^ ERROR: cannot call non-const method `<() as Foo>::foo` in constant functions |
Contributor
There was a problem hiding this comment.
We sometimes leave these in to keep some context for when someone fixes the test. Fine here tho
oli-obk
approved these changes
Oct 21, 2025
lcnr
reviewed
Oct 23, 2025
Contributor
|
idk if that should be part of this PR, regardless r? @oli-obk |
Collaborator
|
|
Contributor
|
@bors r+ rollup |
Collaborator
bors
added a commit
that referenced
this pull request
Dec 16, 2025
…uwer Rollup of 11 pull requests Successful merges: - #147939 (Make `const BorrowMut` require `const Borrow` and make `const Fn` require `const FnMut`) - #149734 (Mirror GCC 9.5.0) - #149767 (Tidying up tests/ui/issues 33 tests [4/N]) - #149804 (chore: fix some minor issues in the comments) - #149967 (custom `VaList` layout for Hexagon) - #150025 (dont create unnecessary `DefId`s under mgca) - #150032 (Use annotate-snippet as default emitter on stable) - #150033 (Add try_as_dyn and try_as_dyn_mut) - #150042 (rustc-dev-guide subtree update) - #150063 (Remove deny of manual-let-else) - #150064 (std: io: error: Add comment for UEFI unpacked repr use) Failed merges: - #150044 (Avoid unhelpful suggestion when crate name is invalid) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Dec 17, 2025
Rollup merge of #147939 - theemathas:add-const-supertrait, r=oli-obk Make `const BorrowMut` require `const Borrow` and make `const Fn` require `const FnMut` This makes it consistent with other const traits in the standard library with supertraits. I am currently unsure if `const FnMut` should require `const FnOnce` or not. See [zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/.5Bconst.5D.20implied.20bounds.20for.20implicit.20trait.20bounds/near/546152748).
github-actions bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Dec 17, 2025
…uwer Rollup of 11 pull requests Successful merges: - rust-lang/rust#147939 (Make `const BorrowMut` require `const Borrow` and make `const Fn` require `const FnMut`) - rust-lang/rust#149734 (Mirror GCC 9.5.0) - rust-lang/rust#149767 (Tidying up tests/ui/issues 33 tests [4/N]) - rust-lang/rust#149804 (chore: fix some minor issues in the comments) - rust-lang/rust#149967 (custom `VaList` layout for Hexagon) - rust-lang/rust#150025 (dont create unnecessary `DefId`s under mgca) - rust-lang/rust#150032 (Use annotate-snippet as default emitter on stable) - rust-lang/rust#150033 (Add try_as_dyn and try_as_dyn_mut) - rust-lang/rust#150042 (rustc-dev-guide subtree update) - rust-lang/rust#150063 (Remove deny of manual-let-else) - rust-lang/rust#150064 (std: io: error: Add comment for UEFI unpacked repr use) Failed merges: - rust-lang/rust#150044 (Avoid unhelpful suggestion when crate name is invalid) r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes it consistent with other const traits in the standard library with supertraits.
I am currently unsure if
const FnMutshould requireconst FnOnceor not. See zulip discussion.