Commit Graph

41726 Commits

Author SHA1 Message Date
bors
77acda1c8e Auto merge of #24598 - lfairy:impl-debug-for-file, r=alexcrichton
This patch adds a `Debug` impl for `std::fs::File`.

On all platforms (Unix and Windows) it shows the file descriptor.

On Linux, it displays the path and access mode as well.

Ideally we should show the path/mode for all platforms, not just Linux,
but this will do for now.

cc #24570
2015-04-21 11:46:15 +00:00
Piotr Czarnecki
13bc8afa4b Model lexer: Fix remaining issues 2015-04-21 12:02:12 +02:00
P1start
7d2231aa22 Change a few error messages to give code suggestions
PR #24242 added the ability to the compiler to directly give suggestions about
how to modify code to fix an error. The new errors look like this:

    foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`,
                                not `&'static Copy` [E0178]
    foobar.rs:5     let x: &'static Copy + 'static;
                           ^~~~~~~~~~~~~
    foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438):
    foobar.rs:      let x: &'static (Copy + 'static);

    foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy`
    foobar.rs:2     let x = &1 as Copy;
                            ^~~~~~~~~~
    foobar.rs:2:19: 2:23 help: try casting to a reference instead:
    foobar.rs:      let x = &1 as &Copy;

    foobar.rs:7:24: 7:25 error: expected expression, found `;`
    foobar.rs:7     let x = box (1 + 1);
                                       ^
    foobar.rs:7:13: 7:16 help: try using `box()` instead:
    foobar.rs:      let x = box() (1 + 1);

This also modifies compiletest to give the ability to directly test suggestions
given by error messages.
2015-04-21 21:13:42 +12:00
bors
3860240b0e Auto merge of #24646 - brson:stab, r=alexcrichton 2015-04-21 07:24:09 +00:00
Nick Hamann
ba4d55d130 Separate code into two code blocks 2015-04-21 01:15:51 -05:00
Chris Wong
1131bc0a0f Implement Debug for File
This patch adds a `Debug` impl for `std::fs::File`.

On all platforms (Unix and Windows) it shows the file descriptor.

On Linux, it displays the path and access mode as well.

Ideally we should show the path/mode for all platforms, not just Linux,
but this will do for now.

cc #24570
2015-04-21 17:13:36 +12:00
mdinger
dc596695c9 Fix typos 2015-04-21 01:05:26 -04:00
Nick Hamann
e178495a5e Address some nits 2015-04-20 21:01:13 -05:00
Nick Hamann
db2f308a46 Add two examples for Path::new 2015-04-20 20:45:02 -05:00
bors
21c48c3e82 Auto merge of #24648 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #24514, #24516, #24571, #24577, #24625, #24627, #24628, #24629, #24630, #24631, #24632, #24642, #24643, #24647
- Failed merges: #24640
2015-04-21 01:18:15 +00:00
Steve Klabnik
9ddcc38b6e Refocus unsafe code chapter on unsafe itself. 2015-04-20 21:17:46 -04:00
Steve Klabnik
550c8d87a7 Rollup merge of #24647 - mbrubeck:doc-edit, r=steveklabnik
None
2015-04-20 21:15:55 -04:00
Steve Klabnik
1d082de2d9 Rollup merge of #24643 - steveklabnik:doc_if_let, r=jakub-
and while let
2015-04-20 21:15:54 -04:00
Steve Klabnik
d09a0cda3a Rollup merge of #24642 - tshepang:why-be-negative, r=huonw 2015-04-20 21:15:54 -04:00
Steve Klabnik
52ec8bdf73 Rollup merge of #24632 - steveklabnik:casting_guide, r=alexcrichton
Due to documenting `transmute`, addresses part of #12905
2015-04-20 21:15:54 -04:00
Steve Klabnik
9f87362308 Rollup merge of #24631 - steveklabnik:unsafe_guide, r=alexcrichton
Many unsafe features are now in the unstable section, so this section is
really just about raw pointers now. That also makes sense for its place
in the TOC.

This addresses part of #12905.
2015-04-20 21:15:54 -04:00
Steve Klabnik
05ee6f0709 Rollup merge of #24630 - steveklabnik:quickfix, r=alexcrichton 2015-04-20 21:15:53 -04:00
Steve Klabnik
77fee7db49 Rollup merge of #24629 - steveklabnik:gh24511, r=alexcrichton
Without the `box` keyword, one of these two reasons is not correct, so
let's just eliminate this section and elaborate on the reason for the
legit use case inline.

Fixes #24511
2015-04-20 21:15:53 -04:00
Steve Klabnik
5de4e87f27 Rollup merge of #24628 - steveklabnik:gh24173, r=alexcrichton
Fixes #24173 

These docs could all use examples, so for now, let's just remove the bad one, and when I go over this whole module I'll put in better ones.
2015-04-20 21:15:53 -04:00
Steve Klabnik
417ff8a404 Rollup merge of #24627 - steveklabnik:gh24008, r=alexcrichton
Fixes #24008.
2015-04-20 21:15:53 -04:00
Steve Klabnik
3e8d099648 Rollup merge of #24625 - frewsxcv:patch-16, r=steveklabnik
As far as I can tell, this conversion to integer to floating point does not need to happen and is beside the point
2015-04-20 21:15:53 -04:00
Steve Klabnik
81b603e7a5 Rollup merge of #24577 - steveklabnik:gh24573, r=alexcrichton
Fixes #24573
2015-04-20 21:15:52 -04:00
Steve Klabnik
ff12b7b308 Rollup merge of #24571 - steveklabnik:editing, r=alexcrichton
A bunch of chapters, fixes an issue or two as well.

r? @alexcrichton
2015-04-20 21:15:52 -04:00
Steve Klabnik
de13f95f21 Rollup merge of #24516 - steveklabnik:gh22621, r=alexcrichton
Fixes #22621
2015-04-20 21:15:52 -04:00
Steve Klabnik
75998b569a Rollup merge of #24514 - krzysz00:no-warnings-in-liballoc, r=alexcrichton
When `liballoc` is compiled with `--cfg feature=\"external_features\"`, several `improper_ctypes` warnings are generated. Since these warnings are harmless, I have added a directive to suppress them.
2015-04-20 21:15:52 -04:00
Matt Brubeck
d8943e1fa3 Update reference to old_io in fmt docs 2015-04-20 17:51:56 -07:00
Brian Anderson
bb407b1e9d Make stability attributes an error. #22830 2015-04-20 17:33:31 -07:00
Steve Klabnik
570b250b8f TRPL: if let
and while let
2015-04-20 19:48:24 -04:00
Tshepang Lekhonkhobe
298a6e6657 lint: explain the non-obvious need for a negative test 2015-04-20 23:11:58 +02:00
bors
f46c4e158d Auto merge of #24606 - bombless:doc-result, r=alexcrichton
Get rid of the confusion that what does "custom" mean in this context.
2015-04-20 18:43:34 +00:00
Steve Klabnik
1e29abec59 Add common macros to TRPL
Fixes #22621
2015-04-20 14:40:54 -04:00
Steve Klabnik
1150fb0f88 TRPL: unsafe -> raw pointers
Many unsafe features are now in the unstable section, so this section is
really just about raw pointers now. That also makes sense for its place
in the TOC.

This addresses part of #12905.
2015-04-20 13:38:05 -04:00
Steve Klabnik
0f20c9d8b7 Remove feature gated examples from the reference.
The slice patterns example was nice, so let's put it with the other
slice pattern feature gate documentation.

Fixes #24573
2015-04-20 13:33:57 -04:00
Steve Klabnik
9a65045611 TRPL: casting
Due to documenting `transmute`, addresses part of #12905
2015-04-20 11:55:29 -04:00
bors
e959fab4a5 Auto merge of #24597 - bombless:doc, r=steveklabnik
This patch will make links like http://doc.rust-lang.org/std/collections/struct.BTreeMap.html#examples actually playable without modifying the code.

It seems that this patch cannot be tested on test/rustdoc.

And I suggest adding a `&run=1` to those links.

Thank @jorisgio for noticing me this!

r? @steveklabnik 

Closes https://github.com/rust-lang/rust/issues/24332
2015-04-20 15:23:52 +00:00
Steve Klabnik
fbd3261e37 Fix small typo in TRPL intro 2015-04-20 10:42:17 -04:00
Steve Klabnik
ac09864c90 Clean up Box documentation.
Without the `box` keyword, one of these two reasons is not correct, so
let's just eliminate this section and elaborate on the reason for the
legit use case inline.

Fixes #24511
2015-04-20 10:06:49 -04:00
Steve Klabnik
89ef6371e0 remove bad example from PartialEq docs
Fixes #24173
2015-04-20 09:59:58 -04:00
Steve Klabnik
1dd8a651ba Make iterator struct docs more consistent.
Fixes #24008.
2015-04-20 09:55:40 -04:00
Steve Klabnik
14af25797f TRPL edits: generics 2015-04-20 09:44:21 -04:00
Steve Klabnik
1c48227b3c Remove inverse example from generics part of TRPL
Fixes #24325.
2015-04-20 09:44:21 -04:00
Steve Klabnik
e289b689d4 TRPL edits: traits
Let's talk about generics first, since we use traits to bound them
in funtions.

Partially addresses #24325

Fixes #24271
2015-04-20 09:44:10 -04:00
Steve Klabnik
1646ebd5ba move Deref coercions to syntax and semantics
It's a language feature, so it belongs here.
2015-04-20 09:37:49 -04:00
Steve Klabnik
5b54a4f03b TRPL copyedits: strings 2015-04-20 09:37:49 -04:00
Steve Klabnik
73d3d68550 TRPL editing: vectors 2015-04-20 09:37:49 -04:00
Steve Klabnik
a3a2049166 Move drop back in TRPL TOC
It's a trait implementation, so we need traits first.
2015-04-20 09:37:49 -04:00
Steve Klabnik
f81b1fcf8c TRPL edits: method syntax 2015-04-20 09:37:49 -04:00
Steve Klabnik
7f43c5782c TRPL editing: structs 2015-04-20 09:37:48 -04:00
Steve Klabnik
44db46a308 TRPL editing: move patterns back
We want to talk about how to pattern match on structs, so let's bump
it back one.
2015-04-20 09:37:48 -04:00
Steve Klabnik
9661efac8b TRPL editing: patterns
Partially addresses #24388
2015-04-20 09:37:48 -04:00