Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ~const in associated functions in trait impls #119705

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

fmease
Copy link
Member

@fmease fmease commented Jan 7, 2024

Fixes #119700.

@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2024

r? @TaKO8Ki

(rustbot has picked a reviewer for you, use r? to override)

@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 Jan 7, 2024
@fmease fmease added the F-effects `#![feature(effects)]` label Jan 7, 2024
@fmease fmease marked this pull request as draft January 7, 2024 17:30
@fmease
Copy link
Member Author

fmease commented Jan 7, 2024

Wait, the UI test is not a true reproducer for the linked issue, oops!

@fmease fmease 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 7, 2024
@fmease fmease marked this pull request as ready for review January 7, 2024 17:56
@fmease fmease 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 7, 2024
Copy link
Member

@compiler-errors compiler-errors left a 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()
Copy link
Member Author

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

Suggested change
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.

Copy link
Member

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.

@fmease
Copy link
Member Author

fmease commented Jan 7, 2024

@bors r=compiler-errors rollup

@bors
Copy link
Contributor

bors commented Jan 7, 2024

📌 Commit 3acc5a0 has been approved by compiler-errors

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 Jan 7, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 7, 2024
…-impls, r=compiler-errors

Support `~const` in associated functions in trait impls

Fixes rust-lang#119700.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 7, 2024
…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
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2024
…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
@bors bors merged commit 39b3ef1 into rust-lang:master Jan 8, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2024
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.
@fmease fmease deleted the tilde-const-assoc-fns-trait-impls branch January 8, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-effects `#![feature(effects)]` 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.

ICE: effects: no host param id for call in const yet no errors reported?
5 participants