Commit graph

1155 commits

Author SHA1 Message Date
Steve Klabnik
72beb1f885 Extra note about struct matching order
Fixes #19178
2014-11-25 11:31:49 -05:00
Steve Klabnik
d7b29a6ccd Make note that examples need a main()
Fixes #19199
2014-11-25 11:18:39 -05:00
Steve Klabnik
71b8b04f48 Make note about cross-borrowing.
Fixes #19302.
2014-11-25 10:57:17 -05:00
Pascal Hertleif
96880be0e3 Change 'Failure' to 'Panic' in Bug Report Docs 2014-11-25 13:20:47 +01:00
bors
2264049577 auto merge of #19172 : alfie/rust/impl-traitless, r=steveklabnik
An example of how implementations work without traits would be handy
2014-11-25 11:46:39 +00:00
bors
e197a2b0ac auto merge of #18140 : JelteF/rust-1/guide-fix, r=cmr
The reason given didn't make any sense when I read it when reading through the docs. I think this is more clear. Please let me know it is also more correct.
2014-11-23 13:51:47 +00:00
Jelte Fennema
17f9de387a Fix the reason for calling a file lib.rs 2014-11-23 14:43:22 +01:00
bors
ccc4a7cebc auto merge of #19136 : alfie/rust/master, r=steveklabnik
An example of how type definitions work would be handy
2014-11-22 22:36:40 +00:00
Alfie John
93ba558588 doc: adding example for implementations without traits 2014-11-21 04:43:07 +00:00
bors
c9f6d69642 auto merge of #18967 : aturon/rust/remove-runtime, r=alexcrichton
This PR completes the removal of the runtime system and green-threaded abstractions as part of implementing [RFC 230](https://github.com/rust-lang/rfcs/pull/230).

Specifically:

* It removes the `Runtime` trait, welding the scheduling infrastructure directly to native threads.

* It removes `libgreen` and `libnative` entirely.

* It rewrites `sync::mutex` as a trivial layer on top of native mutexes. Eventually, the two modules will be merged.

* It hides the vast majority of `std::rt`.

This completes the basic task of removing the runtime system (I/O and scheduling) and components that depend on it. 

After this lands, a follow-up PR will pull the `rustrt` crate back into `std`, turn `std::task` into `std::thread` (with API changes to go along with it), and completely cut out the remaining startup/teardown sequence. Other changes, including new [TLS](https://github.com/rust-lang/rfcs/pull/461) and synchronization are in the RFC or pre-RFC phase.

Closes #17325
Closes #18687

[breaking-change]

r? @alexcrichton
2014-11-21 03:41:45 +00:00
Aaron Turon
40c78ab037 Fallout from libgreen and libnative removal 2014-11-20 17:19:24 -08:00
mdinger
16bb4e6400 Add examples for all literal types in reference grouped together 2014-11-20 16:05:33 -05:00
Alfie John
e87894ef04 doc: adding example for type definitions 2014-11-20 09:44:57 +00:00
bors
dd5ce5ae2f auto merge of #19105 : alfie/rust/master, r=thestinger
As discussed in pull #19068, trying to make the wording more clear for unsafe code vs undefined behavior.
2014-11-20 06:11:36 +00:00
Jakub Bukaj
ee66c84165 Fixes to the roll-up 2014-11-19 23:34:01 +01:00
Jakub Bukaj
1b8ee82b54 rollup merge of #19107: cakebaker/change_an_box_to_a_box 2014-11-19 22:41:24 +01:00
Jakub Bukaj
f71b852d38 rollup merge of #19103: huonw/literal-suffixes
Futureproof Rust for fancier suffixed literals. The Rust compiler tokenises a literal followed immediately (no whitespace) by an identifier as a single token: (for example) the text sequences `"foo"bar`, `1baz` and `1u1024` are now a single token rather than the pairs `"foo"` `bar`, `1` `baz` and `1u` `1024` respectively.

The compiler rejects all such suffixes in the parser, except for the 12 numeric suffixes we have now.

I'm fairly sure this will affect very few programs, since it's not currently legal to have `<literal><identifier>` in a Rust program, except in a macro invocation. Any macro invocation relying on this behaviour can simply separate the two tokens with whitespace: `foo!("bar"baz)` becomes `foo!("bar" baz)`.

This implements [RFC 463](https://github.com/rust-lang/rfcs/blob/master/text/0463-future-proof-literal-suffixes.md), and so closes https://github.com/rust-lang/rust/issues/19088.
2014-11-19 22:41:05 +01:00
Jakub Bukaj
8997b098d3 rollup merge of #19072: cakebaker/add_missing_dot 2014-11-19 22:39:06 +01:00
Jakub Bukaj
384f611aa9 rollup merge of #18968: danluu/guide_play
As-is, there's no indication that the code examples pop out into a window that runs on `play.rust-lang.org` until you mouse over them. I managed to get to section 4 of the guide before realizing you could do this since it didn't occur to me to mouse over the example text.

cc @rose since we went through the tutorial together and I think it wasn't obvious to her either.
2014-11-19 22:37:18 +01:00
Jakub Bukaj
cbdaf2ebc7 rollup merge of #18903: steveklabnik/error_handling_guide
Now that we've done `fail` -> `panic`, I feel bringing back the error handling guide is a good idea. We had one long ago, but it was removed when conditions were removed.

This doesn't cover the new FromError stuff, but I feel like it's already useful in this state, so I'm sending this PR now.
2014-11-19 22:37:07 +01:00
Daniel Hofstetter
ebe812f0c6 Reference: Change "an box" to "a box" 2014-11-19 15:11:09 +01:00
Huon Wilson
a11078f8c3 Update documentation for literal suffixes.
This changes the stated grammar of literals to move all suffixes into
the generic literal production.
2014-11-20 00:03:21 +11:00
Alfie John
e0b0c83138 doc: clarifying unsafe code vs undefined behavior 2014-11-19 12:43:13 +00:00
Daniel Micay
210e059750 clearly define int and uint to fix unsoundness
This fixes the gap in the language definition causing #18726 by defining
a clear bound on the maximum size for libraries to enforce.

Closes #18069
2014-11-19 05:17:56 -05:00
Steve Klabnik
16b9f67bf3 Error handling guide 2014-11-18 19:30:05 -05:00
Steve Klabnik
0e6d97aab2 New guide: error handling 2014-11-18 12:56:55 -05:00
Niko Matsakis
56ba260749 Update test for equivalency to include region binders in object types, add new tests relating to HRTB, consolidate the unboxed_closures and overloaded_calls feature gates. 2014-11-18 12:32:38 -05:00
Niko Matsakis
058abcc209 Place parenthetical notation under the unboxed_closure feature-gate.
Consolidate the `unboxed_closure_sugar` and `unboxed_closure` feature gates.
2014-11-18 12:26:04 -05:00
Daniel Hofstetter
2aa241d76f Reference: Add missing third dot of range 2014-11-18 15:14:34 +01:00
Jakub Bukaj
f3759dd2b6 rollup merge of #19026: alfie/doc-fixes
Updated all the adjacent character literals in the BCNF that cannot have an optional space between them
2014-11-18 00:24:06 +01:00
Steven Fackler
3dcd215740 Switch to purely namespaced enums
This breaks code that referred to variant names in the same namespace as
their enum. Reexport the variants in the old location or alter code to
refer to the new locations:

```
pub enum Foo {
    A,
    B
}

fn main() {
    let a = A;
}
```
=>
```
pub use self::Foo::{A, B};

pub enum Foo {
    A,
    B
}

fn main() {
    let a = A;
}
```
or
```
pub enum Foo {
    A,
    B
}

fn main() {
    let a = Foo::A;
}
```

[breaking-change]
2014-11-17 07:35:51 -08:00
Nick Cameron
ca08540a00 Fix fallout from coercion removal 2014-11-17 22:41:33 +13:00
Alfie John
9a5237d7ae doc: extend a893397 to make whole document consistent 2014-11-17 05:15:24 +00:00
bors
245c7fbef5 auto merge of #18995 : alfie/rust/comment-docs, r=aturon
Start comment is a string literal while end comment is made up of two character literals. This change is to make them consistent.
2014-11-16 20:32:12 +00:00
Jakub Bukaj
c425ed2a8d Update the reference 2014-11-16 14:23:15 +01:00
Jakub Bukaj
b22afe9ee7 rollup merge of #18990: alfie/master 2014-11-16 10:22:43 +01:00
Jakub Bukaj
a9f9e80de5 rollup merge of #18989: alex/fix-typos 2014-11-16 10:22:35 +01:00
Jakub Bukaj
4c30cb2564 rollup merge of #18976: bjz/rfc369-numerics 2014-11-16 10:21:42 +01:00
Jakub Bukaj
ecf765d97b rollup merge of #18933: IanConnolly/doc-fake-rust 2014-11-16 10:19:22 +01:00
Alfie John
a8933973f9 doc: make end comment consistent with start comment 2014-11-16 04:12:43 +00:00
Brendan Zabarauskas
29bc9c632e Move FromStr to core::str 2014-11-16 12:41:55 +11:00
Alfie John
c5232615b6 doc: small grammar fix 2014-11-15 23:17:36 +00:00
Alex Gaynor
e94cd40f7e Fixed several typos 2014-11-15 15:00:47 -08:00
bors
7e43f419cb auto merge of #18924 : cakebaker/rust/fix_list, r=steveklabnik 2014-11-15 13:22:24 +00:00
bors
bc0b6120c1 auto merge of #18901 : steveklabnik/rust/quickfix, r=alexcrichton
Small copy/paste error from the crates guide.
2014-11-15 07:12:27 +00:00
Dan Luu
0f11eb5479 Guide: add a pointer to play.rust-lang.org and explain how to run the code examples. 2014-11-14 22:16:25 -06:00
Ian Connolly
769d49a8b7 Don't use rust keyword for fake code 2014-11-13 19:52:08 +00:00
Daniel Hofstetter
e8056a452f Reference: Fix list in Expressions section 2014-11-13 16:05:07 +01:00
Brendan Zabarauskas
e965ba85ca Remove lots of numeric traits from the preludes
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
2014-11-13 03:46:03 +11:00
Steve Klabnik
607eb12ab7 Fix po4a.conf 2014-11-12 11:34:00 -05:00
Jeff Parsons
2df9a085bd Rogue 'panic' -> 'fail' in guide.
Should refer to handling panicking tasks like any other computation
that may _fail_, not any other computation that may _panic_.
2014-11-10 21:20:11 +11:00
bors
efc9a441b9 auto merge of #18762 : mdinger/rust/str_coerce, r=steveklbanik
I had slight confusion when using this as a reference and was told it was imprecise. Most of the rewording was suggested by @huonw.

cc @steveklabnik
2014-11-09 17:06:45 +00:00
mdinger
c39e9f3437 Reword &str coercion into viewing 2014-11-08 00:46:11 -05:00
Carol Nichols
fc47dd9c0f Prepend should be append in the 30 minute intro
The examples are about adding to the end of the array, not the
beginning.
2014-11-07 14:59:42 -05:00
Alex Crichton
3c81f33ada rollup merge of #18708 : qwitwa/master 2014-11-06 13:53:26 -08:00
Alex Crichton
0047b84a00 rollup merge of #18696 : tshakah/patch-1 2014-11-06 13:53:26 -08:00
Alex Crichton
fcfd307493 rollup merge of #18373 : steveklabnik/gh18288 2014-11-06 13:30:10 -08:00
qwitwa
31ce92d910 14.3 - helpfully implied code sample is broken
As a new user, I spent a while confused when flycheck told me the code sample I'd typed in was invalid. I ended up figuring out some of what comes after the code sample more painfully by myself because there was no indication that it was broken in the text beforehand. This one line change makes it clear that the code following it is an experiment that may not work rather than something to assume just works.
2014-11-06 19:25:00 +00:00
tshakah
00ae767609 Update guide.md
Corrected singular/plural reference to enums
2014-11-06 15:19:00 +00:00
Steve Klabnik
d108613ba0 expand description of the link attribute
Fixes #18288
2014-11-06 10:13:29 -05:00
Niko Matsakis
63718792df Update the guide examples and try not to leave user hanging as to what
this `&x` sigil is all about.
2014-11-05 11:29:15 -05:00
bors
ceeac26de8 auto merge of #18338 : chastell/rust/guide_pointer_fixes, r=alexcrichton
This removes some leftover line-numbering cruft from elided error examples and brings some minor clarifications.

I’m not super happy about the ‘we cannot have two mutable pointers that point to the same memory’ wording (to the best of my understanding we can’t even have one mutable and one immutable), but other attempts to word this were derailing the flow a bit too much.
2014-11-04 21:26:23 +00:00
bors
bb70ee56db auto merge of #18528 : seanjensengrey/rust/doc-18498, r=brson
This addresses https://github.com/rust-lang/rust/issues/18498 by adding a prepopulated search box to do site search on `doc.rust-lang.org` using duckduckgo AND generating a search url against the rust documentation using the internal search facilities.

* https://duckduckgo.com/?q=type+Option+unwrap_or_else+site%3Adoc.rust-lang.org
* http://doc.rust-lang.org/core/?search=unwrap_or_else
2014-11-04 18:46:19 +00:00
Piotr Szotkowski
9be04d574a Guide: drop line-number cruft from elided error examples 2014-11-04 19:39:12 +01:00
Piotr Szotkowski
c7182ba997 Guide: minor clarifications for the Pointers part 2014-11-04 19:39:12 +01:00
bors
1b2ad7831f auto merge of #18497 : gamazeps/rust/enumsmatch, r=steveklabnik
Closes #18169
2014-11-04 16:16:28 +00:00
gamazeps
dc7c8da74b Guide: explains the enum/match relationship
Closes #18169
2014-11-04 13:47:53 +01:00
Alex Crichton
1b363f08e1 rollup merge of #18572 : cakebaker/small_doc_changes 2014-11-03 15:56:00 -08:00
Alex Crichton
fff2b35a6e rollup merge of #18355 : chastell/guide_iterators_macros_unsafe_fixes 2014-11-03 15:29:13 -08:00
Alex Crichton
59d47a3ca4 rollup merge of #18132 : P1start/more-help 2014-11-03 15:28:54 -08:00
Alex Crichton
b3f8b8f238 rollup merge of #18522 : jbcrail/rename-missing-doc-attribute 2014-11-03 08:31:46 -08:00
Alex Crichton
e5a8840033 rollup merge of #18519 : Gankro/collect-smash 2014-11-03 08:31:45 -08:00
Alex Crichton
67840513f4 rollup merge of #18509 : cakebaker/missing_ofs 2014-11-03 08:31:45 -08:00
Alex Crichton
048902db52 rollup merge of #18508 : cakebaker/fix_variable_name 2014-11-03 08:31:45 -08:00
Alex Crichton
82efef76c3 rollup merge of #18500 : adrientetar/fonts 2014-11-03 08:31:45 -08:00
Daniel Hofstetter
e9618ce701 Small doc fixes 2014-11-03 15:34:56 +01:00
Alexis Beingessner
112c8a966f refactor libcollections as part of collection reform
* Moves multi-collection files into their own directory, and splits them into seperate files
* Changes exports so that each collection has its own module
* Adds underscores to public modules and filenames to match standard naming conventions

(that is, treemap::{TreeMap, TreeSet} => tree_map::TreeMap, tree_set::TreeSet)

* Renames PriorityQueue to BinaryHeap
* Renames SmallIntMap to VecMap
* Miscellanious fallout fixes

[breaking-change]
2014-11-02 18:58:11 -05:00
Sean Jensen-Grey
eca7ab508d cleaned up ids, added direct rust doc search
Search functionality uses both duckduckgo for site wide doc search
and the rust specific documentation search @

http://doc.rust-lang.org/core/?search=unwrap_or_else
2014-11-02 08:06:32 -08:00
Sean Jensen-Grey
7fbcdc75a9 add populated search box to docs 404 page
reference https://github.com/rust-lang/rust/issues/18498
2014-11-01 20:43:02 -07:00
P1start
5bf9ef2122 Convert some notes to help messages
Closes #18126.
2014-11-02 16:12:23 +13:00
Joseph Crail
835b92efb8 Replace deprecated missing_doc attribute. 2014-11-01 21:12:13 -04:00
Daniel Hofstetter
83225cc38d Reference: Add missing of's 2014-11-01 15:34:01 +01:00
Daniel Hofstetter
88d7f0a8da Guide: Fix variable name 2014-11-01 14:56:48 +01:00
Adrien Tétar
f4fb57b110 doc: enable OpenType kerning and ligatures 2014-11-01 00:16:48 +01:00
Rolf van de Krol
66b8cc8692 small fix to output of code sample in intro.md 2014-10-31 20:28:58 +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