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

Convert some Into impls into From impls #134949

Merged
merged 1 commit into from
Dec 31, 2024
Merged

Conversation

compiler-errors
Copy link
Member

From the From docs:

One should always prefer implementing From over Into because implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Only implement Into when targeting a version prior to Rust 1.41 and converting to a type outside the current crate. From was not able to do these types of conversions in earlier versions because of Rust’s orphaning rules. See Into for more details.

Some of these impls are likely from before 1.41, and then some others were probably just mistakes. Building nightly rust is definitely not supported on 1.41, so let's modernize these impls :D

@rustbot
Copy link
Collaborator

rustbot commented Dec 31, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
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 A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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 Dec 31, 2024
@rustbot
Copy link
Collaborator

rustbot commented Dec 31, 2024

Some changes occurred in need_type_info.rs

cc @lcnr

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @rust-lang/wg-const-eval

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @TaKO8Ki

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, you can r=me after PR CI is green.

@jieyouxu jieyouxu assigned jieyouxu and unassigned wesleywiser Dec 31, 2024
@compiler-errors
Copy link
Member Author

@bors r=jieyouxu rollup

@bors
Copy link
Contributor

bors commented Dec 31, 2024

📌 Commit aea2a6f has been approved by jieyouxu

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 Dec 31, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 31, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#134919 (bootstrap: Make `./x test compiler` actually run the compiler unit tests)
 - rust-lang#134927 (Make slice::as_flattened_mut unstably const)
 - rust-lang#134930 (ptr docs: make it clear that we are talking only about memory accesses)
 - rust-lang#134932 (explicitly set float ABI for all ARM targets)
 - rust-lang#134933 (Make sure we check the future type is `Sized` in `AsyncFn*`)
 - rust-lang#134934 (Fix typos)
 - rust-lang#134941 (compiler: Add a statement-of-intent to `rustc_abi`)
 - rust-lang#134949 (Convert some `Into` impls into `From` impls)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2491eda into rust-lang:master Dec 31, 2024
6 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 31, 2024
Rollup merge of rust-lang#134949 - compiler-errors:froms, r=jieyouxu

Convert some `Into` impls into `From` impls

From the [`From`](https://doc.rust-lang.org/std/convert/trait.From.html) docs:

> One should always prefer implementing `From` over [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) because implementing `From` automatically provides one with an implementation of [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) thanks to the blanket implementation in the standard library.
>
> Only implement [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) when targeting a version prior to Rust 1.41 and converting to a type outside the current crate. `From` was not able to do these types of conversions in earlier versions because of Rust’s orphaning rules. See [Into](https://doc.rust-lang.org/std/convert/trait.Into.html) for more details.

Some of these impls are likely from before 1.41, and then some others were probably just mistakes. Building nightly rust is definitely not supported on 1.41, so let's modernize these impls :D
@rustbot rustbot added this to the 1.85.0 milestone Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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.

5 participants