Skip to content

unsafe fn coerces to &fn without an unsafe block #9582

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

Closed
lilyball opened this issue Sep 28, 2013 · 3 comments · Fixed by #11605
Closed

unsafe fn coerces to &fn without an unsafe block #9582

lilyball opened this issue Sep 28, 2013 · 3 comments · Fixed by #11605
Labels
A-type-system Area: Type system P-medium Medium priority
Milestone

Comments

@lilyball
Copy link
Contributor

The following code compiles, surprisingly:

let x: Option<&[u8]> = Some("foo").map(std::cast::transmute);

The coercion of std::cast::transmute to &fn should only be allowed inside an unsafe block.

@thestinger
Copy link
Contributor

Nominating for the backwards compatible milestone. This doesn't seem like it would be very hard to fix though, just an oversight.

@nikomatsakis
Copy link
Contributor

cc me

This seems like it's a bug in the type system impl of coercion

@catamorphism
Copy link
Contributor

1.0, high

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system P-medium Medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants