Commit Graph

37836 Commits

Author SHA1 Message Date
bors
e9e9279d87 Auto merge of #24685 - nrc:span-pred, r=huonw 2015-04-22 08:47:09 +00:00
Simon Sapin
bf1310389e Add a test for std::fmt::Write::write_char 2015-04-22 08:52:18 +02:00
bors
50cd2e84d5 Auto merge of #24671 - steveklabnik:doc_const_static, r=alexcrichton
r? @alexcrichton
2015-04-22 06:37:57 +00:00
Nick Cameron
8456dba4e6 Fix spans for predicates in where clauses 2015-04-22 18:29:54 +12:00
Steve Klabnik
a04f6c5293 TRPL: const and static 2015-04-21 19:47:07 -04:00
Alex Crichton
224fc1085b Test fixes and rebase conflicts, round 1 2015-04-21 16:17:24 -07:00
Alex Crichton
a1dd5ac787 rollup merge of #24636: alexcrichton/remove-deprecated
Conflicts:
	src/libcore/result.rs
2015-04-21 15:28:53 -07:00
Alex Crichton
98e9765d97 rollup merge of #24541: alexcrichton/issue-24538
This is an implementation of [RFC 1030][rfc] which adds these traits to the
prelude and additionally removes all inherent `into_iter` methods on collections
in favor of the trait implementation (which is now accessible by default).

[rfc]: https://github.com/rust-lang/rfcs/pull/1030

This is technically a breaking change due to the prelude additions and removal
of inherent methods, but it is expected that essentially no code breaks in
practice.

[breaking-change]
Closes #24538
2015-04-21 15:28:06 -07:00
Alex Crichton
a568a7f9f2 std: Bring back f32::from_str_radix as an unstable API
This API was exercised in a few tests and mirrors the `from_str_radix`
functionality of the integer types.
2015-04-21 15:23:54 -07:00
Alex Crichton
44338cb944 rollup merge of #24672: steveklabnik/edit_tuple_structs
I thought I edited all the last little chapters, but I missed this one.

r? @alexcrichton
2015-04-21 15:23:18 -07:00
Alex Crichton
0feaf6154c rollup merge of #24669: steveklabnik/fix
This section was added but the list wasn't updated.
2015-04-21 15:23:17 -07:00
Alex Crichton
83008b2e9b rollup merge of #24667: steveklabnik/more_editing
r? @alexcrichton
2015-04-21 15:23:16 -07:00
Alex Crichton
1a6c18d660 rollup merge of #24665: sw17ch/document-complete-slice-syntax
The documentation doesn't appear to describe the `&foo[..]` syntax.

I tried looking in `primitive-types.html#slices` and `std/primitive.slice.html`.

There's an example of partially slicing an array in trpl and a mention of `&foo[..]` in [the standard library documentation](https://doc.rust-lang.org/std/primitive.slice.html), but neither place, from what I can see, actually describes the behavior of `&foo[..]`.

+r? @steveklabnik
2015-04-21 15:23:15 -07:00
Alex Crichton
ee9d4eefba rollup merge of #24663: steveklabnik/gh24639
Fixes #24639
2015-04-21 15:23:14 -07:00
Alex Crichton
c7017b3b3e rollup merge of #24661: SimonSapin/fmt-write-char
as accepted in [RFC 526](https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md).

Note that this brand new method is marked as **stable**. I judged this safe enough: it’s simple enough that it’s very unlikely to change. Still, I can mark it unstable instead if you prefer.

r? @alexcrichton
2015-04-21 15:23:13 -07:00
Alex Crichton
251f8d3fbd rollup merge of #24654: mdinger/patch-2
This just fixes some comments made on https://github.com/rust-lang/rust/pull/24632 . The second I think is better unless @steveklabnik actually meant something else.
2015-04-21 15:23:12 -07:00
Alex Crichton
59171f8ec8 rollup merge of #24651: tamird/old-references
r? @alexcrichton
2015-04-21 15:23:11 -07:00
Alex Crichton
1ec7ccb53c rollup merge of #24640: steveklabnik/new_unsafe_guide
https://github.com/rust-lang/rust/pull/24631 is related, as it will delete this from the TOC, but I want to keep it here.
2015-04-21 15:23:10 -07:00
Alex Crichton
d14fb2f0d6 rollup merge of #24635: tamird/llvm-3.5
r? @alexcrichton
2015-04-21 15:23:10 -07:00
Alex Crichton
6b1ce49574 rollup merge of #24611: doomsplayer/doomsplayer-patch-1
as dependency for #24594
2015-04-21 15:23:09 -07:00
Alex Crichton
a63df9218e rollup merge of #24563: kwantam/rfc_1054
For now, words() is left in (but deprecated), and Words is a type alias for
struct SplitWhitespace.

Also cleaned up references to str.words() throughout codebase.

Closes #15628
2015-04-21 15:23:08 -07:00
Alex Crichton
37a1f2e3ac rollup merge of #24487: erickt/syntax
This removes the usage of `#[feature(into_cow, slice_patterns, box_syntax, box_patterns, quote, unsafe_destructor)]` from being used in libsyntax. My main desire for this is that it brings me one step closer to letting [syntex](https://github.com/erickt/rust-syntex) compile with stable rust. Hopefully this doesn't inconvenience rust development.
2015-04-21 15:23:07 -07:00
Alex Crichton
957cb422a9 rollup merge of #24439: alexcrichton/fix-archive-assembler
When linking an archive statically to an rlib, the compiler will extract all
contents of the archive and add them all to the rlib being generated. The
current method of extraction is to run `ar x`, dumping all files into a
temporary directory. Object archives, however, are allowed to have multiple
entries with the same file name, so there is no method for them to extract their
contents into a directory in a lossless fashion.

This commit adds iterator support to the `ArchiveRO` structure which hooks into
LLVM's support for reading object archives. This iterator is then used to
inspect each object in turn and extract it to a unique location for later
assembly.
2015-04-21 15:23:06 -07:00
Alex Crichton
2fc2e12687 rollup merge of #24222: lambda/rename-soft-link-to-symlink
Implement [RFC #1048][rfc].

On Windows, when you create a symbolic link you must specify whether it
points to a directory or a file, even if it is created dangling, while
on Unix, the same symbolic link could point to a directory, a file, or
nothing at all.  Furthermore, on Windows special privilege is necessary
to use a symbolic link, while on Unix, you can generally create a
symbolic link in any directory you have write privileges to.

This means that it is unlikely to be able to use symbolic links purely
portably; anyone who uses them will need to think about the cross
platform implications.  This means that using platform-specific APIs
will make it easier to see where code will need to differ between the
platforms, rather than trying to provide some kind of compatibility
wrapper.

Furthermore, `soft_link` has no precedence in any other API, so to avoid
confusion, move back to the more standard `symlink` terminology.

Create a `std::os::unix::symlink` for the Unix version that is
destination type agnostic, as well as `std::os::windows::{symlink_file,
symlink_dir}` for Windows.

Because this is a stable API, leave a compatibility wrapper in
`std::fs::soft_link`, which calls `symlink` on Unix and `symlink_file`
on Windows, preserving the existing behavior of `soft_link`.

[rfc]: https://github.com/rust-lang/rfcs/pull/1048
2015-04-21 15:23:06 -07:00
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
Steve Klabnik
f78ee1aff1 Document functional update syntax
Fixes #24639
2015-04-21 16:18:51 -04:00
kwantam
c361e13d71 implement rfc 1054: split_whitespace() fn, deprecate words()
For now, words() is left in (but deprecated), and Words is a type alias for
struct SplitWhitespace.

Also cleaned up references to s.words() throughout codebase.

Closes #15628
2015-04-21 15:31:51 -04:00
kwantam
f43c86cda4 unstabilize Words struct
Words struct was stabilied by mistake. Unstabilize.
2015-04-21 15:31:45 -04:00
Steve Klabnik
b0105b5a59 TRPL editing: tuple structs 2015-04-21 15:25:43 -04:00
Alex Crichton
0791f9f406 test: Fix fallout in tests 2015-04-21 11:37:43 -07:00
Alex Crichton
eeb94886ad std: Remove deprecated/unstable num functionality
This commit removes all the old casting/generic traits from `std::num` that are
no longer in use by the standard library. This additionally removes the old
`strconv` module which has not seen much use in quite a long time. All generic
functionality has been supplanted with traits in the `num` crate and the
`strconv` module is supplanted with the [rust-strconv crate][rust-strconv].

[rust-strconv]: https://github.com/lifthrasiir/rust-strconv

This is a breaking change due to the removal of these deprecated crates, and the
alternative crates are listed above.

[breaking-change]
2015-04-21 11:37:43 -07:00
Alex Crichton
e091ba3f3e std: Remove deprecated AsPath trait 2015-04-21 11:37:35 -07:00
Alex Crichton
69ded69d63 std: Remove deprecated AsOsStr/Str/AsSlice traits
Cleaning out more deprecated items
2015-04-21 11:37:34 -07:00
Alex Crichton
9ab0475d94 rustc: Handle duplicate names merging archives
When linking an archive statically to an rlib, the compiler will extract all
contents of the archive and add them all to the rlib being generated. The
current method of extraction is to run `ar x`, dumping all files into a
temporary directory. Object archives, however, are allowed to have multiple
entries with the same file name, so there is no method for them to extract their
contents into a directory in a lossless fashion.

This commit adds iterator support to the `ArchiveRO` structure which hooks into
LLVM's support for reading object archives. This iterator is then used to
inspect each object in turn and extract it to a unique location for later
assembly.
2015-04-21 11:08:19 -07:00
Steve Klabnik
f0a3b6c509 Add research to README of TRPL
This section was added but the list wasn't updated.
2015-04-21 13:49:23 -04:00
Erick Tryzelaar
19c8d70174 syntax: Copy unstable str::char_at into libsyntax 2015-04-21 10:23:53 -07:00
Steve Klabnik
0070625495 small edits for recently written book chapters 2015-04-21 13:17:43 -04:00
Erick Tryzelaar
7f9180fcb9 syntax: Change ExpnId::{from,to}_llvm_cookie to {from,to}_u32 2015-04-21 10:11:05 -07:00
Erick Tryzelaar
83b1d7fd6f syntax: Remove #[feature(path_ext)]
Replace Path::exists with stable metadata call.
2015-04-21 10:09:27 -07:00
Erick Tryzelaar
c3da1a1912 syntax: replace Vec::push_all with stable Vec::extend 2015-04-21 10:09:26 -07:00
Erick Tryzelaar
21143aae94 syntax: Replace Vec::map_in_place with stable mut iterator 2015-04-21 10:08:57 -07:00
Erick Tryzelaar
a2cfe38505 syntax: Replace [].tail with the stable [1..] syntax 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
2937cce70c syntax: Replace String::from_str with the stable String::from 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
8553658952 syntax: remove #[feature(quote, unsafe_destructor)] 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
bc6d990adb syntax: Don't use unstable fn to convert single element to a slice 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
e3dd68d0a4 syntax: Remove use of TraitObject in pretty printer 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
cfb9d286ea syntax: remove uses of .into_cow() 2015-04-21 10:08:26 -07:00
Erick Tryzelaar
ca0ee4c645 syntax: Remove uses of #[feature(slice_patterns)] 2015-04-21 10:08:26 -07:00
Erick Tryzelaar
a4541b02a3 syntax: remove #![feature(box_syntax, box_patterns)] 2015-04-21 10:07:48 -07:00
John Van Enk
5f7556cd39 Add an example of completely slicing an object. 2015-04-21 09:21:52 -07:00
Simon Sapin
16181e686a Pick a feature name for write_char 2015-04-21 18:16:08 +02:00
Brian Campbell
3cc84efcdd Deprecate std::fs::soft_link in favor of platform-specific versions
On Windows, when you create a symbolic link you must specify whether it
points to a directory or a file, even if it is created dangling, while
on Unix, the same symbolic link could point to a directory, a file, or
nothing at all.  Furthermore, on Windows special privilege is necessary
to use a symbolic link, while on Unix, you can generally create a
symbolic link in any directory you have write privileges to.

This means that it is unlikely to be able to use symbolic links purely
portably; anyone who uses them will need to think about the cross
platform implications.  This means that using platform-specific APIs
will make it easier to see where code will need to differ between the
platforms, rather than trying to provide some kind of compatibility
wrapper.

Furthermore, `soft_link` has no precedence in any other API, so to avoid
confusion, move back to the more standard `symlink` terminology.

Create a `std::os::unix::symlink` for the Unix version that is
destination type agnostic, as well as `std::os::windows::{symlink_file,
symlink_dir}` for Windows.

Because this is a stable API, leave a compatibility wrapper in
`std::fs::soft_link`, which calls `symlink` on Unix and `symlink_file`
on Windows, preserving the existing behavior of `soft_link`.
2015-04-21 12:14:22 -04: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
Simon Sapin
19cc9435d9 write_char is unlikely to make it for 1.0, it’ll be 1.1 2015-04-21 18:06:00 +02:00
Tamir Duberstein
71bc70ea1b Remove references to old_{path,io} 2015-04-21 08:16:03 -07:00
Tamir Duberstein
fe7f95fb3c Remove dead test
This was moved to https://github.com/rust-lang/term/issues/12
2015-04-21 08:16:02 -07:00
Tamir Duberstein
32e5f4948f Remove unused files
Looks like these were missed in bf4e77d.
2015-04-21 08:16:02 -07:00
Young Wu
7a0df61ab1 add TCP_* consts for linux 2015-04-21 22:42:34 +08: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
Tamir Duberstein
ba276adab5 LLVM < 3.5 is unsupported since bb18a3c 2015-04-21 07:20:48 -07:00
Simon Sapin
265a7cc3bd Add a write_char method to std::fmt::Write
as accepted in [RFC 526](https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md).
2015-04-21 14:51:28 +02:00
Steve Klabnik
9cc0af8d69 Refocus unsafe code chapter on unsafe itself. 2015-04-21 08:28:06 -04: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
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
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
Steve Klabnik
836c8a826b TRPL editing: match 2015-04-20 09:37:46 -04:00
Steve Klabnik
213708867e TRPL editing: enums
Now that we're not doing the guessing game, a lot of this is irrelevant.
2015-04-20 09:37:45 -04:00
bors
be9a72b9c1 Auto merge of #22117 - fhahn:fail-on-errors, r=nikomatsakis
At the moment, when compilation is stopped at a stop point (like `-Z parse-only`), `rustc` does not return an nonzero exit code even if there are errors (expect fatal ones, that cause it to panic immediately). As an example, compiling `src/test/compile-fail/doc-before-semi.rs` with `-Z parse-only` raises an error, but exists with 0.

Note that I could not use `sess.abort_if_errors()` in the macro, because `sess` is passed by value and move at some point.
2015-04-20 13:20:19 +00:00
Corey Farwell
be08d35c8f Simplify alloc::arc::Arc example in doc-comment
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 08:57:06 -04:00
bors
fe11393172 Auto merge of #24525 - GuillaumeGomez:check-const, r=pnkfelix
Part of #24407.
2015-04-20 10:26:17 +00:00
Guillaume Gomez
737005a110 Fix typos 2015-04-20 12:01:56 +02:00
bors
5910dc0e8e Auto merge of #24608 - frewsxcv:patch-15, r=alexcrichton 2015-04-20 02:47:45 +00:00
York Xiang
c3c761058c Improve doc for Result::unwrap() 2015-04-20 08:59:06 +08:00
bors
07560d2330 Auto merge of #24586 - richo:test-16745, r=jakub-
closes #16745
2015-04-20 00:43:37 +00:00
Guillaume Gomez
8a6980c553 Add long explanation for E0018 2015-04-20 00:49:53 +02:00
bors
c64feb6341 Auto merge of #24592 - P1start:style-lints-changes, r=alexcrichton
Passing a non-snake-case name to `#![crate_name]` or `--crate-name` will now yield a warning from the `non_snake_case` lint.
2015-04-19 21:36:14 +00:00
Piotr Czarnecki
e5e343aeb7 Finished unicode support in the model lexer.
Completed XID_Start and XID_Continue rules
2015-04-19 23:05:32 +02:00
Florian Hahn
be437132b8 Add proper XID_Start and XID_Continue rules and use CharPos for span comparison, closes #15679 2015-04-19 23:02:10 +02:00
Ariel Ben-Yehuda
94a1b266f9 Call skolemize_late_bound_regions only after fast rejection
skolemize_late_bound_regions essentially copies the entire type (most of the times it shouldn't, but it does), and match_impl runs millions of times.

Times compiling rustc, tested with
$ make -j4 rustc-stage1
$ ( time RUSTFLAGS=-Z time-passes make -j4 rustc-stage2 ) # need LLVM time for calibration

Before:
real	21m44.960s
user	29m38.812s
sys	0m14.944s

After:
real	19m31.445s
user	26m47.260s
sys	0m14.952s

Making this is a 10% performance improvement.

LLVM passes took 867 seconds before, 862 seconds after.
2015-04-19 23:38:37 +03:00
bors
da355efc1c Auto merge of #24517 - erickt:str, r=alexcrichton
This implementation is currently about 3-4 times faster than using the `.to_string()` based approach.

I would also suggest we deprecate `String::from_str` since it's redundant with the stable `String::from` method, but I'll leave that for a future PR.
2015-04-19 19:32:45 +00:00
Erick Tryzelaar
f055054eab collections: Move optimized String::from_str to String::from
This implementation is currently about 3-4 times faster than using
the `.to_string()` based approach.
2015-04-19 10:59:06 -07:00
bors
c6b8d96abd Auto merge of #24526 - klutzy:getrandom-fix, r=alexcrichton
Fixes #21538.
2015-04-19 17:28:27 +00:00
Corey Farwell
aaafb96abd Fix typos in code comments 2015-04-19 12:18:51 -04:00
bors
ddf25c890d Auto merge of #24572 - steveklabnik:gh24569, r=brson
Fixes #24569.

Should wait until https://github.com/rust-lang/rust-www/pull/114 is merged.
2015-04-19 15:24:19 +00:00
bors
be41e98067 Auto merge of #24567 - tamird:windows-caviats, r=steveklabnik
- https://github.com/rust-lang/rust/issues/1237 is closed
- `libgcc` is now statically linked:
  https://github.com/rust-lang/rust/pull/17471
2015-04-19 13:20:24 +00:00
bors
d86b6f67bc Auto merge of #24559 - frewsxcv:get-mut-if-let, r=steveklabnik
None
2015-04-19 11:16:45 +00:00
York Xiang
adc93ceac9 rustdoc: don't inject "extern crate std;" 2015-04-19 18:10:45 +08:00
P1start
c163f89310 Lint non-snake-case crate names
Passing a non-snake-case name to #![crate_name] or --crate-name will now yield a
warning from the `non_snake_case` lint.
2015-04-19 20:31:18 +12:00
klutzy
4d80a82381 std::rand::os: Fix race condition of atomics
Fixes #21538.
2015-04-19 16:56:35 +09:00
bors
14d9d1c1cf Auto merge of #24552 - meqif:explain, r=alexcrichton
cc #24407
2015-04-19 07:51:27 +00:00
Richo Healey
4cf9e2db5e test: Add an assertion to the #16745 testcase 2015-04-19 00:25:13 -07:00
bors
049de3fe7f Auto merge of #24555 - frewsxcv:patch-14, r=steveklabnik 2015-04-19 05:46:47 +00:00
bors
bd968a1d65 Auto merge of #24554 - tshepang:let-faq, r=steveklabnik 2015-04-19 03:42:59 +00:00
Richo Healey
57fdeecd91 test: Add testcase for #16745 2015-04-18 17:41:18 -07:00
Ricardo Martins
5c7a0ba06e Add long diagnostics for E0133. 2015-04-19 00:36:59 +01:00
bors
00978a9879 Auto merge of #24383 - avdi:patch-1, r=steveklabnik
"Dynamically typed" didn't seem like a relevant distinction; there are statically-compiled dynamically-typed languages. Another term that might work here (despite being notoriously vague) is "scripting languages".
2015-04-18 23:35:50 +00:00
Guillaume Gomez
1d7d0192d2 Add backquotes to have better looking rust code 2015-04-19 00:01:58 +02:00
Steve Klabnik
290da6f016 Remove the 30 minute intro
Fixes #24569.
2015-04-18 17:55:31 -04:00
bors
a16640051d Auto merge of #24560 - kwantam:apply_table_opt, r=alexcrichton
Apply optimization described in
https://github.com/rust-lang/regex/pull/73#issuecomment-93777126
to rust's copy of `unicode.py`.

This shrinks librustc_unicode's tables.rs from 479kB to 456kB,
and should improve performance slightly for related operations
(e.g., is_alphabetic(), is_xid_start(), etc).

In addition, pull in fix from @dscorbett's commit
d25c39f86568a147f9b7080c25711fb1f98f056a in regex, which
makes `load_properties()` more tolerant of whitespace
in the Unicode tables. (This fix does not result in any
changes to tables.rs, but could if the Unicode tables
change in the future.)
2015-04-18 21:30:03 +00:00
Corey Farwell
d2ed11862c Indicate keywords are code-like in Fuse::reset_fuse doc comment 2015-04-18 16:48:29 -04:00
Tamir Duberstein
a8aa4ee034 Update Windows caveats
- https://github.com/rust-lang/rust/issues/1237 is closed
- `libgcc` is now statically linked:
  https://github.com/rust-lang/rust/pull/17471
2015-04-18 13:00:40 -07:00
Manish Goregaokar
88601f8d7d fix doctest (fixup #24466) 2015-04-19 00:54:42 +05:30
Manish Goregaokar
695efb53d6 Rollup merge of #24548 - graydon:reference-tidying, r=steveklabnik
This just deletes some egregious lies and obsolete terminology -- all of which I originally wrote -- from the reference. I expect the reference itself will be deleted soon enough, but I found myself gritting teeth over these bits too much to let them into a 1.0 release.
2015-04-18 23:29:58 +05:30
Manish Goregaokar
cb7a12757b Rollup merge of #24542 - michaelsproul:rollup, r=alexcrichton
I did a manual merge of all the extended error PRs as we were getting merge conflicts yesterday. I think this is preferable to merging separately as I ended up having to manually merge @nham and @GuillaumeGomez's commits.

Rollup of #24458, #24482 and #24488.

#24482 and #24488 were already re-approved, and would need to be cancelled if this is merged instead.
2015-04-18 23:29:57 +05:30
Manish Goregaokar
4afd45e5b3 Rollup merge of #24472 - dotdash:23431, r=nikomatsakis
Loading from and storing to small aggregates happens by casting the
aggregate pointer to an appropriately sized integer pointer to avoid
the usage of first class aggregates which would lead to less optimized
code.

But this means that, for example, a tuple of type (i16, i16) will be
loading through an i32 pointer and because we currently don't provide
alignment information LLVM assumes that the load should use the ABI
alignment for i32 which would usually be 4 byte alignment. But the
alignment requirement for the (i16, i16) tuple will usually be just 2
bytes, so we're overestimating alignment, which invokes undefined
behaviour.

Therefore we must emit appropriate alignment information for
stores/loads through such casted pointers.

Fixes #23431
2015-04-18 23:29:57 +05:30
Manish Goregaokar
514e06d65d Rollup merge of #24466 - steveklabnik:more_more_more, r=alexcrichton
Link to the big chapter for now, and add move semantics.
2015-04-18 23:29:57 +05:30
kwantam
f14d289d71 optimize Unicode tables
Apply optimization described in
https://github.com/rust-lang/regex/pull/73#issuecomment-93777126
to rust's copy of `unicode.py`.

This shrinks librustc_unicode's tables.rs from 479kB to 456kB,
and should improve performance slightly for related operations
(e.g., is_alphabetic(), is_xid_start(), etc).

In addition, pull in fix from @dscorbett's commit
d25c39f86568a147f9b7080c25711fb1f98f056a in regex, which
makes `load_properties()` more tolerant of whitespace
in the Unicode tables. (This fix does not result in any
changes to tables.rs, but could if the Unicode tables
change in the future.)
2015-04-18 13:20:57 -04:00
Corey Farwell
68d003c9ba Utilize if..let for get_mut doc-comment examples 2015-04-18 12:45:05 -04:00
Björn Steinbrink
78745a4afe Emit correct alignment information for loads/store of small aggregates
Loading from and storing to small aggregates happens by casting the
aggregate pointer to an appropriately sized integer pointer to avoid
the usage of first class aggregates which would lead to less optimized
code.

But this means that, for example, a tuple of type (i16, i16) will be
loading through an i32 pointer and because we currently don't provide
alignment information LLVM assumes that the load should use the ABI
alignment for i32 which would usually be 4 byte alignment. But the
alignment requirement for the (i16, i16) tuple will usually be just 2
bytes, so we're overestimating alignment, which invokes undefined
behaviour.

Therefore we must emit appropriate alignment information for
stores/loads through such casted pointers.

Fixes #23431
2015-04-18 18:32:14 +02:00
Tshepang Lekhonkhobe
4665c3bbfa doc: improve/fix 'let' FAQ 2015-04-18 17:36:41 +02:00
Niko Matsakis
6dfeda7d4b Rather than storing the relations between free-regions in a global
table, introduce a `FreeRegionMap` data structure. regionck computes the
`FreeRegionMap` for each fn and stores the result into the tcx so that
borrowck can use it (this could perhaps be refactored to have borrowck
recompute the map, but it's a bid tedious to recompute due to the
interaction of closures and free fns). The main reason to do this is
because of #22779 -- using a global table was incorrect because when
validating impl method signatures, we want to use the free region
relationships from the *trait*, not the impl.

Fixes #22779.
2015-04-18 11:35:51 -04:00
bors
fcf637b19f Auto merge of #24519 - rprichard:opt-write-args, r=alexcrichton
It's just as convenient, but it's much faster. Using write! requires an
extra call to fmt::write and a extra dynamically dispatched call to
Arguments' Display format function.
2015-04-18 12:35:07 +00:00
Florian Hahn
2a24e97c80 Return nonzero exit code if there are errors at a stop point 2015-04-18 12:23:49 +02:00
bors
ba1192835b Auto merge of #24464 - lambdaburrito:master, r=alexcrichton
resolves #24462
2015-04-18 09:12:53 +00:00
bors
7a5754b330 Auto merge of #24428 - kwantam:deprecate_unicode_fns, r=alexcrichton
This patch
1. renames libunicode to librustc_unicode,
2. deprecates several pieces of libunicode (see below), and
3. removes references to deprecated functions from
   librustc_driver and libsyntax. This may change pretty-printed
   output from these modules in cases involving wide or combining
   characters used in filenames, identifiers, etc.

The following functions are marked deprecated:

1. char.width() and str.width():
   --> use unicode-width crate

2. str.graphemes() and str.grapheme_indices():
   --> use unicode-segmentation crate

3. str.nfd_chars(), str.nfkd_chars(), str.nfc_chars(), str.nfkc_chars(),
   char.compose(), char.decompose_canonical(), char.decompose_compatible(),
   char.canonical_combining_class():
   --> use unicode-normalization crate
2015-04-18 07:09:22 +00:00
bors
77213d1b28 Auto merge of #24209 - nikomatsakis:refactor-unification, r=nrc
I'm on a quest to slowly refactor a lot of the inference code. A first step for that is moving the "pure data structures" out so as to simplify what's left. This PR moves `snapshot_vec`, `graph`, and `unify` into their own crate (`librustc_data_structures`). They can then be unit-tested, benchmarked, etc more easily. As a benefit, I improved the performance of unification slightly on the benchmark I added vs the original code.

r? @nrc
2015-04-18 04:57:56 +00:00
Graydon Hoare
a99a8b0a92 Remove obsolete discusison of runtime, promote Linkage to chapter. 2015-04-17 20:02:55 -07:00
Graydon Hoare
744085ed1d Improve memory-model section very slightly. 2015-04-17 20:01:03 -07:00
Graydon Hoare
f5b2963103 Improve special-traits section very slightly. 2015-04-17 20:00:47 -07:00
bors
efa6a46a8e Auto merge of #24133 - kballard:add-sync-to-io-error, r=alexcrichton
This allows `io::Error` values to be stored in `Arc` properly.

Because this requires `Sync` of any value passed to `io::Error::new()`
and modifies the relevant `convert::From` impls, this is a

[breaking-change]

Fixes #24049.
2015-04-18 02:53:53 +00:00
Graydon Hoare
7f2f09f1b4 Eliminate the obsolete term 'slot'. 2015-04-17 19:52:29 -07:00
Graydon Hoare
21e2e6eec8 Clean up section on Type aliases. 2015-04-17 19:29:20 -07:00
Graydon Hoare
806d024783 Trim florid language. 2015-04-17 19:24:28 -07:00
Graydon Hoare
ca14b8121c Trim malformed sentence. 2015-04-17 19:22:19 -07:00
bors
1284be4044 Auto merge of #23985 - erickt:derive-cleanup, r=erickt
This extracts some of the minor cleanup patches from #23905.
2015-04-18 00:48:34 +00:00
Alex Crichton
8f5b5f94dc std: Add Default/IntoIterator/ToOwned to the prelude
This is an implementation of [RFC 1030][rfc] which adds these traits to the
prelude and additionally removes all inherent `into_iter` methods on collections
in favor of the trait implementation (which is now accessible by default).

[rfc]: https://github.com/rust-lang/rfcs/pull/1030

This is technically a breaking change due to the prelude additions and removal
of inherent methods, but it is expected that essentially no code breaks in
practice.

[breaking-change]
Closes #24538
2015-04-17 16:37:30 -07:00
Guillaume Gomez
50f75f3e2a Add long diagnostics for "bind by-ref and by-move" 2015-04-18 08:45:50 +10:00
bors
b08d6cf529 Auto merge of #24500 - pnkfelix:oflo-checked-neg, r=nikomatsakis
Add conditional overflow-checking to signed negate operator.

I argue this can land independently of #24420 , because one can write the implementation of `wrapped_neg()` inline if necessary (as illustrated in two cases on this PR).

This needs to go into beta channel.
2015-04-17 22:45:10 +00:00
Nick Hamann
017bc44712 Add long diagnostics for E0015 2015-04-18 08:41:20 +10:00
Nick Hamann
22ce069c7e Add long diagnostics for E0020 2015-04-18 08:40:57 +10:00
bors
f305579e49 Auto merge of #24461 - nikomatsakis:issue-22077-unused-lifetimes, r=aturon
This makes it illegal to have unconstrained lifetimes that appear in an associated type definition. Arguably, we should prohibit all unconstrained lifetimes -- but it would break various macros. It'd be good to evaluate how large a break change it would be. But this seems like the minimal change we need to do to establish soundness, so we should land it regardless. Another variant would be to prohibit all lifetimes that appear in any impl item, not just associated types. I don't think that's necessary for soundness -- associated types are different because they can be projected -- but it would feel a bit more consistent and "obviously" safe. I'll experiment with that in the meantime.

r? @aturon 

Fixes #22077.
2015-04-17 20:38:18 +00:00
bors
9d2ac9b1e1 Auto merge of #24475 - arielb1:i24363-hacky-hack, r=pnkfelix
Fix #24363
2015-04-17 16:26:20 +00:00
Niko Matsakis
e47fb489c1 Address nits 2015-04-17 10:12:55 -04:00
Niko Matsakis
65ccffd224 Add licenses. 2015-04-17 10:12:55 -04:00
Niko Matsakis
416f388c6f Port to use the new Unify code, which has no UnifyValue trait
but is otherwise mostly the same.
2015-04-17 10:12:55 -04:00
Niko Matsakis
7ab0d1ab67 Port to using the newer graph, which offers iterators instead of the
older `each` method, but is otherwise identical.
2015-04-17 10:12:55 -04:00
Niko Matsakis
52c3462586 Use the newer snapshot_vec, which has a simplified delegate
interface since in practice no delegates had any state.
2015-04-17 10:12:55 -04:00
Niko Matsakis
966e53d8b6 Add librustc_data_structures crate 2015-04-17 10:12:53 -04:00
Niko Matsakis
5368070228 Fix some missing cases 2015-04-17 10:05:33 -04:00
Niko Matsakis
39b79285be Augment the constrainted parameter check to ensure that all regions
which get mentioned in an associated type are constrained.  Arguably we
should just require that all regions are constrained, but that is more
of a breaking change.
2015-04-17 10:05:33 -04:00
Niko Matsakis
ad3cbacd02 Rewrite constrained type params code to operate generically over
multiple kinds of parameters (regions and types, specifically)
2015-04-17 10:05:33 -04:00
Niko Matsakis
4a1f556999 Create a struct to represent early-bound regions 2015-04-17 10:05:32 -04:00
Felix S. Klock II
b8ec7e88fc unit test for checked overflow during signed negation. 2015-04-17 15:32:30 +02:00
Manish Goregaokar
c98115cefb Remove info for path (fixup #24452) 2015-04-17 19:01:33 +05:30
Manish Goregaokar
1b6bd92790 Rollup merge of #24515 - steveklabnik:gh24070, r=Gankro
Fixes #24070

or rather, fixes it even though it's already been fixed: slices are before now. But the linking is nice anyway.
2015-04-17 19:01:32 +05:30
Manish Goregaokar
27dc069234 Rollup merge of #24513 - j1n3l0:patch-1, r=alexcrichton 2015-04-17 19:01:32 +05:30
Manish Goregaokar
bdef7f62f5 Rollup merge of #24491 - bluss:rangefull-debug, r=huonw
Fix Debug impl for RangeFull

The Debug impl was using quotes, which was inconsistent:

    => (.., 1.., 2..3, ..4)
    (\"..\", 1.., 2..3, ..4)

Fix to use just ..
2015-04-17 19:01:28 +05:30
Manish Goregaokar
a1bb0a182c Rollup merge of #24475 - arielb1:i24363-hacky-hack, r=pnkfelix
Fix #24363
2015-04-17 19:01:28 +05:30
Manish Goregaokar
9c4995f694 Rollup merge of #24454 - aochagavia:debug, r=alexcrichton
Implement `Debug`, `Display` and `Error` for `FatalError` and `ExplicitBug`
2015-04-17 18:32:26 +05:30
Manish Goregaokar
3118cd7dad Rollup merge of #24452 - tbu-:pr_file_path, r=aturon
Fixes #22190.
2015-04-17 18:32:25 +05:30
Manish Goregaokar
373463615a Rollup merge of #24430 - laumann:trace-macros-flag, r=pnkfelix
This is the second attempt at turning the trace_macros macro into a compiler flag.

See #22619
2015-04-17 18:32:25 +05:30
Felix S. Klock II
5e7785cabc Workaround deliberate overflowing negation in serialize::json. 2015-04-17 14:54:55 +02:00