Commit Graph

262 Commits

Author SHA1 Message Date
bors
36cd65f786 Auto merge of #22549 - steveklabnik:doc_documentation, r=huonw
This chapter covers writing documentation in depth.

Fixes #4361
Fixes #12862
Fixes #14070
Fixes #14967
2015-03-07 10:01:13 +00:00
Manish Goregaokar
e99b00f6c1 Rollup merge of #23039 - steveklabnik:doc_vec_macro, r=alexcrichton 2015-03-06 08:58:58 +05:30
Steve Klabnik
61a2766136 Note the alternate form of vec in trpl 2015-03-04 16:27:18 -05:00
Steve Klabnik
977d7897fe TRPL: Documentation
This chapter covers writing documentation in depth.

Fixes #4361
Fixes #12862
Fixes #14070
Fixes #14967
2015-03-04 13:32:43 -05:00
Peter Elmers
299b594fde Fix grammar nits in compound-data-types.md
I came across a couple of grammar mistakes when refreshing myself on enums.
2015-03-04 11:02:31 -06:00
Felix S. Klock II
cb1b0dd589 Fix doc example to accommodate overloaded-box. 2015-03-03 21:16:03 +01:00
David Mally
a457dd5c78 Changed wording to use Result instead of Option in several places, fixed example that actually does use an Option 2015-02-28 17:40:04 -05:00
Manish Goregaokar
fcd1c3699a Rollup merge of #22866 - iKevinY:version-output-doc-fix, r=Manishearth
The format of `rustc --version` was changed in #21957; this PR updates TRPL accordingly.
2015-02-28 19:19:01 +05:30
Manish Goregaokar
37760c1f25 Rollup merge of #22875 - kmcallister:maceager, r=sfackler
MacEager is a MacResult implementation for the common case where you've already built each form of AST that you might return.

Fixes #17637. Based on #18814.

This is a [breaking-change] for syntax extensions:

  * MacExpr::new becomes MacEager::expr.

  * MacPat::new becomes MacEager::pat.

  * MacItems::new becomes MacEager::items. It takes a SmallVector directly,
    not an iterator.

r? @sfackler
2015-02-28 19:18:59 +05:30
Keegan McAllister
f66a3f7bba Replace MacExpr / MacPat / MacItems with MacEager
MacEager is a MacResult implementation for the common case where you've already
built each form of AST that you might return.

Fixes #17637. Based on #18814.

This is a [breaking-change] for syntax extensions:

  * MacExpr::new becomes MacEager::expr.

  * MacPat::new becomes MacEager::pat.

  * MacItems::new becomes MacEager::items. It takes a SmallVector directly,
    not an iterator.
2015-02-27 11:17:05 -08:00
Manish Goregaokar
c46fe78c32 Rollup merge of #22732 - jxcl:cargo-new, r=steveklabnik
r? @steveklabnik
2015-02-27 20:37:39 +05:30
Kevin Yap
9a4387fbe0 Update expected output of rustc --version
The format of `rustc --version` was changed in #21957.
2015-02-27 03:13:05 -08:00
Manish Goregaokar
9692f3bc94 Rollup merge of #22635 - kmcallister:macros-chapter, r=steveklabnik
r? @steveklabnik
2015-02-25 10:27:03 +05:30
Keegan McAllister
848a7e6921 Enhance and move information about macro debugging
Fixes #22424.
2015-02-24 16:34:18 -08:00
Keegan McAllister
df0865754e Tweak wording in the macros guide 2015-02-24 16:28:54 -08:00
Keegan McAllister
1804242a2d Add a second, more vexing section on recursive macros
Fixes #22423.
2015-02-24 16:28:54 -08:00
Keegan McAllister
65e1e6bb94 Add a section on recursive macros 2015-02-24 16:28:54 -08:00
Manish Goregaokar
a429bf6a24 Rollup merge of #22458 - steveklabnik:try_in_error_chapter, r=alexcrichton
Fixes #22342
2015-02-25 03:21:30 +05:30
Vadim Petrochenkov
2807a1ce02 Use arrays instead of vectors in tests 2015-02-24 21:15:45 +03:00
Steve Klabnik
f31ea22bff Mention try macro in error chapter
Fixes #22342
2015-02-24 12:31:46 -05:00
Manish Goregaokar
8e88762a83 Rollup merge of #22473 - leejunseok:fix_pointer_example, r=steveklabnik
Revised an example in the Pointers chapter of TRPL (the guide) as per #21575.
2015-02-24 12:08:35 +05:30
Manish Goregaokar
9ed6c33391 Rollup merge of #22719 - steveklabnik:typo_fix, r=alexcrichton 2015-02-24 12:08:32 +05:30
Alexander Bliskovsky
f49fd40f20 Removed {} and small wording fixes to "Hello Cargo!" chapter. 2015-02-23 16:38:11 -05:00
Alexander Bliskovsky
0685e7a185 Added section on cargo new to "Hello Cargo!" chapter. 2015-02-23 16:29:28 -05:00
Manish Goregaokar
f73457a1cc Rollup merge of #22612 - jxcl:iter-replace, r=steveklabnik
r? @steveklabnik

I've updated the iterators chapter to reflect the fact that you can now iterate over `for` loops without calling `.iter()`.
2015-02-23 23:28:47 +05:30
Manish Goregaokar
eb06c0ecd2 Rollup merge of #22593 - brson:spatch, r=steveklabnik
r? @steveklabnik
2015-02-23 23:28:46 +05:30
Manish Goregaokar
0fab2b9535 Rollup merge of #22556 - brson:str, r=steveklabnik
Clarify that `to_string` is how you make `String`. Use a coercion in an example.

r? @steveklabnik
2015-02-23 23:28:46 +05:30
Steve Klabnik
1049e88d1f Static and dynamic dispatch: missing word 2015-02-23 11:27:11 -05:00
Alexander Bliskovsky
9f2b0671f8 Fixed erroneous statements in iterators.md. 2015-02-22 20:26:54 -05:00
Alexander Bliskovsky
72eaf2c30e Switch to &vector notation in the iterators chapter. 2015-02-22 20:26:54 -05:00
Manish Goregaokar
a9570e5549 Rollup merge of #22625 - inrustwetrust:dispatch-doc-grammar, r=huonw
As far as I could tell from discussions in other docs pull requests, American spelling is preferred for the docs?
2015-02-22 01:49:46 +05:30
Manish Goregaokar
b7ac60a2f1 Rollup merge of #22524 - stevencrockett:master, r=steveklabnik
The text is referring to the io module despite the code using the old_io module.
2015-02-22 01:47:14 +05:30
Manish Goregaokar
9d650ae723 Rollup merge of #22515 - adamhjk:add-else-if-to-docs, r=steveklabnik
Adds an example of `else if` to the If section of The Rust Programming
Language.

r? @steveklabnik
2015-02-22 01:46:42 +05:30
Manish Goregaokar
11c70a3b09 Rollup merge of #22267 - steveklabnik:fix_lie, r=Gankro
Otherwise, this line is a lie.
2015-02-22 01:46:03 +05:30
inrustwetrust
1b20767460 Minor grammar/spelling fixes to the "Static and Dynamic Dispatch" doc 2015-02-21 11:50:25 +01:00
Brian Anderson
fcc21b36a3 docs: Explain static dispatch advantage more clearly 2015-02-20 11:41:39 -08:00
Brian Anderson
96be55376e book: Minor clarifications about strings 2015-02-19 18:39:38 -08:00
Steven Crockett
e0067f9852 docs: correct guessing game to mention old_io module instead of io
The text is referring to the io module despite the code using the old_io module.
2015-02-19 05:13:49 +00:00
Adam Jacob
cec404a066 Add documentation for else if to trpl
Adds an example of `else if` to the If section of The Rust Programming
Language.

r? @steveklabnik
2015-02-18 16:26:39 -08:00
Alex Crichton
231eeaa35b rollup merge of #22502: nikomatsakis/deprecate-bracket-bracket
Conflicts:
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/librustc/middle/lang_items.rs
	src/librustc_back/rpath.rs
	src/librustc_typeck/check/regionck.rs
	src/libstd/ffi/os_str.rs
	src/libsyntax/diagnostic.rs
	src/libsyntax/parse/parser.rs
	src/libsyntax/util/interner.rs
	src/test/run-pass/regions-refcell.rs
2015-02-18 15:48:40 -08:00
Niko Matsakis
9ea84aeed4 Replace all uses of &foo[] with &foo[..] en masse. 2015-02-18 17:36:03 -05:00
Alex Crichton
5250a82f79 rollup merge of #22497: nikomatsakis/suffixes
Conflicts:
	src/librustc_trans/trans/tvec.rs
2015-02-18 14:35:01 -08:00
Alex Crichton
b90e40718f rollup merge of #22484: riginding/master 2015-02-18 14:32:12 -08:00
Alex Crichton
1860ee521a std: Implement CString-related RFCs
This commit is an implementation of [RFC 592][r592] and [RFC 840][r840]. These
two RFCs tweak the behavior of `CString` and add a new `CStr` unsized slice type
to the module.

[r592]: https://github.com/rust-lang/rfcs/blob/master/text/0592-c-str-deref.md
[r840]: https://github.com/rust-lang/rfcs/blob/master/text/0840-no-panic-in-c-string.md

The new `CStr` type is only constructable via two methods:

1. By `deref`'ing from a `CString`
2. Unsafely via `CStr::from_ptr`

The purpose of `CStr` is to be an unsized type which is a thin pointer to a
`libc::c_char` (currently it is a fat pointer slice due to implementation
limitations). Strings from C can be safely represented with a `CStr` and an
appropriate lifetime as well. Consumers of `&CString` should now consume `&CStr`
instead to allow producers to pass in C-originating strings instead of just
Rust-allocated strings.

A new constructor was added to `CString`, `new`, which takes `T: IntoBytes`
instead of separate `from_slice` and `from_vec` methods (both have been
deprecated in favor of `new`). The `new` method returns a `Result` instead of
panicking.  The error variant contains the relevant information about where the
error happened and bytes (if present). Conversions are provided to the
`io::Error` and `old_io::IoError` types via the `FromError` trait which
translate to `InvalidInput`.

This is a breaking change due to the modification of existing `#[unstable]` APIs
and new deprecation, and more detailed information can be found in the two RFCs.
Notable breakage includes:

* All construction of `CString` now needs to use `new` and handle the outgoing
  `Result`.
* Usage of `CString` as a byte slice now explicitly needs a `.as_bytes()` call.
* The `as_slice*` methods have been removed in favor of just having the
  `as_bytes*` methods.

Closes #22469
Closes #22470
[breaking-change]
2015-02-18 14:15:43 -08:00
Junseok Lee
8e0e87fc32 revised pointer example 2015-02-18 13:22:59 -08:00
Niko Matsakis
8c34b26606 Update docs by dropping suffixes except where they served to instruct. 2015-02-18 09:09:14 -05:00
Ryan Riginding
b8527c07dc Fixed link in ffi documentation 2015-02-18 09:16:22 +01:00
Alex Crichton
665ea963d3 Test fixes and rebase conflicts 2015-02-17 19:42:28 -08:00
Alex Crichton
6ac3799b75 Test fixes and rebase conflicts 2015-02-17 17:27:46 -08:00
Alex Crichton
311fc36a57 rollup merge of #22123: steveklabnik/doc_where_clauses
Closes #21859.
2015-02-17 15:13:42 -08:00