5

Stabilize RFC3324 dyn upcasting coercion by Urgau · Pull Request #118133 · rust-...

 9 months ago
source link: https://github.com/rust-lang/rust/pull/118133
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

Contributor

@Urgau Urgau

commented

Nov 21, 2023

edited

This PR stabilize the trait_upcasting feature, aka rust-lang/rfcs#3324.

The FCP was completed here: #65991 (comment).

And also remove the deref_into_dyn_supertrait lint which is now handled by dyn upcasting coercion.

Heavily inspired by #101718
Fixes #65991

stepancheg reacted with thumbs up emojigabrielecastellano, waynexia, nanoqsh, Kish29, Kobzol, BD103, scottlamb, AaronKutch, isaacthefallenapple, ikrivosheev, and 4 more reacted with hooray emojiCosminPerRam and joseluis reacted with eyes emoji

Collaborator

r? @b-naber

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

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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

labels

Nov 21, 2023

Collaborator

The Miri subtree was changed

cc @rust-lang/miri

This comment has been minimized.

This comment has been minimized.

Contributor

lcnr

commented

Nov 21, 2023

edited

Should we keep the deref_into_dyn_supertrait lint around, maybe changing its wording? These impls probably don't do what the user expects them to, given that they can't be used implicitly. I feel like pointing out "hey, this impl is now implicit via a coercion, consider removing it" is preferable to completely removing the lint

Contributor

Author

Sure, if those impls don't do what the user expects we should tell them.

What about this diagnostic change?

- warning: `dyn Foo<'_>` implements `Deref` with supertrait `Bar<'_>` as target
+ warning: `dyn Foo<'_>` implements `Deref` with supertrait `Bar<'_>` as target is shadowed by coercion
   --> $DIR/migrate-lint-deny-regions.rs:8:1
    |
 LL | impl<'a> Deref for dyn Foo<'a> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ...
 LL |     type Target = dyn Bar<'a>;
    |     -------------------------- target type is set here
    |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #89460 <https://github.com/rust-lang/rust/issues/89460>
+   = help: consider removing this implementation in favour for the implicit coercion

Contributor

maybe something like

- warning: `dyn Foo<'_>` implements `Deref` with supertrait `Bar<'_>` as target
+ warning: this `Deref` implementation is covered by the implicit super-trait coercion
   --> $DIR/migrate-lint-deny-regions.rs:8:1
    |
 LL | impl<'a> Deref for dyn Foo<'a> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ...
 LL |     type Target = dyn Bar<'a>;
    |     -------------------------- target type is set here
    |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #89460 <https://github.com/rust-lang/rust/issues/89460>
+   = help: consider removing this implementation or replacing it with a method instead

something like this maybe? 🤔

Urgau reacted with thumbs up emoji

Contributor

Author

Done. I've restored the lint, removed the future incompatibility mark and changed the diagnostic output as discussed.

Member

@WaffleLapkin WaffleLapkin

left a comment

edited

r? WaffleLapkin
r=me with the nit fixed


Also, could you open a reference PR editing this page?

Member

@bors delegate+

Contributor

✌️ @Urgau, you can now approve this pull request!

If @WaffleLapkin told you to "r=me" after making some further change, please make that change, then do @bors r=@WaffleLapkin

Contributor

Author

Also, could you open a reference PR editing this page?

@crlf0710 already has one opened rust-lang/reference#1259 (from his previous attempt as stabilizing this feature).

WaffleLapkin reacted with thumbs up emoji

Contributor

Author

Contributor

📌 Commit 4c2d6de has been approved by WaffleLapkin

It is now in the queue for this repository.

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

Nov 22, 2023

Contributor

⌛ Testing commit 4c2d6de with merge 6d2b84b...

Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

Contributor

☀️ Test successful - checks-actions
Approved by: WaffleLapkin
Pushing 6d2b84b to master...

slanterns and gabrielecastellano reacted with hooray emoji

bors

added the merged-by-bors This PR was explicitly merged by bors label

Nov 22, 2023

bors

merged commit 6d2b84b into

rust-lang:master

Nov 22, 2023

12 checks passed

Contributor

Author

@rustbot label +relnotes

rustbot

added the relnotes Marks issues that should be documented in the release notes of the next release. label

Nov 22, 2023

Collaborator

Finished benchmarking commit (6d2b84b): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

Cycles

Results

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 675.017s -> 675.132s (0.02%)
Artifact size: 313.79 MiB -> 313.79 MiB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Back to tour

compiler-errors

compiler-errors left review comments

WaffleLapkin

WaffleLapkin approved these changes
Labels
merged-by-bors This PR was explicitly merged by bors relnotes Marks issues that should be documented in the release notes of the next release. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects

None yet

Milestone

1.76.0

Development

Successfully merging this pull request may close these issues.

Tracking issue for dyn upcasting coercion

9 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK