-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Update comments re type parameter hack in object safety #65850
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To check if a method's receiver type is object safe, we create a new receiver type by substituting in a bogus type parameter (let's call it `U`) for `Self`, and checking that the unmodified receiver type implements `DispatchFromDyn<receiver type with Self = U>`. It would be better to use `dyn Trait` directly, and the only reason we don't is because it triggers another check that `Trait` is object safe, resulting in a query cycle. Once the feature `object_safe_for_dispatch` (tracking issue rust-lang#43561) is stabilized, this will no longer be the case, and we'll be able to use `dyn Trait` as the unsized `Self` type. I've updated the comments in object_safety.rs accordingly.
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Oct 26, 2019
Centril
added
the
F-dyn_compatible_for_dispatch
`#![feature(dyn_compatible_for_dispatch)]`; formerly `object_safe_for_ispatch`
label
Oct 26, 2019
nikomatsakis
approved these changes
Oct 29, 2019
@bors r+ rollup |
📌 Commit fb4095d has been approved by |
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
Oct 29, 2019
tmandry
added a commit
to tmandry/rust
that referenced
this pull request
Oct 30, 2019
Update comments re type parameter hack in object safety To check if a method's receiver type is object safe, we create a new receiver type by substituting in a bogus type parameter (let's call it `U`) for `Self`, and checking that the unmodified receiver type implements `DispatchFromDyn<receiver type with Self = U>`. It would be better to use `dyn Trait` directly, and the only reason we don't is because it triggers another check that `Trait` is object safe, resulting in a query cycle. Once the feature `object_safe_for_dispatch` (tracking issue rust-lang#43561) is stabilized, this will no longer be the case, and we'll be able to use `dyn Trait` as the unsized `Self` type. I've updated the comments in object_safety.rs accordingly. cc @Centril @nikomatsakis @bovinebuddha
Centril
added a commit
to Centril/rust
that referenced
this pull request
Oct 30, 2019
Update comments re type parameter hack in object safety To check if a method's receiver type is object safe, we create a new receiver type by substituting in a bogus type parameter (let's call it `U`) for `Self`, and checking that the unmodified receiver type implements `DispatchFromDyn<receiver type with Self = U>`. It would be better to use `dyn Trait` directly, and the only reason we don't is because it triggers another check that `Trait` is object safe, resulting in a query cycle. Once the feature `object_safe_for_dispatch` (tracking issue rust-lang#43561) is stabilized, this will no longer be the case, and we'll be able to use `dyn Trait` as the unsized `Self` type. I've updated the comments in object_safety.rs accordingly. cc @Centril @nikomatsakis @bovinebuddha
Centril
added a commit
to Centril/rust
that referenced
this pull request
Oct 31, 2019
Update comments re type parameter hack in object safety To check if a method's receiver type is object safe, we create a new receiver type by substituting in a bogus type parameter (let's call it `U`) for `Self`, and checking that the unmodified receiver type implements `DispatchFromDyn<receiver type with Self = U>`. It would be better to use `dyn Trait` directly, and the only reason we don't is because it triggers another check that `Trait` is object safe, resulting in a query cycle. Once the feature `object_safe_for_dispatch` (tracking issue rust-lang#43561) is stabilized, this will no longer be the case, and we'll be able to use `dyn Trait` as the unsized `Self` type. I've updated the comments in object_safety.rs accordingly. cc @Centril @nikomatsakis @bovinebuddha
bors
added a commit
that referenced
this pull request
Oct 31, 2019
Rollup of 7 pull requests Successful merges: - #65274 (Upload toolstates.json to rust-lang-ci2) - #65434 (Add long error explanation for E0577) - #65850 (Update comments re type parameter hack in object safety) - #65955 (ci: revert msys2 ca-certificates hack) - #65959 (Fix an incorrect docstring for Immediate in librustc_mir/interpret.) - #65979 (Switch CrateMetadata's source_map_import_info from RwLock to Once) - #65981 (work around aggressive syntax feature gating) Failed merges: r? @ghost
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
F-dyn_compatible_for_dispatch
`#![feature(dyn_compatible_for_dispatch)]`; formerly `object_safe_for_ispatch`
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To check if a method's receiver type is object safe, we create a new receiver type by substituting in a bogus type parameter (let's call it
U
) forSelf
, and checking that the unmodified receiver type implementsDispatchFromDyn<receiver type with Self = U>
. It would be better to usedyn Trait
directly, and the only reason we don't is because it triggers another check thatTrait
is object safe, resulting in a query cycle. Once the featureobject_safe_for_dispatch
(tracking issue #43561) is stabilized, this will no longer be the case, and we'll be able to usedyn Trait
as the unsizedSelf
type. I've updated the comments in object_safety.rs accordingly.cc @Centril @nikomatsakis @bovinebuddha