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

Tracking Issue for the 2024 prelude #121042

Closed
6 tasks done
Noratrieb opened this issue Feb 13, 2024 · 13 comments
Closed
6 tasks done

Tracking Issue for the 2024 prelude #121042

Noratrieb opened this issue Feb 13, 2024 · 13 comments
Assignees
Labels
A-edition-2024 Area: The 2024 edition B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. S-tracking-ready-for-edition Status: This issue is ready for inclusion in the edition. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Noratrieb
Copy link
Member

Noratrieb commented Feb 13, 2024

Feature gate: #![feature(prelude_2024)]

This is a tracking issue for the 2024 prelude.

Public API

The 2024 prelude contains the following items in addition to all items in the 2024 prelude:

// core::prelude

pub mod rust_2024 {
    pub use super::rust_2021::*;
    pub use crate::future::{Future, IntoFuture};
}

And removes RustcEncodable, and RustcDecodable:

Steps

Related

Implementation History

Unresolved Questions

  • None yet.

cc @jhpratt @Nilstrieb @yoshuawuyts

@Noratrieb Noratrieb added B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Feb 13, 2024
@Noratrieb
Copy link
Member Author

@rust-lang/project-edition-2024 not sure how and where you want to track this in addition to the issue, but I created the issue to have something to link to.

@ehuss
Copy link
Contributor

ehuss commented Feb 13, 2024

Thanks @Nilstrieb. We are doing our tracking in https://hackmd.io/@klAMrLz3QN-4luTZek9cWA/H175lzyea, and I have added that to the list.

Do you know what migration concerns there are with this change? What breakage will it cause, and what is the plan to add a migration lint for that?

@Noratrieb
Copy link
Member Author

When TryFrom/TryInto were added into the prelude in 2021, no migration lint was provided from what I can tell. But I don't see a reason why adding a migration lint wouldn't be possible (though I can't imagine the impact being very large in practice, so it probably doesn't have the highest priority).

@Noratrieb
Copy link
Member Author

Noratrieb commented Feb 13, 2024

Basically the breaking is that the following two programs will now error with a method ambiguity error:

trait Uwu {
    fn poll(&self) {
        println!("uwu");
    }
}
impl<T> Uwu for T {}

fn main() {
    core::pin::pin!(async {}).poll();
}
trait Uwu {
    fn into_future(self) where Self: Sized {
        println!("uwu");
    }
}
impl<T> Uwu for T {}

fn main() {
    async {}.into_future();
}

@ehuss
Copy link
Contributor

ehuss commented Feb 13, 2024

rust-2021-prelude-collisions was used to handle the migration for TryFrom/TryInto. I would expect the migration lint would be similar to that.

@Noratrieb
Copy link
Member Author

Ah, I was searching for quite a bit but didn't find it. Then it should be pretty easy to extend the lint pass to also lint for a rust_2024_prelude_collisions.

@traviscross
Copy link
Contributor

We talked through the edition items in the lang call today, and one thing on the list was "Removing Rustc*codable from the prelude" (cc @jhpratt). Let's perhaps track that here also.

@Noratrieb Noratrieb self-assigned this Apr 11, 2024
@Noratrieb
Copy link
Member Author

I have not gotten to implement the lint yet, but I expect it to be quite simple. If anyone wants to implement, feel free to @rustbot claim and implement it. I do expect to get to it eventually though if no one else does it.

@jhpratt
Copy link
Member

jhpratt commented Apr 28, 2024

I intend on getting to it at some point. I'll claim whenever I start concrete work on it. Until that point, anyone should feel free to do it themself.

@traviscross traviscross added the S-tracking-needs-migration-lint Status: This item needs a migration lint. label May 21, 2024
@jhpratt
Copy link
Member

jhpratt commented Jun 2, 2024

I am beginning work on the lint for RustcEncodable and RustcDocodable. As a prelude removal rather than addition, it'll likely be different enough that there won't be any overlap in code. As such I will not be working on the other parts of the prelude lint.

@Noratrieb
Copy link
Member Author

I finally got around to implementing the migration lint for future in #125889.

@traviscross traviscross added S-tracking-impl-incomplete Status: The implementation is incomplete. and removed S-tracking-needs-migration-lint Status: This item needs a migration lint. labels Jun 4, 2024
@jhpratt
Copy link
Member

jhpratt commented Jul 3, 2024

As I just said on Zulip, I don't have a ton of time in the near future. If someone else would like to take over my side of the edition lint, please do so!

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 28, 2024
… r=compiler-errors

Add migration lint for 2024 prelude additions

This adds the migration lint for the newly ambiguous methods `poll` and `into_future`. When these methods are used on types implementing the respective traits, it will be ambiguous in the future, which can lead to hard errors or behavior changes depending on the exact circumstances.

tracked by rust-lang#121042

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
r? compiler-errors as the method prober
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 28, 2024
Rollup merge of rust-lang#125889 - Nilstrieb:migrate-into-the-future, r=compiler-errors

Add migration lint for 2024 prelude additions

This adds the migration lint for the newly ambiguous methods `poll` and `into_future`. When these methods are used on types implementing the respective traits, it will be ambiguous in the future, which can lead to hard errors or behavior changes depending on the exact circumstances.

tracked by rust-lang#121042

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
r? compiler-errors as the method prober
@traviscross traviscross added S-tracking-ready-for-edition Status: This issue is ready for inclusion in the edition. and removed S-tracking-impl-incomplete Status: The implementation is incomplete. labels Jul 28, 2024
@traviscross
Copy link
Contributor

@rustbot labels +S-tracking-ready-for-edition

Upon review, with recent work having been merged, this item is now ready for Rust 2024.

Thanks to @Noratrieb and @jhpratt for pushing this work forward, thanks to @ehuss for documentation, and thanks to the various reviewers who helped to get this work landed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2024 Area: The 2024 edition B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. S-tracking-ready-for-edition Status: This issue is ready for inclusion in the edition. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants