Commit graph

1019 commits

Author SHA1 Message Date
Daniel Hofstetter
88d7f0a8da Guide: Fix variable name 2014-11-01 14:56:48 +01:00
bors
221fc1e3cd auto merge of #18459 : alexcrichton/rust/rollup, r=alexcrichton 2014-10-31 02:27:15 +00:00
Alex Crichton
d7ee04c5c4 rollup merge of #18442 : Manishearth/rust_panic 2014-10-30 17:36:48 -07:00
bors
a12d06b73f auto merge of #18381 : pelmers/rust/patch-1, r=alexcrichton
Happened to be reading through the doc.
2014-10-31 00:22:19 +00:00
bors
fd53657484 auto merge of #18339 : chastell/rust/guide_pattern_fixes, r=nikomatsakis
I think it helps to show that the variables introduced in match blocks are indeed independent from the matched variable `x` (especially when `x` is still reachable inside those blocks and might be useful), so this renames them accordingly. Maybe some linter (or language-level warning?) will eventually warn about shadowing `x` in such cases. ;)

I’m not super happy about the matching-on-range example, as it’s too contrived (`e` and `x` are exactly the same here), but I couldn’t come up with something both simple and non-redundant.
2014-10-30 20:17:15 +00:00
bors
52c3fe9533 auto merge of #18377 : steveklabnik/rust/fix_wording_about_errors, r=nikomatsakis
see https://github.com/rust-lang/rust/pull/18176#discussion_r19374679

/cc @eddyb @huonw @nikomatsakis
2014-10-30 17:57:09 +00:00
Alex Crichton
1e919c93c7 rollup merge of #18408 : thestinger/unsafe 2014-10-30 09:29:23 -07:00
Alex Crichton
b85780e7ea rollup merge of #18395 : cakebaker/fix_use_of_sqrt 2014-10-30 09:29:23 -07:00
bors
301ed5e579 auto merge of #18376 : steveklabnik/rust/gh7963, r=alexcrichton
FIxes #7963.
2014-10-30 15:57:03 +00:00
Alex Crichton
88946f72d5 rollup merge of #18381 : pelmers/patch-1 2014-10-30 08:55:39 -07:00
Manish Goregaokar
13d19bbf10 Rename rust_fail to rust_panic 2014-10-30 05:09:50 +05:30
bors
77f44d4a7b auto merge of #17894 : steveklabnik/rust/fail_to_panic, r=aturon
This in-progress PR implements https://github.com/rust-lang/rust/issues/17489.

I made the code changes in this commit, next is to go through alllllllll the documentation and fix various things.

- Rename column headings as appropriate, `# Panics` for panic conditions and `# Errors` for `Result`s.
- clean up usage of words like 'fail' in error messages

Anything else to add to the list, @aturon ? I think I should leave the actual functions with names like `slice_or_fail` alone, since you'll get to those in your conventions work?

I'm submitting just the code bits now so that we can see it separately, and I also don't want to have to keep re-building rust over and over again if I don't have to 😉 

Listing all the bits so I can remember as I go:

- [x] compiler-rt
- [x] compiletest
- [x] doc
- [x] driver
- [x] etc
- [x] grammar
- [x] jemalloc
- [x] liballoc
- [x] libarena
- [x] libbacktrace
- [x] libcollections
- [x] libcore
- [x] libcoretest
- [x] libdebug
- [x] libflate
- [x] libfmt_macros
- [x] libfourcc
- [x] libgetopts
- [x] libglob
- [x] libgraphviz
- [x] libgreen
- [x] libhexfloat
- [x] liblibc
- [x] liblog
- [x] libnative
- [x] libnum
- [x] librand
- [x] librbml
- [x] libregex
- [x] libregex_macros
- [x] librlibc
- [x] librustc
- [x] librustc_back
- [x] librustc_llvm
- [x] librustdoc
- [x] librustrt
- [x] libsemver
- [x] libserialize
- [x] libstd
- [x] libsync
- [x] libsyntax
- [x] libterm
- [x] libtest
- [x] libtime
- [x] libunicode
- [x] liburl
- [x] libuuid
- [x] llvm
- [x] rt
- [x] test
2014-10-29 20:16:57 +00:00
Steve Klabnik
6ac7fc73f5 Update infrastructure for fail -> panic
This includes updating the language items and marking what needs to
change after a snapshot.

If you do not use the standard library, the language items you need to
implement have changed. For example:

```rust
 #[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
```

is now

```rust
 #[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
```

Related, lesser-implemented language items `fail` and
`fail_bounds_check` have become `panic` and `panic_bounds_check`, as
well. These are implemented by `libcore`, so it is unlikely (though
possible!) that these two renamings will affect you.

[breaking-change]

Fix test suite
2014-10-29 16:06:13 -04:00
Steve Klabnik
7828c3dd28 Rename fail! to panic!
https://github.com/rust-lang/rfcs/pull/221

The current terminology of "task failure" often causes problems when
writing or speaking about code. You often want to talk about the
possibility of an operation that returns a Result "failing", but cannot
because of the ambiguity with task failure. Instead, you have to speak
of "the failing case" or "when the operation does not succeed" or other
circumlocutions.

Likewise, we use a "Failure" header in rustdoc to describe when
operations may fail the task, but it would often be helpful to separate
out a section describing the "Err-producing" case.

We have been steadily moving away from task failure and toward Result as
an error-handling mechanism, so we should optimize our terminology
accordingly: Result-producing functions should be easy to describe.

To update your code, rename any call to `fail!` to `panic!` instead.
Assuming you have not created your own macro named `panic!`, this
will work on UNIX based systems:

    grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g'

You can of course also do this by hand.

[breaking-change]
2014-10-29 11:43:07 -04:00
bors
dd7113609c auto merge of #18375 : steveklabnik/rust/gh17969, r=alexcrichton
Fixes #17969
2014-10-29 15:17:01 +00:00
bors
3bc545373d auto merge of #18365 : bjz/rust/token, r=alexcrichton
[breaking-change]

(for syntax-extensions)

- Token variant identifiers have been converted to PascalCase for consistency with Rust coding standards
- Some free-functions in `syntax::token` have been converted to methods on `syntax::token::Token`:
    - `can_begin_expr`         -> `Token::can_begin_expr`
    - `close_delimiter_for`    -> `Token::get_close_delimiter`
    - `is_lit`                 -> `Token::is_lit`
    - `is_ident`               -> `Token::is_ident`
    - `is_path`                -> `Token::is_path`
    - `is_plain_ident`         -> `Token::is_plain_ident`
    - `is_lifetime`            -> `Token::is_lifetime`
    - `is_mutability`          -> `Token::is_mutability`
    - `to_binop`               -> `Token::to_binop`
    - `is_keyword`             -> `Token::is_keyword`
    - `is_any_keyword`         -> `Token:is_any_keyword`
    - `is_strict_keyword`      -> `Token::is_strict_keyword`
    - `is_reserved_keyword`    -> `Token::is_reserved_keyword`
    - `mtwt_token_eq`          -> `Token::mtwt_eq`
- `token::Ident` now takes an enum instead of a boolean for clarity
- `token::{to_string, binop_to_string}` were moved to `pprust::{token_to_string, binop_to_string}`
2014-10-29 10:22:01 +00:00
bors
124508dea1 auto merge of #18340 : chastell/rust/guide_closures_fixes, r=steveklabnik
Some minor wording fixes to the Closures chapter; my brain tripped a few times when reading it, so I tried to come up with something a bit smoother. I’m not a native speaker, so please do review this critically.
2014-10-29 06:36:57 +00:00
Daniel Micay
8a71925558 reference: document unwinding unsafety issues 2014-10-28 19:00:16 -04:00
Daniel Micay
768a7e1a4a reference: slices are now regular types 2014-10-28 18:37:42 -04:00
Daniel Micay
321de979d8 reference: note the existence of UnsafeCell 2014-10-28 18:31:09 -04:00
Steve Klabnik
b7e177d242 update keyword list
Fixes #17969
2014-10-28 15:55:04 -04:00
Steve Klabnik
4d43d163df Describe doc attribute in the reference
FIxes #7963.
2014-10-28 12:11:26 -04:00
Daniel Hofstetter
54babf8aa3 Guide: Fix use of sqrt() in example 2014-10-28 16:09:14 +01:00
bors
d1bfd6515c auto merge of #18273 : gamazeps/rust/issue18218, r=steveklabnik
Closes #18218
2014-10-28 14:36:54 +00:00
Brendan Zabarauskas
d8b1fa0ae0 Use PascalCase for token variants 2014-10-28 15:55:37 +11:00
Peter Elmers
7163d65e24 Small grammar fix in rustdoc.md
Happened to be reading through
2014-10-27 20:58:05 -05:00
Alex Crichton
c5cc27f9a2 rollup merge of #18364 : cakebaker/missing_a 2014-10-27 15:12:48 -07:00
Alex Crichton
a1d719dad4 rollup merge of #18347 : cakebaker/ffi 2014-10-27 15:12:47 -07:00
Alex Crichton
dac3234bba rollup merge of #18321 : chastell/guide_refresh_testing_output 2014-10-27 15:12:29 -07:00
Alex Crichton
54647bd317 rollup merge of #18320 : chastell/guide_simplify_formatting 2014-10-27 15:12:29 -07:00
Alex Crichton
0c736c7b1d rollup merge of #18309 : cakebaker/fix_off_by_one 2014-10-27 15:12:29 -07:00
Alex Crichton
ecdb19cc98 rollup merge of #18257 : globin/master 2014-10-27 12:53:02 -07:00
Alex Crichton
6f65ad1a44 rollup merge of #18251 : steveklabnik/build_module_guide 2014-10-27 12:53:02 -07:00
Alex Crichton
a6883d4054 rollup merge of #18244 : areski/pr-fix-string-doc 2014-10-27 12:53:01 -07:00
Alex Crichton
da57aa57d4 rollup merge of #18231 : cakebaker/fix_greater_than_forty_two_closure 2014-10-27 12:53:01 -07:00
Alex Crichton
b3c676ed86 rollup merge of #18229 : bjz/ttdelim 2014-10-27 12:53:01 -07:00
Steve Klabnik
13e4daee26 Fix some wording about errors
see https://github.com/rust-lang/rust/pull/18176#discussion_r19374679
2014-10-27 15:51:52 -04:00
Daniel Hofstetter
25650e0eeb Guide: Add missing "a" 2014-10-27 15:41:24 +01:00
John Kleint
d257b37608 Guide: motivate Box and Rc pointers with need, uses, benefits, and examples.
Explain that Rust has different pointer types because there is a
tradeoff between flexibility and efficiency. Motivate boxes as
fixed-size containers of variable-sized objects. Clarify that Box and Rc
are pointer types that you deref with * just like references. Stick to
explaining the semantics and avoid implementation details.  Scope isn't
the most accurate framework to think about deallocation (since you
return boxes and otherwise move values out of scopes); it's more "when
the value is done being used," i.e., lifetime. Provide a connection
between Rust's pointer types by locating them on a flexibiltiy /
performance scale. Explain the compiler can't statically analyze
lifetimes with multiple owners; hence the need for (runtime) reference
counting.
2014-10-26 23:41:51 -04:00
Piotr Szotkowski
16bae692be Guide: Closures fix suggested by @cakebaker 2014-10-26 18:15:08 +01:00
Daniel Hofstetter
622ae41e90 Guide: Add link to FFI explanation 2014-10-26 16:58:17 +01:00
Piotr Szotkowski
4eedd873ec Guide: Closures: minor wording fixes 2014-10-26 09:50:16 +01:00
Piotr Szotkowski
aa1cd6e707 Guide: Patterns: use non-x variables in match blocks 2014-10-26 09:41:50 +01:00
Brendan Zabarauskas
dfb4163f83 Use standard capitalisation for TokenTree variants 2014-10-26 09:53:30 +11:00
Brendan Zabarauskas
ec3f0201e7 Rename TokenTree variants for clarity
This should be clearer, and fits in better with the `TTNonterminal` variant.

Renames:

- `TTTok` -> `TTToken`
- `TTDelim` -> `TTDelimited`
- `TTSeq` -> `TTSequence`
2014-10-26 09:53:29 +11:00
Piotr Szotkowski
eb903b4843 Guide: update Testing output and fix contents to match 2014-10-25 23:10:27 +02:00
Piotr Szotkowski
6a22454145 Guide: Cargo now adds bang and drops the semicolon for ‘Hello, world’ 2014-10-25 23:10:10 +02:00
Piotr Szotkowski
019a982f51 Guide: drop :d formatting where unnecessary 2014-10-25 22:50:38 +02:00
Daniel Hofstetter
122199909d Guide: Fix off-by-one error 2014-10-25 16:22:04 +02:00
bors
80e5fe1a56 auto merge of #18176 : jkleint/rust/guide-borrow-wording, r=steveklabnik
Explain the primary disadvantage of garbage collection is runtime
overhead and unpredictable pauses.  Elucidate where the name "race
condition" comes from.  Emphasize that Rust can guarantee your code is
free of race conditions and other memory errors, with no runtime
overhead.

cc @steveklabnik
2014-10-25 09:17:05 +00:00