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

unsafe String constructors as free functions are inconsistent with design elsewhere #16708

Closed
thestinger opened this issue Aug 23, 2014 · 4 comments

Comments

@thestinger
Copy link
Contributor

In the past we agreed to get rid of these unsafe functions and replace them with static methods, but they've come back on strings and the previous methods are marked as deprecated. AFAIK, this did not go through an RFC, and is inconsistent with the design used elsewhere in the standard library based on the strong consensus in the previous discussions on the mailing list and issue tracker. For example, from_raw_parts is a method on Vec and was a method on String but has been deprecated.

Static methods play very well with Rust's import system, because it allows accessing all of the methods via the scope. It's already marked unsafe, and going out of the way to make unsafe code painful just makes the language lose appeal as a systems language.

The parameters also shifted around in from_parts relative to from_raw_parts on Vec and String, so even that part of the design is inconsistent with Vec<T>.

@thestinger
Copy link
Contributor Author

The non-static unsafe methods are also still methods, so this choice really doesn't sit well with me. I think this should be reverted to the current design and then if someone wants to propose we go back to raw modules like this, they should make an RFC and it should be consistent for all unsafe methods, not a chosen few.

@thestinger thestinger changed the title unsafe String constructors are inconsistent with design elsewhere unsafe String constructors as free functions are inconsistent with design elsewhere Aug 23, 2014
@aturon
Copy link
Member

aturon commented Sep 4, 2014

cc me

@brson brson removed the I-nominated label Sep 4, 2014
@brson
Copy link
Contributor

brson commented Sep 4, 2014

Not 1.0, P-backcompat-lang.

@aturon
Copy link
Member

aturon commented Jan 8, 2015

Closing; this has been addressed.

@aturon aturon closed this as completed Jan 8, 2015
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Mar 10, 2024
internal: Move ide-assists codegen tests into an xtask codegen command
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

No branches or pull requests

3 participants