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

remove subtyping relationship for safe/unsafe fns and replace with coercion #23449

Closed
nikomatsakis opened this issue Mar 17, 2015 · 2 comments · Fixed by #23452
Closed

remove subtyping relationship for safe/unsafe fns and replace with coercion #23449

nikomatsakis opened this issue Mar 17, 2015 · 2 comments · Fixed by #23452
Assignees
Milestone

Comments

@nikomatsakis
Copy link
Contributor

Currently, fn is a subtype of unsafe fn. This should be a coercion relationship, pursuant to our strategy of limiting subtyping to region relationships. This also implies that one cannot implement an unsafe trait method with a safe fn, which is useful for solving the "trusted iterator length" problem.

@nikomatsakis
Copy link
Contributor Author

triage: P-backcompat-lang (1.0 beta)

@nikomatsakis
Copy link
Contributor Author

This is not super important, I think we could live with it staying the way it is. But I've got a branch already that seems to be mostly building.

@nikomatsakis nikomatsakis self-assigned this Mar 17, 2015
bors added a commit that referenced this issue Mar 18, 2015
Safe fns are no longer subtypes of unsafe fns, but you can coerce from one to the other.

This is a [breaking-change] in that impl fns must now be declared `unsafe` if the trait is declared `unsafe`. In some rare cases, the subtyping change may also direct affect you, but no such cases were encountered in practice.

Fixes #23449.

r? @nrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants