Commit graph

41469 commits

Author SHA1 Message Date
Alex Crichton
75f35657b3 rollup merge of #24162: pnkfelix/fsk-detect-duplicate-loop-labels
Check for duplicate loop labels in function bodies.

See also: http://internals.rust-lang.org/t/psa-rejecting-duplicate-loop-labels/1833

The change, which we are putting in as future-proofing in preparation for future potential additions to the language (namely labeling arbitrary blocks and using those labels in borrow expressions), means that code like this will start emitting warnings:

```rust
fn main() {
    { 'a: loop { break; } }
    { 'a: loop { break; } }
}
```

To make the above code compile without warnings, write this instead:

```rust
fn main() {
    { 'a: loop { break; } }
    { 'b: loop { break; } }
}
```

Since this change is only introducing a new warnings, this change is non-breaking.

Fix #21633
2015-04-21 15:23:05 -07:00
Felix S. Klock II
2b3cd40f82 add notes clarifying introduction of warnings for a pair of run-pass tests. 2015-04-21 18:09:46 +02:00
Felix S. Klock II
ccc9f5eb84 Tests for shadowing between lifetimes and loop labels within function bodies. 2015-04-21 18:09:46 +02:00
Felix S. Klock II
dd24070799 Check for shadowing between lifetimes and loop labels in function bodies.
Note: this Warns rather than error on shadowing problems involving labels.
We took this more conservative option mostly due to issues with
hygiene being broken for labels and/or lifetimes.

Add FIXME regarding non-hygienic comparison.
2015-04-21 18:09:41 +02:00
bors
7397bdc9c5 Auto merge of #24620 - pczarn:model-lexer-issues, r=cmr
Fixes #15679
Fixes #15878
Fixes #15882
Closes #15883
2015-04-21 14:37:53 +00:00
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
bors
3860240b0e Auto merge of #24646 - brson:stab, r=alexcrichton 2015-04-21 07:24:09 +00: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
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