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

Return the String guide to its former glory. #21056

Merged
merged 1 commit into from
Jan 23, 2015

Conversation

steveklabnik
Copy link
Member

When we moved over to the book, we lost this.

let string = "Hello there.";
```

Like any Rust type, string slices have an associated lifetime. A string literal
Copy link
Member

Choose a reason for hiding this comment

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

"Like any Rust reference type" maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

agreed, fixe

@nrc
Copy link
Member

nrc commented Jan 12, 2015

r? @sfackler

@steveklabnik
Copy link
Member Author

This has been updated now.


Like vector slices, string slices are simply a pointer plus a length. This
means that they're a 'view' into an already-allocated string, such as a
`&'static str` or a `String`.
Copy link
Member

Choose a reason for hiding this comment

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

Using &'static str here seems wrong, maybe "string literal"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why is it wrong?

Copy link
Member

Choose a reason for hiding this comment

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

It just seems a bit strange since the paragraph's saying that slices are a view into an already allocated string, such as a slice, but isn't that a view into an already allocated string?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess it is strange because it's an edge case: a &'static str is an always-allocated thing. And I tend to refer to things by their type explicitly. But I can see that. Lemme fix it.

@sfackler
Copy link
Member

r=me with the one last nit.

@steveklabnik
Copy link
Member Author

@bors: r=sfackler b33dfdb rollup

@bors
Copy link
Contributor

bors commented Jan 22, 2015

⌛ Testing commit b33dfdb with merge 1fcaec0...

@bors
Copy link
Contributor

bors commented Jan 22, 2015

💔 Test failed - auto-mac-64-opt

When we moved over to the book, we lost this.
@steveklabnik
Copy link
Member Author

@bors: r=sfackler cef8295 rollup

@steveklabnik
Copy link
Member Author

Woo notrust isn't a thing anymore.

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jan 22, 2015
…kler

When we moved over to the book, we lost this.
bors added a commit that referenced this pull request Jan 23, 2015
@bors bors merged commit cef8295 into rust-lang:master Jan 23, 2015
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.

4 participants