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

str: Implement trait Mutable for ~str with the method .clear() #7904

Closed
wants to merge 6 commits into from
Closed

str: Implement trait Mutable for ~str with the method .clear() #7904

wants to merge 6 commits into from

Conversation

bluss
Copy link
Member

@bluss bluss commented Jul 19, 2013

fixes issue #7900

`rustpkg build`, if executed in a package source directory inside
a workspace, will now build that package. By "inside a workspace"
I mean that the parent directory has to be called `src`, and rustpkg
will create a `build` directory in .. if there isn't already one.

Same goes for `rustpkg install` and `rustpkg clean`.

For the time being, `rustpkg build` (etc.) will still error out if
you run it inside a directory whose parent isn't called `src`.
I'm not sure whether or not it's desirable to have it do something
in a non-workspace directory.
/// Remove all contents, making the string empty
#[inline]
fn clear(&mut self) {
if self.len() > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just leave this if expression out, because set_len(self, 0) will be a no-op if it's already zero.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thinking was that I wanted to have an assertion that there is room for the final null byte, in case the representation changes. This seemed to be the best way to keep the code safe and independent.

Too much overcommit here exhausts the low fd limit on OS X.
@bluss
Copy link
Member Author

bluss commented Jul 20, 2013

This should be revived and come back better, actually implement Container on ~str and @str too.

@bluss bluss closed this Jul 20, 2013
bors and others added 4 commits July 20, 2013 00:37
Too much overcommit here exhausts the low fd limit on OS X.
r? @brson `rustpkg build`, if executed in a package source directory inside
a workspace, will now build that package. By "inside a workspace"
I mean that the parent directory has to be called `src`, and rustpkg
will create a `build` directory in .. if there isn't already one.

Same goes for `rustpkg install` and `rustpkg clean`.

For the time being, `rustpkg build` (etc.) will still error out if
you run it inside a directory whose parent isn't called `src`.
I'm not sure whether or not it's desirable to have it do something
in a non-workspace directory.
Some notes about the commits.

Exit code propagation commits:
* ```Reimplement unwrap()``` has the same old code from ```arc::unwrap``` ported to use modern atomic types and finally (it's considerably nicer this way)
* ```Add try_unwrap()``` has some new slightly-tricky (but pretty simple) concurrency primitive code
* ```Add KillHandle``` and ```Add kill::Death``` are the bulk of the logic.

Task killing commits:
* ```Implement KillHandle::kill() and friends```, ```Do a task-killed check```, and ```Add BlockedTask``` implement the killing logic;
* ```Change the HOF context switchers``` turns said logic on

Linked failure commits:
* ```Replace *rust_task ptrs``` adapts the taskgroup code to work for both runtimes
* ```Enable taskgroup code``` does what it says on the tin.

r? @brson
~str and @str need separate implementations for use in generic
functions, where it will not automatically use the impl on &str.
@bluss bluss reopened this Jul 20, 2013
@bluss
Copy link
Member Author

bluss commented Jul 20, 2013

Hm this was messy, making a new PR

@bluss bluss closed this Jul 20, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 4, 2021
…Frednet

Add suggestion to missing backticks error

changelog: Add a machine applicable suggestion for the [`doc_markdown`] missing backticks lint

closes: rust-lang#7737
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.

5 participants