Skip to content

Conversation

@Randl
Copy link
Contributor

@Randl Randl commented Jul 8, 2025

@rustbot
Copy link
Collaborator

rustbot commented Jul 8, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 8, 2025
Copy link
Contributor

@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.

This is fine, though it doesn't fix other things like (T,): [const] Clone.

It would be nice if you added tests for this, either in tests/ui/traits/const-traits or as a library test.

@compiler-errors
Copy link
Contributor

@rustbot author

r? compiler-errors

@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 Jul 8, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 8, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Randl
Copy link
Contributor Author

Randl commented Jul 8, 2025

There is a problem that I'm not sure is a bug, which locks the constifying of other impls. If I add derive_const to something, in lib I get an error

error: const stability on the impl does not match the const stability on the trait
   --> library/core/src/ascii/ascii_char.rs:59:16
    |
59  |   #[derive_const(Clone)]
    |                  ^^^^^ in this derive macro expansion
    |
   ::: library/core/src/clone.rs:225:1
    |
225 | / pub macro Clone($item:item) {
226 | |     /* compiler built-in */
227 | | }
    | |_- in this expansion of `#[derive(Clone)]`
    |
note: this impl is (implicitly) stable...
   --> library/core/src/ascii/ascii_char.rs:59:16
    |
59  |   #[derive_const(Clone)]
    |                  ^^^^^ in this derive macro expansion
    |
   ::: library/core/src/clone.rs:225:1
    |
225 | / pub macro Clone($item:item) {
226 | |     /* compiler built-in */
227 | | }
    | |_- in this expansion of `#[derive(Clone)]`
note: ...but the trait is unstable
   --> library/core/src/clone.rs:162:11
    |
162 | pub trait Clone: Sized {
    |           ^^^^^

even though I add

#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
#[derive_const(Clone)]

I think the interplay of const stability and derive_const is bugged, but I'm not sure

@Randl
Copy link
Contributor Author

Randl commented Jul 8, 2025

@rustbot ready

@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 Jul 8, 2025
@Randl Randl force-pushed the const-clone branch 2 times, most recently from badee77 to b094209 Compare July 8, 2025 17:58
@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 Jul 16, 2025
@Randl
Copy link
Contributor Author

Randl commented Jul 20, 2025

@rustbot ready

@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 Jul 20, 2025
@Randl
Copy link
Contributor Author

Randl commented Jul 21, 2025

I've added some more impls

@rust-log-analyzer

This comment has been minimized.

@Randl Randl force-pushed the const-clone branch 2 times, most recently from 6161a90 to 2eb86a4 Compare July 21, 2025 09:46
@compiler-errors
Copy link
Contributor

r? oli-obk

@rustbot rustbot assigned oli-obk and unassigned compiler-errors Sep 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2025

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

@oli-obk oli-obk 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 Sep 15, 2025
@oli-obk oli-obk removed the request for review from compiler-errors September 15, 2025 08:59
@Randl Randl changed the title Add impl const for Clone Add impl const for Clone and derive_const for cmp and Default traits Sep 28, 2025
@rustbot

This comment has been minimized.

@Randl
Copy link
Contributor Author

Randl commented Sep 28, 2025

@rustbot ready

there are still some questions in the discussions I left open

@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 Sep 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 30, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Randl Randl requested a review from oli-obk October 16, 2025 04:33
@Randl
Copy link
Contributor Author

Randl commented Oct 21, 2025

Apparently most of this was already done in #146976
I'll go ahead and close it.

@Randl Randl closed this Oct 21, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 21, 2025
jdonszelmann added a commit to jdonszelmann/rust that referenced this pull request Jan 11, 2026
Add const cloning of slices and tests

As discussed in rust-lang#143628 (comment), splitting off slice cloning as a separate PR.
r? @tgross35
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 11, 2026
Add const cloning of slices and tests

As discussed in rust-lang#143628 (comment), splitting off slice cloning as a separate PR.
r? @tgross35
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 11, 2026
Add const cloning of slices and tests

As discussed in rust-lang#143628 (comment), splitting off slice cloning as a separate PR.
r? @tgross35
rust-timer added a commit that referenced this pull request Jan 12, 2026
Rollup merge of #147938 - const-clone-slice, r=tgross35

Add const cloning of slices and tests

As discussed in #143628 (comment), splitting off slice cloning as a separate PR.
r? @tgross35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants