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

utf8 basics #284

Closed
wants to merge 2 commits into from
Closed

utf8 basics #284

wants to merge 2 commits into from

Conversation

marijnh
Copy link
Contributor

@marijnh marijnh commented Mar 24, 2011

I'd like you to double-check the function at https://github.com/marijnh/rust/commit/8b51e075c5de83d50e40a30872db6a051b12413c#L7R188 to see you spot any glaring mistakes.

(make check passes if i first back up far enough to start from a passing HEAD again)

@marijnh
Copy link
Contributor Author

marijnh commented Mar 25, 2011

Hi Graydon,

The patches have been updated.

I'd really rather not get into formatting discussions at this point, since we have plans to use the pretty-printer to make all that moot. Please accept my compressed one-liners until then.

As for constants, adding a few of them did clarify things. I left the bitmasks as hex literals, since a constant named last_six_bits_set or so seems more indirect than 0x3f.

Regarding the refcounting in str_push_byte... My first attempt would deref v when allocating a new one, and leave the ref as is in the other case. However, this led to double-free errors. My conclusion is that rust expects a refcounted value returned from a foreign call to be 'new', in that it already has a refcount bump (or was initialized with refcount 1). Thus, when returning a value that was an argument to the foreign call, you have to bump its refcount. s = rustrc.str_push_byte(s, X) will decrement this refcount again when overwriting the old reference.

I added a clearer comment about the rustboot workaround at https://github.com/marijnh/rust/blob/master/src/lib/_str.rs#L292 .

Best,
Marijn

marijnh added 2 commits March 25, 2011 15:27
Finally implements _str.is_utf8, adds from_chars, from_char, to_chars,
char_at, char_len, (push|pop|shift|unshift)_char. Also, proper
character I/O for streams.
@graydon
Copy link
Contributor

graydon commented Mar 25, 2011

Integrated (with rt/rustrt.def.in fix)

@graydon graydon closed this Mar 25, 2011
oli-obk added a commit to oli-obk/rust that referenced this pull request Sep 19, 2017
Rust reorders fields, but miri uses the order from the source files
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this pull request Dec 12, 2017
Added getloadavg for Linux, the BSDs and Solaris.

Sadly Android's bionic lacks this functionality.
kazcw pushed a commit to kazcw/rust that referenced this pull request Oct 23, 2018
workingjubilee pushed a commit to workingjubilee/rustc that referenced this pull request Jul 20, 2022
Change `Simd::splat` to not generate a loop
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 this pull request may close these issues.

2 participants