Commit graph

1155 commits

Author SHA1 Message Date
bors
2bfb64e525 auto merge of #19627 : steveklabnik/rust/testing_guide, r=cmr 2014-12-13 17:27:15 +00:00
Steve Klabnik
d4ea71dbc1 Revamped testing guide 2014-12-13 12:19:43 -05:00
Alex Crichton
1a61fe4280 Test fixes and rebase conflicts from the rollup 2014-12-09 10:26:04 -08:00
Alex Crichton
a2e9c99a66 rollup merge of #19616: steveklabnik/gh19556
Closes #19556.
2014-12-09 09:25:06 -08:00
Alex Crichton
e6d8190b0c rollup merge of #19615: steveklabnik/gh19595
Fixes #19595.
2014-12-09 09:25:05 -08:00
Alex Crichton
fb587f1f9b rollup merge of #19614: steveklabnik/gh19599
Fixes #19599
2014-12-09 09:25:04 -08:00
Alex Crichton
ae805da487 rollup merge of #19608: jbranchaud/add-missing-semicolon-in-intro 2014-12-09 09:24:53 -08:00
Alex Crichton
60f97fc44a rollup merge of #19585: mdinger/guide_typo
@steveklabnik r?
2014-12-09 09:24:43 -08:00
Alex Crichton
6a652cfd1d rollup merge of #19584: CaptainHayashi/patch-1
Substitutes 'lifetime' for 'liftime' in a few places.

Apologies if this has already been noticed/PRQed!  I did try to do due diligence, though 😀
2014-12-09 09:24:42 -08:00
Alex Crichton
a09632f7cb rollup merge of #19576: nhoss2/master
There was a link to a non existing guide
2014-12-09 09:24:38 -08:00
Niko Matsakis
096a28607f librustc: Make Copy opt-in.
This change makes the compiler no longer infer whether types (structures
and enumerations) implement the `Copy` trait (and thus are implicitly
copyable). Rather, you must implement `Copy` yourself via `impl Copy for
MyType {}`.

A new warning has been added, `missing_copy_implementations`, to warn
you if a non-generic public type has been added that could have
implemented `Copy` but didn't.

For convenience, you may *temporarily* opt out of this behavior by using
`#![feature(opt_out_copy)]`. Note though that this feature gate will never be
accepted and will be removed by the time that 1.0 is released, so you should
transition your code away from using it.

This breaks code like:

    #[deriving(Show)]
    struct Point2D {
        x: int,
        y: int,
    }

    fn main() {
        let mypoint = Point2D {
            x: 1,
            y: 1,
        };
        let otherpoint = mypoint;
        println!("{}{}", mypoint, otherpoint);
    }

Change this code to:

    #[deriving(Show)]
    struct Point2D {
        x: int,
        y: int,
    }

    impl Copy for Point2D {}

    fn main() {
        let mypoint = Point2D {
            x: 1,
            y: 1,
        };
        let otherpoint = mypoint;
        println!("{}{}", mypoint, otherpoint);
    }

This is the backwards-incompatible part of #13231.

Part of RFC #3.

[breaking-change]
2014-12-08 13:47:44 -05:00
bors
c7a9b49d1b auto merge of #19560 : sfackler/rust/should-fail-reason, r=alexcrichton
The test harness will make sure that the panic message contains the
specified string. This is useful to help make `#[should_fail]` tests a
bit less brittle by decreasing the chance that the test isn't
"accidentally" passing due to a panic occurring earlier than expected.
The behavior is in some ways similar to JUnit's `expected` feature:
`@Test(expected=NullPointerException.class)`.

Without the message assertion, this test would pass even though it's not
actually reaching the intended part of the code:
```rust
#[test]
#[should_fail(message = "out of bounds")]
fn test_oob_array_access() {
    let idx: uint = from_str("13o").unwrap(); // oops, this will panic
    [1i32, 2, 3][idx];
}
```
2014-12-08 12:12:23 +00:00
Steven Fackler
a20926a51a Mention expected in testing docs 2014-12-07 16:04:56 -08:00
Steve Klabnik
e294772072 Add enum namespacing to the Guide.
Closes #19556.
2014-12-07 07:55:30 -05:00
Steve Klabnik
131f20279e Correct the reference with regards to floats
Fixes #19595.
2014-12-07 07:30:15 -05:00
Steve Klabnik
8ba5605233 remove usage of notrust from the docs
Fixes #19599
2014-12-07 04:18:56 -05:00
jbranchaud
2171c95553 Add missing semicolon to hello world program in intro. 2014-12-06 17:36:32 -06:00
mdinger
796e4b8a88 Typo 2014-12-05 20:14:28 -05:00
Matt Windsor
363ed2f7ad Correct minor typos on the ownership guide.
liftimes -> lifetimes
2014-12-06 00:30:03 +00:00
Corey Farwell
4ef16741e3 Utilize fewer reexports
In regards to:

https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729

This commit:

* Changes the #deriving code so that it generates code that utilizes fewer
  reexports (in particur Option::* and Result::*), which is necessary to
  remove those reexports in the future
* Changes other areas of the codebase so that fewer reexports are utilized
2014-12-05 18:13:04 -05:00
Nafis
e1b77b0709 fix 404 2014-12-06 08:17:49 +10:00
Corey Richardson
39646d2ff6 rollup merge of #19526: steveklabnik/gh19402
Fixes #19402.
2014-12-05 10:07:49 -08:00
Corey Richardson
0fb040f4bd rollup merge of #19525: steveklabnik/guide_edits
Fixes #19335. (or at least, the actionable parts)
2014-12-05 10:07:48 -08:00
Corey Richardson
fb55cbda8d rollup merge of #19462: MatejLach/but-and_guide
Using `and` here instead of `but` sounds better to me, as but makes it sound like an item which is still under active development shouldn't normally require more testing, but this one does - or something like that :-)
@steveklabnik?
2014-12-05 10:07:04 -08:00
Corey Richardson
f2b81888c1 rollup merge of #19458: MatejLach/guess_style_fix_guide
I think that this wording makes it more clear as to what we're doing here.
Opinions @steveklabnik ?
2014-12-05 10:07:03 -08:00
Corey Richardson
2af097da0d rollup merge of #19396: kulakowski/patch-1 2014-12-05 10:06:45 -08:00
Steve Klabnik
010cbd011a Tasks aren't actually lightweight :frown:
Fixes #19402.
2014-12-04 11:43:22 -05:00
Steve Klabnik
f0f7a90068 Some small copy edits to the guide.
Fixes #19335.
2014-12-04 11:39:13 -05:00
bors
3c89031e1f auto merge of #18613 : steveklabnik/rust/ownership_guide, r=huonw
This is a work in progress, but this should get *extensive* review, so I'm putting it up early and often.

This is the start of a draft of the new 'ownership guide,' which explains ownership, borrowing, etc. I'm feeling better about this framing than last time's, but we'll see.
2014-12-04 04:52:37 +00:00
Steve Klabnik
7213704812 New Guide: Ownership
This replaces the previous "Lifetimes guide," since we are discussing
things from an owernship perspective now.
2014-12-03 03:27:17 -05:00
Matej Lach
ebf22cbf6a replace 'but' with 'and' 2014-12-02 16:45:57 +00:00
Matej Lach
5bbe5d6d93 better wording 2014-12-02 13:40:18 +00:00
Matej Lach
d9a3ea88fc Fix a simple typo 2014-11-29 13:26:32 +00:00
kulakowski
9460d1744f Fix typo in reference.md 2014-11-29 01:38:32 -06:00
Steve Klabnik
4d1cb7820d reword faq to remove reference to indexing strings
Fixes #19344
2014-11-28 10:06:08 -05:00
bors
66601647cd auto merge of #19343 : sfackler/rust/less-special-attrs, r=alexcrichton
Descriptions and licenses are handled by Cargo now, so there's no reason
to keep these attributes around.
2014-11-27 06:41:17 +00:00
Alex Crichton
62137b6d79 rollup merge of #19336: apasel422/guide
- `s/(left|right) hand/\1-hand/`
- `s/parenthesis/parentheses/`
- `s/unicode/Unicode/`
- `s/validly-encoded/validly encoded/`
2014-11-26 16:50:13 -08:00
Alex Crichton
9c27ab6125 rollup merge of #19325: ucarion/pointers-doc-formatting
The "Returning Pointers" section of the pointers guide broke from the convention of putting code between backticks. This PR fixes that. There's also a little trailing whitespace I took care of.
2014-11-26 16:50:12 -08:00
Alex Crichton
52ca9523a5 rollup merge of #19313: steveklabnik/gh18844
Fixes #18844
2014-11-26 16:50:11 -08:00
Alex Crichton
935a39b3cd rollup merge of #19312: steveklabnik/gh19177 2014-11-26 16:50:10 -08:00
Alex Crichton
8790ab148b rollup merge of #19310: steveklabnik/gh19178
Fixes #19178
2014-11-26 16:49:49 -08:00
Alex Crichton
6939e4f58c rollup merge of #19307: steveklabnik/gh19199
Fixes #19199
2014-11-26 16:49:49 -08:00
Alex Crichton
ea4944233e rollup merge of #19304: steveklabnik/gh19302
Fixes #19302.

Also made a minor cosmetic change to bring the example in line with style guidelines.
2014-11-26 16:49:49 -08:00
Alex Crichton
b095eb1720 rollup merge of #19300: killercup/patch-1
Just saw this when looking at #19297 and couldn't find an issue/PR dealing with this. #18773 seems to have missed this file.

Compiler output is generated [here](770378a313/src/librustc_trans/driver/mod.rs (L466)).

cc @steveklabnik
2014-11-26 16:49:48 -08:00
Steve Klabnik
e2fe7a083e Lifetime guide -> ownership guide 2014-11-26 15:03:12 -05:00
Steven Fackler
348cc9418a Remove special casing for some meta attributes
Descriptions and licenses are handled by Cargo now, so there's no reason
to keep these attributes around.
2014-11-26 11:44:45 -08:00
Andrew Paseltiner
b7520f595f fix errors in the guide
- `s/(left|right) hand/\1-hand/`
- `s/parenthesis/parentheses/`
- `s/unicode/Unicode/`
- `s/validly-encoded/validly encoded/`
2014-11-26 08:41:40 -05:00
Ulysse Carion
6cb03baffa Fix formatting of the pointers guide. 2014-11-25 16:32:53 -08:00
Steve Klabnik
55853c532f We now support 64 bit Windows.
Fixes #18844
2014-11-25 11:43:05 -05:00
Steve Klabnik
8369a607ed add slice patterns to the guide
Fixes #19177.
2014-11-25 11:37:20 -05:00