Commit Graph

180 Commits

Author SHA1 Message Date
Malo Jaffré 4ef554206c Avoid linking to a moved page in rust.html 2017-03-29 15:38:47 +02:00
Steve Klabnik 47682f96de manual -> reference & formatting
'reference' sounds better than 'manual' to me here, and rust.html is
certainly wrong.

I also wrapped everything to 80 cols.
2014-09-22 17:54:09 -04:00
Alex Crichton 0169218047 Fix fallout from Vec stabilization 2014-09-21 22:15:51 -07:00
Patrick Walton 78a841810e librustc: Implement associated types behind a feature gate.
The implementation essentially desugars during type collection and AST
type conversion time into the parameter scheme we have now. Only fully
qualified names--e.g. `<T as Foo>::Bar`--are supported.
2014-09-17 16:38:57 -07:00
Martin Olsson 7caf2ab802 Fix two typos 2014-09-15 23:04:08 +02:00
bors 4727381685 auto merge of #16657 : steveklabnik/rust/goodbye_tutorial, r=brson
The Guide isn't 100% perfect, but it's basically complete. It's
certainly better than the tutorial is. Time to start pointing more
people its way.

I also just made it consistent to call all things 'guides' rather than
tutorials.

Fixes #9874. This is the big one.

And two bugs that just go away.

Fixes #14503.
Fixes #15009.
2014-09-12 01:15:41 +00:00
Steve Klabnik a99ba25f2b Replace the Tutorial with the Guide.
The Guide isn't 100% perfect, but it's basically complete. It's
certainly better than the tutorial is. Time to start pointing more
people its way.

I also just made it consistent to call all things 'guides' rather than
tutorials.

Fixes #9874. This is the big one.

And two bugs that just go away.

Fixes #14503.
Fixes #15009.
2014-09-11 16:21:32 -04:00
bors d24c82420b auto merge of #17154 : steveklabnik/rust/array_clarification, r=huonw
fixes #17148
2014-09-11 18:50:41 +00:00
Steve Klabnik faf14ae633 Fix vector terminology in the manual.
fixes #17148
2014-09-10 17:02:37 -04:00
P1start bf274bc18b Implement tuple and tuple struct indexing
This allows code to access the fields of tuples and tuple structs:

    let x = (1i, 2i);
    assert_eq!(x.1, 2);

    struct Point(int, int);
    let origin = Point(0, 0);
    assert_eq!(origin.0, 0);
    assert_eq!(origin.1, 0);
2014-09-10 10:25:12 +12:00
Alex Crichton 8158463122 rollup merge of #17054 : pcwalton/subslice-syntax 2014-09-09 12:07:12 -07:00
Alex Crichton 2c66c296db rollup merge of #17052 : pcwalton/feature-gate-subslices 2014-09-09 12:07:11 -07:00
bors 641b1980a4 auto merge of #16825 : steveklabnik/rust/fix_manual_array_terms, r=brson
fixes #16015
2014-09-09 04:26:18 +00:00
Patrick Walton eb678ff87f librustc: Change the syntax of subslice matching to use postfix `..`
instead of prefix `..`.

This breaks code that looked like:

    match foo {
        [ first, ..middle, last ] => { ... }
    }

Change this code to:

    match foo {
        [ first, middle.., last ] => { ... }
    }

RFC #55.

Closes #16967.

[breaking-change]
2014-09-08 16:12:13 -07:00
Patrick Walton 22179f49e5 librustc: Feature gate subslice matching in non-tail positions.
This breaks code that uses the `..xs` form anywhere but at the end of a
slice. For example:

    match foo {
        [ 1, ..xs, 2 ]
        [ ..xs, 1, 2 ]
    }

Add the `#![feature(advanced_slice_patterns)]` gate to reenable the
syntax.

RFC #54.

Closes #16951.

[breaking-change]
2014-09-08 11:04:14 -07:00
Steve Klabnik a021330b1d Fix vector/array/slice terminology in manual.
Fixes #16015.
2014-09-07 05:28:59 -04:00
Felix Raimundo d0f1c7dfb0 Update language item from 'share' to 'sync' #16988 2014-09-05 02:03:26 +02:00
bors dfbd4669cd auto merge of #16925 : jbcrail/rust/doc-spelling-errors, r=alexcrichton
I fixed spelling mistakes in the documentation.
2014-09-02 10:31:04 +00:00
Joseph Crail 7241267b93 doc: Fix spelling errors. 2014-09-01 20:52:38 -04:00
Steve Klabnik d32bfe8c2b Fix pointer types in the manual. 2014-09-01 14:03:00 -04:00
Alex Crichton f7f8b20961 rollup merge of #16780 : mdinger/marker_types 2014-08-30 23:46:19 -07:00
mdinger 48a2876c2c Fix sorting order. Change `sync` to `share` 2014-08-27 00:26:50 -04:00
wickerwaka c0e003d5ad extern crate foobar as foo;
Implements remaining part of RFC #47.
Addresses issue #16461.

Removed link_attrs from rust.md, they don't appear to be supported by
the parser.

Changed all the tests to use the new extern crate syntax

Change pretty printer to use 'as' syntax
2014-08-23 12:16:04 -07:00
Corey Richardson c630d96166 manual: fix link 2014-08-20 21:02:23 -04:00
Corey Richardson 54bd9e6323 docs: don't claim struct layout is specified, but mention repr 2014-08-20 19:11:25 -04:00
bors 3570095e34 auto merge of #16583 : steveklabnik/rust/gh16569, r=pcwalton
Fixes #16569
2014-08-19 10:20:54 +00:00
Steve Klabnik e7910322cc Manual: add information about //!
Fixes #16569
2014-08-18 14:26:25 -04:00
Patrick Walton 67deb2e65e libsyntax: Remove the `use foo = bar` syntax from the language in favor
of `use bar as foo`.

Change all uses of `use foo = bar` to `use bar as foo`.

Implements RFC #47.

Closes #16461.

[breaking-change]
2014-08-18 09:19:10 -07:00
Jakub Wieczorek 7606f580a1 Add `use a:🅱️:{c, mod};` to the manual 2014-08-16 22:42:38 +02:00
bors 406de8d5dd auto merge of #16500 : jackheizer/rust/export-name, r=alexcrichton 2014-08-15 12:11:16 +00:00
Patrick Walton 1c16accfc2 libsyntax: Accept `use foo as bar;` in lieu of `use bar as foo;`
The old syntax will be removed after a snapshot.

RFC #47.

Issue #16461.
2014-08-14 13:24:50 -07:00
Jack Heizer 614bfbe577 Add export_name to the attribute whitelist and a description in the rust manual 2014-08-14 12:29:07 -07:00
bors 320c35ee34 auto merge of #16444 : steveklabnik/rust/fix_boxes_in_manual, r=brson
Fixes #16439
2014-08-14 11:16:19 +00:00
bors 32098bbb0d auto merge of #16440 : bheesham/rust/master, r=brson
* `rust.md`: changes for consistency

  * `guide-ffi.md`: wrapped inline code

NOTE: This is a duplicate of #16375. I completely messed up that fork, so I made a new fork.
2014-08-14 09:31:19 +00:00
bors 259e806db6 auto merge of #16428 : mdinger/rust/sort_attributes, r=cmr
Targetting at fixing most of #16414.

Sorts these alphabetically:
* [Crate-only attributes](http://doc.rust-lang.org/rust.html#crate-only-attributes)
* [Function-only attributes](http://doc.rust-lang.org/rust.html#function-only-attributes)
* [Miscellaneous attributes](http://doc.rust-lang.org/rust.html#miscellaneous-attributes)
* [Lint check attributes](http://doc.rust-lang.org/rust.html#lint-check-attributes)
* [Built-in Traits](http://doc.rust-lang.org/rust.html#built-in-traits)
* [Types](http://doc.rust-lang.org/rust.html#types)
* [Deriving](http://doc.rust-lang.org/rust.html#deriving)
* [Compiler Features](http://doc.rust-lang.org/rust.html#compiler-features)

Doesn't modify these:
* [Operators](http://doc.rust-lang.org/rust.html#operators): An alternative sorting is unclear.
* [Marker types](http://doc.rust-lang.org/rust.html#marker-types): Could be sorted but uncertain how. See below.
* [Stability](http://doc.rust-lang.org/rust.html#stability): Already sorted by stability

---

[Marker types](http://doc.rust-lang.org/rust.html#marker-types) has an extra newline above `fail_` which may throw off formatting (see #16412) or it may be for some other reason. If the newline is just a typo, I can just remove it and format this alphabetically like so:
```rust
// Sorted alphabetically
a_bread
b_bread
c_bread
fail_
fail_bounds_check
a_type
b_type
c_type
```

Marker types is listed as likely to become out of date so I don't know if this is worth doing anyway.

[EDIT] modified `Marker types` now and tried to update the language items list.
2014-08-14 07:41:20 +00:00
mdinger c69f7a9234 Sort `Marker types` and add missing language items 2014-08-13 18:11:10 -04:00
Steve Klabnik 5eb4e1a659 ~ -> Box in the manual
Fixes #16439
2014-08-12 07:58:36 -04:00
Bheesham Persaud a43dadb204 Minor changes to `rust.md`, and `guide-ffi.md`.
* `rust.md`: whanges for consistency

  * `guide-ffi.md`: wrapped inline code
2014-08-12 03:13:50 -04:00
mdinger 2867d1f24a Sort most attributes alphabetically 2014-08-11 15:29:44 -04:00
Felix S. Klock II 97e82cc2df rust.md: Explicitly point out how special `'static` is.
Drive-by: fix description of `&content` to point out that `&'f type`
is (as of today) only for type expressions.
2014-08-09 11:15:04 +02:00
Alex Crichton 1f760d5d1a Rename `Share` to `Sync`
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use`
statement, but the `NoShare` struct is no longer part of `std::kinds::marker`
due to #12660 (the build cannot bootstrap otherwise).

All code referencing the `Share` trait should now reference the `Sync` trait,
and all code referencing the `NoShare` type should now reference the `NoSync`
type. The functionality and meaning of this trait have not changed, only the
naming.

Closes #16281
[breaking-change]
2014-08-07 08:54:38 -07:00
OGINO Masanori bf2d98e190 Remove the "NFKC clause" in the reference manual.
The reference manual said that code is interpreted as UTF-8 text and a
implementation will normalize it to NFKC. However, rustc doesn't do
any normalization now.

We may want to do any normalization for symbols, but normalizing whole
text seems harmful because doing so loses some sort of information even
if we choose a non-K variant of normalization.

I'd suggest removing "normalized to Unicode normalization form NFKC"
phrase for the present so that the manual represents the current state
properly. When we address the problem (with a RFC?), then the manual
should be updated.

Closes #12388.

Reference: https://github.com/rust-lang/rust/issues/2253

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-08-03 23:41:05 +09:00
Steve Klabnik cf279105d5 Fix manual regarding attribute placement.
Fixes #15494.
2014-08-01 23:12:14 -04:00
Patrick Walton 5b85c8cbe7 librustc: Forbid pattern bindings after `@`s, for memory safety.
This is an alternative to upgrading the way rvalues are handled in the
borrow check. Making rvalues handled more like lvalues in the borrow
check caused numerous problems related to double mutable borrows and
rvalue scopes. Rather than come up with more borrow check rules to try
to solve these problems, I decided to just forbid pattern bindings after
`@`. This affected fewer than 10 lines of code in the compiler and
libraries.

This breaks code like:

    match x {
        y @ z => { ... }
    }

    match a {
        b @ Some(c) => { ... }
    }

Change this code to use nested `match` or `let` expressions. For
example:

    match x {
        y => {
            let z = y;
            ...
        }
    }

    match a {
        Some(c) => {
            let b = Some(c);
            ...
        }
    }

Closes #14587.

[breaking-change]
2014-08-01 08:45:22 -07:00
bors 9826e801be auto merge of #16073 : mneumann/rust/dragonfly2, r=alexcrichton
Not included are two required patches:

* LLVM: segmented stack support for DragonFly [1]

* jemalloc: simple configure patches

[1]: http://reviews.llvm.org/D4705
2014-07-31 14:41:34 +00:00
Corey Richardson 2a3c0d91cf manual: update list of feature gates, add phase attribute 2014-07-29 15:43:57 -07:00
Michael Neumann 2e2f53fad2 Port Rust to DragonFlyBSD
Not included are two required patches:

* LLVM: segmented stack support for DragonFly [1]

* jemalloc: simple configure patches

[1]: http://reviews.llvm.org/D4705
2014-07-29 16:44:39 +02:00
Patrick Walton bb165eb5c2 libsyntax: Remove `~self` and `mut ~self` from the language.
This eliminates the last vestige of the `~` syntax.

Instead of `~self`, write `self: Box<TypeOfSelf>`; instead of `mut
~self`, write `mut self: Box<TypeOfSelf>`, replacing `TypeOfSelf` with
the self-type parameter as specified in the implementation.

Closes #13885.

[breaking-change]
2014-07-24 07:26:03 -07:00
Patrick Walton de70d76373 librustc: Remove cross-borrowing of `Box<T>` to `&T` from the language,
except where trait objects are involved.

Part of issue #15349, though I'm leaving it open for trait objects.
Cross borrowing for trait objects remains because it is needed until we
have DST.

This will break code like:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(a);

Change this code to:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(&*a);

[breaking-change]
2014-07-17 14:05:36 -07:00
Richo Healey 12c334a77b std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.
[breaking-change]
2014-07-08 13:01:43 -07:00