-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 future-incompatibility lint deref_into_dyn_supertrait
#89460
Comments
…matsakis Add `deref_into_dyn_supertrait` lint. Initial implementation of rust-lang#89460. Resolves rust-lang#89190. Maybe also worth a beta backport if necessary. r? `@nikomatsakis`
Could we get a more detailed summary of the case this lint is addressing? dyn upcasting / coercion seems to have made a lot of progress, but this aspect of it doesn't seem to have gotten much discussion that I recall. |
@joshtriplett Sure. It is known that from user's perspective, coercions has "priorities", and dyn upcasting coercion has a higher priority than user defined For now we don't want to affect user's code, since dyn upcasting coercion might take a little while before it's stablized. Though, if user provided code decide to do other things in the |
I'm curious -- why wasn't this implemented as a lint on the |
@compiler-errors It could be implemented that way, and thinking about it from current view, that would be a better way (No removal of the lint is needed with that approach) |
…, r=compiler-errors Make `deref_into_dyn_supertrait` lint the impl and not the usage Proposed by `@compiler-errors` in rust-lang#89460 (comment) r? `@crlf0710`
…, r=compiler-errors Make `deref_into_dyn_supertrait` lint the impl and not the usage Proposed by ``@compiler-errors`` in rust-lang#89460 (comment) r? ``@crlf0710``
…ler-errors Make `deref_into_dyn_supertrait` lint the impl and not the usage Proposed by ``@compiler-errors`` in rust-lang/rust#89460 (comment) r? ``@crlf0710``
For future reference: the lint change suggested by @compiler-errors was implemented in #104742 (I just tried to do that again because I forgor). The lint now lints against |
…ions, r=lcnr Don't consider regions in `deref_into_dyn_supertrait` lint I actually wonder if we should just warn on *any* deref impl with a target type that matches a supertrait by *def-id*. cc rust-lang#89460 r? types
Rollup merge of rust-lang#118026 - compiler-errors:deref-into-dyn-regions, r=lcnr Don't consider regions in `deref_into_dyn_supertrait` lint I actually wonder if we should just warn on *any* deref impl with a target type that matches a supertrait by *def-id*. cc rust-lang#89460 r? types
deref_into_dyn_supertrait
compatibility lintderef_into_dyn_supertrait
What is this lint about
We're planning to add the dyn upcasting coercion language feature (see https://github.com/rust-lang/dyn-upcasting-coercion-initiative). Unfortunately this new coercion rule will take priority over certain other coercion rules, which will mean some behavior change. See #89190 for initial bug report.
How to fix this warning/error
Ensure your own
Deref
implementation is consistent with thetrait_upcasting
feature brings andallow
this lint. Or avoid this code pattern altogether.Current status
Implementation: #89461
The text was updated successfully, but these errors were encountered: