-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Support ~const
in associated functions in trait impls
#119705
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support ~const
in associated functions in trait impls
#119705
Conversation
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
Wait, the UI test is not a true reproducer for the linked issue, oops! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm somewhat shocked that we didn't support this previously. r=me
|
||
impl const Main for () { | ||
fn compute<T: ~const Aux>() -> u32 { | ||
T::generate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, the UI test is not a true reproducer for the linked issue, oops!
Well, it would be a reproducer of the ICE if I replaced the body with 0
T::generate() | |
0 |
but then the test would become a bit boring since we wouldn't actually use anything from ~const Aux
. With T::generate()
nightly rustc incorrectly fails with mismatched types // expected `host`, found `true`
since the ICE is a delayed bug. Ofc I could add revisions to this test or another file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not that big of a deal. Showing that it doesn't ICE (we can lower the where clause) and that it works correctly seems like a fine test.
@bors r=compiler-errors rollup |
…-impls, r=compiler-errors Support `~const` in associated functions in trait impls Fixes rust-lang#119700.
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#116129 (Rewrite `pin` module documentation to clarify usage and invariants) - rust-lang#119702 (Miri subtree update) - rust-lang#119703 (Impl trait tweaks) - rust-lang#119705 (Support `~const` in associated functions in trait impls) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#116129 (Rewrite `pin` module documentation to clarify usage and invariants) - rust-lang#119703 (Impl trait diagnostic tweaks) - rust-lang#119705 (Support `~const` in associated functions in trait impls) - rust-lang#119708 (Unions are not `PointerLike`) - rust-lang#119711 (Delete unused makefile in tests/ui) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#119705 - fmease:tilde-const-assoc-fns-trait-impls, r=compiler-errors Support `~const` in associated functions in trait impls Fixes rust-lang#119700.
Fixes #119700.