Skip to content

Type casts should be considered as pure where possible #1316

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
boggle opened this issue Dec 16, 2011 · 1 comment
Closed

Type casts should be considered as pure where possible #1316

boggle opened this issue Dec 16, 2011 · 1 comment
Labels
A-type-system Area: Type system

Comments

@boggle
Copy link
Contributor

boggle commented Dec 16, 2011

Noticed this when seeing a u8 as uint cast

@marijnh
Copy link
Contributor

marijnh commented Jan 2, 2012

Type casts are considered pure. The below function compiles fine. If I misunderstood what you're saying, explain what you mean and reopen.

pure fn test(x: int) -> uint { x as uint }

@marijnh marijnh closed this as completed Jan 2, 2012
Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
* document ErrorGuaranteed

* Fix typos

Co-authored-by: pierwill <[email protected]>

* Clarify Niko comment

Co-authored-by: Niko Matsakis <[email protected]>

Co-authored-by: pierwill <[email protected]>
Co-authored-by: Niko Matsakis <[email protected]>
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
* document ErrorGuaranteed

* Fix typos

Co-authored-by: pierwill <[email protected]>

* Clarify Niko comment

Co-authored-by: Niko Matsakis <[email protected]>

Co-authored-by: pierwill <[email protected]>
Co-authored-by: Niko Matsakis <[email protected]>
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
Projects
None yet
Development

No branches or pull requests

2 participants